Skip to content

Commit 49876c1

Browse files
committed
multi: rename experimental endorsement signal to accountable
Renames the endorsement signal to accountable to match the latest proposal lightning/blips#67
1 parent 31452a6 commit 49876c1

20 files changed

+217
-213
lines changed

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: 23 additions & 23 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,44 @@ 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
3343+
// experimentalAccountability returns the value to set for our outgoing
3344+
// experimental accountable field, and a boolean indicating whether it should
33453345
// be populated on the outgoing htlc.
3346-
func (l *channelLink) experimentalEndorsement(
3346+
func (l *channelLink) experimentalAccountability(
33473347
customUpdateAdd record.CustomSet) fn.Option[byte] {
33483348

33493349
// Only relay experimental signal if we are within the experiment
33503350
// period.
3351-
if !l.cfg.ShouldFwdExpEndorsement() {
3351+
if !l.cfg.ShouldFwdExpAccountability() {
33523352
return fn.None[byte]()
33533353
}
33543354

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

3361-
t := uint64(lnwire.ExperimentalEndorsementType)
3361+
t := uint64(lnwire.ExperimentalAccountableType)
33623362
value, set := customUpdateAdd[t]
33633363
if !set {
3364-
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
3364+
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
33653365
}
33663366

33673367
// We expect at least one byte for this field, consider it invalid if
33683368
// it has no data and just forward a zero value.
33693369
if len(value) == 0 {
3370-
return fn.Some[byte](lnwire.ExperimentalUnendorsed)
3370+
return fn.Some[byte](lnwire.ExperimentalUnaccountable)
33713371
}
33723372

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

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

33833383
// 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",

itest/lnd_experimental_endorsement.go renamed to itest/lnd_experimental_accountability.go

Lines changed: 20 additions & 20 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,10 +57,10 @@ func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
5757
FeeLimitMsat: math.MaxInt64,
5858
}
5959

60-
expectedValue := []byte{lnwire.ExperimentalUnendorsed}
61-
if aliceEndorse {
62-
expectedValue = []byte{lnwire.ExperimentalEndorsed}
63-
t := uint64(lnwire.ExperimentalEndorsementType)
60+
expectedValue := []byte{lnwire.ExperimentalUnaccountable}
61+
if aliceAccountable {
62+
expectedValue = []byte{lnwire.ExperimentalAccountable}
63+
t := uint64(lnwire.ExperimentalAccountableType)
6464
sendReq.FirstHopCustomRecords = map[uint64][]byte{
6565
t: expectedValue,
6666
}
@@ -70,24 +70,24 @@ func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
7070

7171
// Validate that our signal (positive or zero) propagates until carol
7272
// and then is dropped because she has disabled the feature.
73-
validateEndorsedAndResume(ht, bobIntercept, true, expectedValue)
74-
validateEndorsedAndResume(ht, carolIntercept, true, expectedValue)
75-
validateEndorsedAndResume(ht, daveIntercept, false, nil)
73+
validateAccountableAndResume(ht, bobIntercept, true, expectedValue)
74+
validateAccountableAndResume(ht, carolIntercept, true, expectedValue)
75+
validateAccountableAndResume(ht, daveIntercept, false, nil)
7676

7777
var preimage lntypes.Preimage
7878
copy(preimage[:], invoice.RPreimage)
7979
ht.AssertPaymentStatus(alice, preimage.Hash(), lnrpc.Payment_SUCCEEDED)
8080
}
8181

82-
func validateEndorsedAndResume(ht *lntest.HarnessTest,
83-
interceptor rpc.InterceptorClient, hasEndorsement bool,
82+
func validateAccountableAndResume(ht *lntest.HarnessTest,
83+
interceptor rpc.InterceptorClient, hasAccountable bool,
8484
expectedValue []byte) {
8585

8686
packet := ht.ReceiveHtlcInterceptor(interceptor)
8787

8888
var expectedRecords map[uint64][]byte
89-
if hasEndorsement {
90-
u64Type := uint64(lnwire.ExperimentalEndorsementType)
89+
if hasAccountable {
90+
u64Type := uint64(lnwire.ExperimentalAccountableType)
9191
expectedRecords = map[uint64][]byte{
9292
u64Type: expectedValue,
9393
}

itest/lnd_forward_interceptor_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
387387
// all intercepted packets. These packets are held to simulate a
388388
// pending payment.
389389
packet := ht.ReceiveHtlcInterceptor(bobInterceptor)
390-
require.Equal(ht, lntest.CustomRecordsWithUnendorsed(
390+
require.Equal(ht, lntest.CustomRecordsWithUnaccountable(
391391
customRecords,
392392
), packet.InWireCustomRecords)
393393

@@ -433,11 +433,11 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
433433
packet = ht.ReceiveHtlcInterceptor(bobInterceptor)
434434

435435
require.Len(ht, packet.InWireCustomRecords, 2)
436-
require.Equal(ht, lntest.CustomRecordsWithUnendorsed(customRecords),
436+
require.Equal(ht, lntest.CustomRecordsWithUnaccountable(customRecords),
437437
packet.InWireCustomRecords)
438438

439439
// And now we forward the payment at Carol, expecting only an
440-
// endorsement signal in our incoming custom records.
440+
// accountable signal in our incoming custom records.
441441
packet = ht.ReceiveHtlcInterceptor(carolInterceptor)
442442
require.Len(ht, packet.InWireCustomRecords, 1)
443443
err = carolInterceptor.Send(&routerrpc.ForwardHtlcInterceptResponse{
@@ -451,7 +451,7 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
451451
alice, preimage.Hash(), lnrpc.Payment_SUCCEEDED,
452452
func(p *lnrpc.Payment) error {
453453
recordsEqual := reflect.DeepEqual(
454-
lntest.CustomRecordsWithUnendorsed(
454+
lntest.CustomRecordsWithUnaccountable(
455455
sendReq.FirstHopCustomRecords,
456456
), p.FirstHopCustomRecords,
457457
)

itest/lnd_invoice_acceptor_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ func testInvoiceHtlcModifierBasic(ht *lntest.HarnessTest) {
102102
ht, tc.sendAmountMsat, modifierRequest.ExitHtlcAmt,
103103
)
104104

105-
// Expect custom records plus endorsement signal.
105+
// Expect custom records plus accountable signal.
106106
require.Equal(
107-
ht, lntest.CustomRecordsWithUnendorsed(
107+
ht, lntest.CustomRecordsWithUnaccountable(
108108
tc.lastHopCustomRecords,
109109
), modifierRequest.ExitHtlcWireCustomRecords,
110110
)
@@ -152,7 +152,7 @@ func testInvoiceHtlcModifierBasic(ht *lntest.HarnessTest) {
152152

153153
require.Len(ht, updatedInvoice.Htlcs, 1)
154154
require.Equal(
155-
ht, lntest.CustomRecordsWithUnendorsed(
155+
ht, lntest.CustomRecordsWithUnaccountable(
156156
tc.lastHopCustomRecords,
157157
), updatedInvoice.Htlcs[0].CustomRecords,
158158
)

0 commit comments

Comments
 (0)