multi: rename experimental endorsement signal to accountable
Renames the endorsement signal to accountable to match the latest proposal https://github.com/lightning/blips/pull/67
This commit is contained in:
1 parent
801de79cf1
commit
34329c684e
21 files changed
+229
-227
No files matched your search
+24
-24
@@ -290,9 +290,9 @@ type ChannelLinkConfig struct {
|
||||
// restrict the flow of HTLCs and fee updates.
|
||||
MaxFeeExposure lnwire.MilliSatoshi
|
||||
|
||||
// ShouldFwdExpEndorsement is a closure that indicates whether the link
|
||||
// should forward experimental endorsement signals.
|
||||
ShouldFwdExpEndorsement func() bool
|
||||
// ShouldFwdExpAccountability is a closure that indicates whether the
|
||||
// link should forward experimental accountability signals.
|
||||
ShouldFwdExpAccountability func() bool
|
||||
|
||||
// AuxTrafficShaper is an optional auxiliary traffic shaper that can be
|
||||
// used to manage the bandwidth of the link.
|
||||
@@ -3163,11 +3163,11 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
|
||||
continue
|
||||
}
|
||||
|
||||
endorseValue := l.experimentalEndorsement(
|
||||
accountableValue := l.experimentalAccountability(
|
||||
record.CustomSet(add.CustomRecords),
|
||||
)
|
||||
endorseType := uint64(
|
||||
lnwire.ExperimentalEndorsementType,
|
||||
accountableType := uint64(
|
||||
lnwire.ExperimentalAccountableType,
|
||||
)
|
||||
|
||||
switch fwdPkg.State {
|
||||
@@ -3191,9 +3191,9 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
|
||||
BlindingPoint: fwdInfo.NextBlinding,
|
||||
}
|
||||
|
||||
endorseValue.WhenSome(func(e byte) {
|
||||
accountableValue.WhenSome(func(e byte) {
|
||||
custRecords := map[uint64][]byte{
|
||||
endorseType: {e},
|
||||
accountableType: {e},
|
||||
}
|
||||
|
||||
outgoingAdd.CustomRecords = custRecords
|
||||
@@ -3249,9 +3249,9 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
|
||||
BlindingPoint: fwdInfo.NextBlinding,
|
||||
}
|
||||
|
||||
endorseValue.WhenSome(func(e byte) {
|
||||
accountableValue.WhenSome(func(e byte) {
|
||||
addMsg.CustomRecords = map[uint64][]byte{
|
||||
endorseType: {e},
|
||||
accountableType: {e},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -3340,44 +3340,44 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
|
||||
l.forwardBatch(reforward, switchPackets...)
|
||||
}
|
||||
|
||||
// experimentalEndorsement returns the value to set for our outgoing
|
||||
// experimental endorsement field, and a boolean indicating whether it should
|
||||
// be populated on the outgoing htlc.
|
||||
func (l *channelLink) experimentalEndorsement(
|
||||
// experimentalAccountability returns the value to set for our outgoing
|
||||
// experimental accountable field. It only considers the accountability bit,
|
||||
// other custom records present are not considered for forwarding.
|
||||
func (l *channelLink) experimentalAccountability(
|
||||
customUpdateAdd record.CustomSet) fn.Option[byte] {
|
||||
|
||||
// Only relay experimental signal if we are within the experiment
|
||||
// period.
|
||||
if !l.cfg.ShouldFwdExpEndorsement() {
|
||||
if !l.cfg.ShouldFwdExpAccountability() {
|
||||
return fn.None[byte]()
|
||||
}
|
||||
|
||||
// If we don't have any custom records or the experimental field is
|
||||
// not set, just forward a zero value.
|
||||
if len(customUpdateAdd) == 0 {
|
||||
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
|
||||
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
|
||||
}
|
||||
|
||||
t := uint64(lnwire.ExperimentalEndorsementType)
|
||||
t := uint64(lnwire.ExperimentalAccountableType)
|
||||
value, set := customUpdateAdd[t]
|
||||
if !set {
|
||||
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
|
||||
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
|
||||
}
|
||||
|
||||
// We expect at least one byte for this field, consider it invalid if
|
||||
// it has no data and just forward a zero value.
|
||||
if len(value) == 0 {
|
||||
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
|
||||
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
|
||||
}
|
||||
|
||||
// Only forward endorsed if the incoming link is endorsed.
|
||||
if value[0] == lnwire.ExperimentalEndorsed {
|
||||
return fn.Some[byte](lnwire.ExperimentalEndorsed)
|
||||
// Only forward accountable if the incoming link is accountable.
|
||||
if value[0] == lnwire.ExperimentalAccountable {
|
||||
return fn.Some[byte](lnwire.ExperimentalAccountable)
|
||||
}
|
||||
|
||||
// Forward as unendorsed otherwise, including cases where we've
|
||||
// Forward as unaccountable otherwise, including cases where we've
|
||||
// received an invalid value that uses more than 3 bits of information.
|
||||
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
|
||||
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
|
||||
}
|
||||
|
||||
// processExitHop handles an htlc for which this link is the exit hop. It
|
||||
|
||||
+23
-23
@@ -2234,18 +2234,18 @@ func newSingleLinkTestHarness(t *testing.T, chanAmt,
|
||||
PendingCommitTicker: ticker.New(time.Minute),
|
||||
// Make the BatchSize and Min/MaxUpdateTimeout large enough
|
||||
// to not trigger commit updates automatically during tests.
|
||||
BatchSize: 10000,
|
||||
MinUpdateTimeout: 30 * time.Minute,
|
||||
MaxUpdateTimeout: 40 * time.Minute,
|
||||
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
|
||||
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
|
||||
NotifyActiveLink: func(wire.OutPoint) {},
|
||||
NotifyActiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
|
||||
HtlcNotifier: aliceSwitch.cfg.HtlcNotifier,
|
||||
GetAliases: getAliases,
|
||||
ShouldFwdExpEndorsement: func() bool { return true },
|
||||
BatchSize: 10000,
|
||||
MinUpdateTimeout: 30 * time.Minute,
|
||||
MaxUpdateTimeout: 40 * time.Minute,
|
||||
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
|
||||
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
|
||||
NotifyActiveLink: func(wire.OutPoint) {},
|
||||
NotifyActiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
|
||||
HtlcNotifier: aliceSwitch.cfg.HtlcNotifier,
|
||||
GetAliases: getAliases,
|
||||
ShouldFwdExpAccountability: func() bool { return true },
|
||||
}
|
||||
|
||||
aliceLink := NewChannelLink(aliceCfg, aliceLc.channel)
|
||||
@@ -4924,17 +4924,17 @@ func (h *persistentLinkHarness) restartLink(
|
||||
MinUpdateTimeout: 30 * time.Minute,
|
||||
MaxUpdateTimeout: 40 * time.Minute,
|
||||
// Set any hodl flags requested for the new link.
|
||||
HodlMask: hodl.MaskFromFlags(hodlFlags...),
|
||||
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
|
||||
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
|
||||
NotifyActiveLink: func(wire.OutPoint) {},
|
||||
NotifyActiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
|
||||
HtlcNotifier: h.hSwitch.cfg.HtlcNotifier,
|
||||
SyncStates: syncStates,
|
||||
GetAliases: getAliases,
|
||||
ShouldFwdExpEndorsement: func() bool { return true },
|
||||
HodlMask: hodl.MaskFromFlags(hodlFlags...),
|
||||
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
|
||||
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
|
||||
NotifyActiveLink: func(wire.OutPoint) {},
|
||||
NotifyActiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
|
||||
HtlcNotifier: h.hSwitch.cfg.HtlcNotifier,
|
||||
SyncStates: syncStates,
|
||||
GetAliases: getAliases,
|
||||
ShouldFwdExpAccountability: func() bool { return true },
|
||||
}
|
||||
|
||||
aliceLink := NewChannelLink(aliceCfg, aliceChannel)
|
||||
|
||||
+21
-21
@@ -1157,27 +1157,27 @@ func (h *hopNetwork) createChannelLink(server, peer *mockServer,
|
||||
UpdateContractSignals: func(*contractcourt.ContractSignals) error {
|
||||
return nil
|
||||
},
|
||||
NotifyContractUpdate: notifyContractUpdate,
|
||||
ChainEvents: &contractcourt.ChainEventSubscription{},
|
||||
SyncStates: true,
|
||||
BatchSize: 10,
|
||||
BatchTicker: ticker.NewForce(testBatchTimeout),
|
||||
FwdPkgGCTicker: ticker.NewForce(fwdPkgTimeout),
|
||||
PendingCommitTicker: ticker.New(2 * time.Minute),
|
||||
MinUpdateTimeout: minFeeUpdateTimeout,
|
||||
MaxUpdateTimeout: maxFeeUpdateTimeout,
|
||||
OnChannelFailure: func(lnwire.ChannelID, lnwire.ShortChannelID, LinkFailureError) {},
|
||||
OutgoingCltvRejectDelta: 3,
|
||||
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
|
||||
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
|
||||
MaxAnchorsCommitFeeRate: chainfee.SatPerKVByte(10 * 1000).FeePerKWeight(),
|
||||
NotifyActiveLink: func(wire.OutPoint) {},
|
||||
NotifyActiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
|
||||
HtlcNotifier: server.htlcSwitch.cfg.HtlcNotifier,
|
||||
GetAliases: getAliases,
|
||||
ShouldFwdExpEndorsement: func() bool { return true },
|
||||
NotifyContractUpdate: notifyContractUpdate,
|
||||
ChainEvents: &contractcourt.ChainEventSubscription{},
|
||||
SyncStates: true,
|
||||
BatchSize: 10,
|
||||
BatchTicker: ticker.NewForce(testBatchTimeout),
|
||||
FwdPkgGCTicker: ticker.NewForce(fwdPkgTimeout),
|
||||
PendingCommitTicker: ticker.New(2 * time.Minute),
|
||||
MinUpdateTimeout: minFeeUpdateTimeout,
|
||||
MaxUpdateTimeout: maxFeeUpdateTimeout,
|
||||
OnChannelFailure: func(lnwire.ChannelID, lnwire.ShortChannelID, LinkFailureError) {},
|
||||
OutgoingCltvRejectDelta: 3,
|
||||
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
|
||||
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
|
||||
MaxAnchorsCommitFeeRate: chainfee.SatPerKVByte(10 * 1000).FeePerKWeight(),
|
||||
NotifyActiveLink: func(wire.OutPoint) {},
|
||||
NotifyActiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveChannel: func(wire.OutPoint) {},
|
||||
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
|
||||
HtlcNotifier: server.htlcSwitch.cfg.HtlcNotifier,
|
||||
GetAliases: getAliases,
|
||||
ShouldFwdExpAccountability: func() bool { return true },
|
||||
},
|
||||
channel,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user