Skip to content

Commit 99d07fd

Browse files
authored
Merge pull request #10367 from elnosh/rename-endorsement-accountable
multi: rename experimental endorsement signal to accountable
2 parents d3ce622 + 6f49bea commit 99d07fd

22 files changed

+224
-274
lines changed

docs/release-notes/release-notes-0.21.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
This applies to both funders and fundees, with the ability to override the
7676
value during channel opening or acceptance.
7777

78+
* Rename [experimental endorsement signal](https://github.com/lightning/blips/blob/a833e7b49f224e1240b5d669e78fa950160f5a06/blip-0004.md)
79+
to [accountable](https://github.com/lightningnetwork/lnd/pull/10367) to match
80+
the latest [proposal](https://github.com/lightning/blips/pull/67).
81+
7882
## RPC Updates
7983

8084
## lncli Updates

feature/default_sets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ var defaultSetDesc = setDesc{
100100
SetInit: {}, // I
101101
SetNodeAnn: {}, // N
102102
},
103-
lnwire.ExperimentalEndorsementOptional: {
103+
lnwire.ExperimentalAccountabilityOptional: {
104104
SetNodeAnn: {}, // N
105105
},
106106
lnwire.RbfCoopCloseOptionalStaging: {

feature/manager.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ type Config struct {
6969
// NoTaprootOverlay unsets the taproot overlay channel feature bits.
7070
NoTaprootOverlay bool
7171

72-
// NoExperimentalEndorsement unsets any bits that signal support for
73-
// forwarding experimental endorsement.
74-
NoExperimentalEndorsement bool
72+
// NoExperimentalAccountability unsets any bits that signal support for
73+
// forwarding experimental accountability.
74+
NoExperimentalAccountability bool
7575

7676
// NoRbfCoopClose unsets any bits that signal support for using RBF for
7777
// coop close.
@@ -213,9 +213,9 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
213213
raw.Unset(lnwire.SimpleTaprootOverlayChansOptional)
214214
raw.Unset(lnwire.SimpleTaprootOverlayChansRequired)
215215
}
216-
if cfg.NoExperimentalEndorsement {
217-
raw.Unset(lnwire.ExperimentalEndorsementOptional)
218-
raw.Unset(lnwire.ExperimentalEndorsementRequired)
216+
if cfg.NoExperimentalAccountability {
217+
raw.Unset(lnwire.ExperimentalAccountabilityOptional)
218+
raw.Unset(lnwire.ExperimentalAccountabilityRequired)
219219
}
220220
if cfg.NoRbfCoopClose {
221221
raw.Unset(lnwire.RbfCoopCloseOptionalStaging)

htlcswitch/link.go

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ type ChannelLinkConfig struct {
290290
// restrict the flow of HTLCs and fee updates.
291291
MaxFeeExposure lnwire.MilliSatoshi
292292

293-
// ShouldFwdExpEndorsement is a closure that indicates whether the link
294-
// should forward experimental endorsement signals.
295-
ShouldFwdExpEndorsement func() bool
293+
// ShouldFwdExpAccountability is a closure that indicates whether the
294+
// link should forward experimental accountability signals.
295+
ShouldFwdExpAccountability func() bool
296296

297297
// AuxTrafficShaper is an optional auxiliary traffic shaper that can be
298298
// used to manage the bandwidth of the link.
@@ -3163,11 +3163,11 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
31633163
continue
31643164
}
31653165

3166-
endorseValue := l.experimentalEndorsement(
3166+
accountableValue := l.experimentalAccountability(
31673167
record.CustomSet(add.CustomRecords),
31683168
)
3169-
endorseType := uint64(
3170-
lnwire.ExperimentalEndorsementType,
3169+
accountableType := uint64(
3170+
lnwire.ExperimentalAccountableType,
31713171
)
31723172

31733173
switch fwdPkg.State {
@@ -3191,9 +3191,9 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
31913191
BlindingPoint: fwdInfo.NextBlinding,
31923192
}
31933193

3194-
endorseValue.WhenSome(func(e byte) {
3194+
accountableValue.WhenSome(func(e byte) {
31953195
custRecords := map[uint64][]byte{
3196-
endorseType: {e},
3196+
accountableType: {e},
31973197
}
31983198

31993199
outgoingAdd.CustomRecords = custRecords
@@ -3249,9 +3249,9 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
32493249
BlindingPoint: fwdInfo.NextBlinding,
32503250
}
32513251

3252-
endorseValue.WhenSome(func(e byte) {
3252+
accountableValue.WhenSome(func(e byte) {
32533253
addMsg.CustomRecords = map[uint64][]byte{
3254-
endorseType: {e},
3254+
accountableType: {e},
32553255
}
32563256
})
32573257

@@ -3340,44 +3340,42 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
33403340
l.forwardBatch(reforward, switchPackets...)
33413341
}
33423342

3343-
// experimentalEndorsement returns the value to set for our outgoing
3344-
// experimental endorsement field, and a boolean indicating whether it should
3345-
// be populated on the outgoing htlc.
3346-
func (l *channelLink) experimentalEndorsement(
3343+
// experimentalAccountability returns the value to set for our outgoing
3344+
// experimental accountable field. It only considers the accountability bit,
3345+
// other custom records present are not considered for forwarding.
3346+
func (l *channelLink) experimentalAccountability(
33473347
customUpdateAdd record.CustomSet) fn.Option[byte] {
33483348

3349-
// Only relay experimental signal if we are within the experiment
3350-
// period.
3351-
if !l.cfg.ShouldFwdExpEndorsement() {
3349+
if !l.cfg.ShouldFwdExpAccountability() {
33523350
return fn.None[byte]()
33533351
}
33543352

33553353
// If we don't have any custom records or the experimental field is
33563354
// not set, just forward a zero value.
33573355
if len(customUpdateAdd) == 0 {
3358-
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
3356+
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
33593357
}
33603358

3361-
t := uint64(lnwire.ExperimentalEndorsementType)
3359+
t := uint64(lnwire.ExperimentalAccountableType)
33623360
value, set := customUpdateAdd[t]
33633361
if !set {
3364-
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
3362+
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
33653363
}
33663364

33673365
// We expect at least one byte for this field, consider it invalid if
33683366
// it has no data and just forward a zero value.
33693367
if len(value) == 0 {
3370-
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
3368+
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
33713369
}
33723370

3373-
// Only forward endorsed if the incoming link is endorsed.
3374-
if value[0] == lnwire.ExperimentalEndorsed {
3375-
return fn.Some[byte](lnwire.ExperimentalEndorsed)
3371+
// Only forward accountable if the incoming link is accountable.
3372+
if value[0] == lnwire.ExperimentalAccountable {
3373+
return fn.Some[byte](lnwire.ExperimentalAccountable)
33763374
}
33773375

3378-
// Forward as unendorsed otherwise, including cases where we've
3376+
// Forward as unaccountable otherwise, including cases where we've
33793377
// received an invalid value that uses more than 3 bits of information.
3380-
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
3378+
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
33813379
}
33823380

33833381
// processExitHop handles an htlc for which this link is the exit hop. It

htlcswitch/link_test.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,18 +2234,18 @@ func newSingleLinkTestHarness(t *testing.T, chanAmt,
22342234
PendingCommitTicker: ticker.New(time.Minute),
22352235
// Make the BatchSize and Min/MaxUpdateTimeout large enough
22362236
// to not trigger commit updates automatically during tests.
2237-
BatchSize: 10000,
2238-
MinUpdateTimeout: 30 * time.Minute,
2239-
MaxUpdateTimeout: 40 * time.Minute,
2240-
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
2241-
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
2242-
NotifyActiveLink: func(wire.OutPoint) {},
2243-
NotifyActiveChannel: func(wire.OutPoint) {},
2244-
NotifyInactiveChannel: func(wire.OutPoint) {},
2245-
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
2246-
HtlcNotifier: aliceSwitch.cfg.HtlcNotifier,
2247-
GetAliases: getAliases,
2248-
ShouldFwdExpEndorsement: func() bool { return true },
2237+
BatchSize: 10000,
2238+
MinUpdateTimeout: 30 * time.Minute,
2239+
MaxUpdateTimeout: 40 * time.Minute,
2240+
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
2241+
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
2242+
NotifyActiveLink: func(wire.OutPoint) {},
2243+
NotifyActiveChannel: func(wire.OutPoint) {},
2244+
NotifyInactiveChannel: func(wire.OutPoint) {},
2245+
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
2246+
HtlcNotifier: aliceSwitch.cfg.HtlcNotifier,
2247+
GetAliases: getAliases,
2248+
ShouldFwdExpAccountability: func() bool { return true },
22492249
}
22502250

22512251
aliceLink := NewChannelLink(aliceCfg, aliceLc.channel)
@@ -4924,17 +4924,17 @@ func (h *persistentLinkHarness) restartLink(
49244924
MinUpdateTimeout: 30 * time.Minute,
49254925
MaxUpdateTimeout: 40 * time.Minute,
49264926
// Set any hodl flags requested for the new link.
4927-
HodlMask: hodl.MaskFromFlags(hodlFlags...),
4928-
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
4929-
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
4930-
NotifyActiveLink: func(wire.OutPoint) {},
4931-
NotifyActiveChannel: func(wire.OutPoint) {},
4932-
NotifyInactiveChannel: func(wire.OutPoint) {},
4933-
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
4934-
HtlcNotifier: h.hSwitch.cfg.HtlcNotifier,
4935-
SyncStates: syncStates,
4936-
GetAliases: getAliases,
4937-
ShouldFwdExpEndorsement: func() bool { return true },
4927+
HodlMask: hodl.MaskFromFlags(hodlFlags...),
4928+
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
4929+
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
4930+
NotifyActiveLink: func(wire.OutPoint) {},
4931+
NotifyActiveChannel: func(wire.OutPoint) {},
4932+
NotifyInactiveChannel: func(wire.OutPoint) {},
4933+
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
4934+
HtlcNotifier: h.hSwitch.cfg.HtlcNotifier,
4935+
SyncStates: syncStates,
4936+
GetAliases: getAliases,
4937+
ShouldFwdExpAccountability: func() bool { return true },
49384938
}
49394939

49404940
aliceLink := NewChannelLink(aliceCfg, aliceChannel)

htlcswitch/test_utils.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,27 +1157,27 @@ func (h *hopNetwork) createChannelLink(server, peer *mockServer,
11571157
UpdateContractSignals: func(*contractcourt.ContractSignals) error {
11581158
return nil
11591159
},
1160-
NotifyContractUpdate: notifyContractUpdate,
1161-
ChainEvents: &contractcourt.ChainEventSubscription{},
1162-
SyncStates: true,
1163-
BatchSize: 10,
1164-
BatchTicker: ticker.NewForce(testBatchTimeout),
1165-
FwdPkgGCTicker: ticker.NewForce(fwdPkgTimeout),
1166-
PendingCommitTicker: ticker.New(2 * time.Minute),
1167-
MinUpdateTimeout: minFeeUpdateTimeout,
1168-
MaxUpdateTimeout: maxFeeUpdateTimeout,
1169-
OnChannelFailure: func(lnwire.ChannelID, lnwire.ShortChannelID, LinkFailureError) {},
1170-
OutgoingCltvRejectDelta: 3,
1171-
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
1172-
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
1173-
MaxAnchorsCommitFeeRate: chainfee.SatPerKVByte(10 * 1000).FeePerKWeight(),
1174-
NotifyActiveLink: func(wire.OutPoint) {},
1175-
NotifyActiveChannel: func(wire.OutPoint) {},
1176-
NotifyInactiveChannel: func(wire.OutPoint) {},
1177-
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
1178-
HtlcNotifier: server.htlcSwitch.cfg.HtlcNotifier,
1179-
GetAliases: getAliases,
1180-
ShouldFwdExpEndorsement: func() bool { return true },
1160+
NotifyContractUpdate: notifyContractUpdate,
1161+
ChainEvents: &contractcourt.ChainEventSubscription{},
1162+
SyncStates: true,
1163+
BatchSize: 10,
1164+
BatchTicker: ticker.NewForce(testBatchTimeout),
1165+
FwdPkgGCTicker: ticker.NewForce(fwdPkgTimeout),
1166+
PendingCommitTicker: ticker.New(2 * time.Minute),
1167+
MinUpdateTimeout: minFeeUpdateTimeout,
1168+
MaxUpdateTimeout: maxFeeUpdateTimeout,
1169+
OnChannelFailure: func(lnwire.ChannelID, lnwire.ShortChannelID, LinkFailureError) {},
1170+
OutgoingCltvRejectDelta: 3,
1171+
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
1172+
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
1173+
MaxAnchorsCommitFeeRate: chainfee.SatPerKVByte(10 * 1000).FeePerKWeight(),
1174+
NotifyActiveLink: func(wire.OutPoint) {},
1175+
NotifyActiveChannel: func(wire.OutPoint) {},
1176+
NotifyInactiveChannel: func(wire.OutPoint) {},
1177+
NotifyInactiveLinkEvent: func(wire.OutPoint) {},
1178+
HtlcNotifier: server.htlcSwitch.cfg.HtlcNotifier,
1179+
GetAliases: getAliases,
1180+
ShouldFwdExpAccountability: func() bool { return true },
11811181
},
11821182
channel,
11831183
)

itest/list_on_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ var allTestCases = []*lntest.TestCase{
700700
TestFunc: testDebuglevelShow,
701701
},
702702
{
703-
Name: "experimental endorsement",
704-
TestFunc: testExperimentalEndorsement,
703+
Name: "experimental accountability",
704+
TestFunc: testExperimentalAccountability,
705705
},
706706
{
707707
Name: "quiescence",
Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ import (
1515
"github.com/stretchr/testify/require"
1616
)
1717

18-
// testExperimentalEndorsement tests setting of positive and negative
19-
// experimental endorsement signals.
20-
func testExperimentalEndorsement(ht *lntest.HarnessTest) {
21-
testEndorsement(ht, true)
22-
testEndorsement(ht, false)
18+
// testExperimentalAccountability tests setting of positive and negative
19+
// experimental accountable signals.
20+
func testExperimentalAccountability(ht *lntest.HarnessTest) {
21+
testAccountability(ht, true)
22+
testAccountability(ht, false)
2323
}
2424

25-
// testEndorsement sets up a 5 hop network and tests propagation of
26-
// experimental endorsement signals.
27-
func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
25+
// testAccountability sets up a 5 hop network and tests propagation of
26+
// experimental accountable signals.
27+
func testAccountability(ht *lntest.HarnessTest, aliceAccountable bool) {
2828
cfg := node.CfgAnchor
2929
carolCfg := append(
30-
[]string{"--protocol.no-experimental-endorsement"}, cfg...,
30+
[]string{"--protocol.no-experimental-accountability"}, cfg...,
3131
)
3232
cfgs := [][]string{cfg, cfg, carolCfg, cfg, cfg}
3333

@@ -57,48 +57,41 @@ func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
5757
FeeLimitMsat: math.MaxInt64,
5858
}
5959

60-
var expectedValue []byte
61-
hasEndorsement := lntest.ExperimentalEndorsementActive()
62-
63-
if hasEndorsement {
64-
if aliceEndorse {
65-
expectedValue = []byte{lnwire.ExperimentalEndorsed}
66-
t := uint64(lnwire.ExperimentalEndorsementType)
67-
sendReq.FirstHopCustomRecords = map[uint64][]byte{
68-
t: expectedValue,
69-
}
70-
} else {
71-
expectedValue = []byte{lnwire.ExperimentalUnendorsed}
60+
expectedValue := []byte{lnwire.ExperimentalUnaccountable}
61+
if aliceAccountable {
62+
expectedValue = []byte{lnwire.ExperimentalAccountable}
63+
t := uint64(lnwire.ExperimentalAccountableType)
64+
sendReq.FirstHopCustomRecords = map[uint64][]byte{
65+
t: expectedValue,
7266
}
7367
}
7468

7569
_ = alice.RPC.SendPayment(sendReq)
7670

7771
// Validate that our signal (positive or zero) propagates until carol
7872
// and then is dropped because she has disabled the feature.
79-
// When the endorsement experiment is not active, no signal is sent.
80-
validateEndorsedAndResume(
81-
ht, bobIntercept, hasEndorsement, expectedValue,
73+
validateAccountableAndResume(
74+
ht, bobIntercept, true, expectedValue,
8275
)
83-
validateEndorsedAndResume(
84-
ht, carolIntercept, hasEndorsement, expectedValue,
76+
validateAccountableAndResume(
77+
ht, carolIntercept, true, expectedValue,
8578
)
86-
validateEndorsedAndResume(ht, daveIntercept, false, nil)
79+
validateAccountableAndResume(ht, daveIntercept, false, nil)
8780

8881
var preimage lntypes.Preimage
8982
copy(preimage[:], invoice.RPreimage)
9083
ht.AssertPaymentStatus(alice, preimage.Hash(), lnrpc.Payment_SUCCEEDED)
9184
}
9285

93-
func validateEndorsedAndResume(ht *lntest.HarnessTest,
94-
interceptor rpc.InterceptorClient, hasEndorsement bool,
86+
func validateAccountableAndResume(ht *lntest.HarnessTest,
87+
interceptor rpc.InterceptorClient, hasAccountable bool,
9588
expectedValue []byte) {
9689

9790
packet := ht.ReceiveHtlcInterceptor(interceptor)
9891

9992
var expectedRecords map[uint64][]byte
100-
if hasEndorsement {
101-
u64Type := uint64(lnwire.ExperimentalEndorsementType)
93+
if hasAccountable {
94+
u64Type := uint64(lnwire.ExperimentalAccountableType)
10295
expectedRecords = map[uint64][]byte{
10396
u64Type: expectedValue,
10497
}

0 commit comments

Comments
 (0)