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:
elnosh committed 2026-01-06 09:12:31 -05:00
1 parent 801de79cf1
commit 34329c684e
21 files changed
+229 -227

No files matched your search

+2 -2
View File
@@ -700,8 +700,8 @@ var allTestCases = []*lntest.TestCase{
TestFunc: testDebuglevelShow,
},
{
Name: "experimental endorsement",
TestFunc: testExperimentalEndorsement,
Name: "experimental accountability",
TestFunc: testExperimentalAccountability,
},
{
Name: "quiescence",
@@ -15,19 +15,19 @@ import (
"github.com/stretchr/testify/require"
)
// testExperimentalEndorsement tests setting of positive and negative
// experimental endorsement signals.
func testExperimentalEndorsement(ht *lntest.HarnessTest) {
testEndorsement(ht, true)
testEndorsement(ht, false)
// testExperimentalAccountability tests setting of positive and negative
// experimental accountable signals.
func testExperimentalAccountability(ht *lntest.HarnessTest) {
testAccountability(ht, true)
testAccountability(ht, false)
}
// testEndorsement sets up a 5 hop network and tests propagation of
// experimental endorsement signals.
func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
// testAccountability sets up a 5 hop network and tests propagation of
// experimental accountable signals.
func testAccountability(ht *lntest.HarnessTest, aliceAccountable bool) {
cfg := node.CfgAnchor
carolCfg := append(
[]string{"--protocol.no-experimental-endorsement"}, cfg...,
[]string{"--protocol.no-experimental-accountability"}, cfg...,
)
cfgs := [][]string{cfg, cfg, carolCfg, cfg, cfg}
@@ -58,17 +58,17 @@ func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
}
var expectedValue []byte
hasEndorsement := lntest.ExperimentalEndorsementActive()
hasAccountability := lntest.ExperimentalAccountabilityActive()
if hasEndorsement {
if aliceEndorse {
expectedValue = []byte{lnwire.ExperimentalEndorsed}
t := uint64(lnwire.ExperimentalEndorsementType)
if hasAccountability {
if aliceAccountable {
expectedValue = []byte{lnwire.ExperimentalAccountable}
t := uint64(lnwire.ExperimentalAccountableType)
sendReq.FirstHopCustomRecords = map[uint64][]byte{
t: expectedValue,
}
} else {
expectedValue = []byte{lnwire.ExperimentalUnendorsed}
expectedValue = []byte{lnwire.ExperimentalUnaccountable}
}
}
@@ -76,29 +76,29 @@ func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
// Validate that our signal (positive or zero) propagates until carol
// and then is dropped because she has disabled the feature.
// When the endorsement experiment is not active, no signal is sent.
validateEndorsedAndResume(
ht, bobIntercept, hasEndorsement, expectedValue,
// When the accountability experiment is not active, no signal is sent.
validateAccountableAndResume(
ht, bobIntercept, hasAccountability, expectedValue,
)
validateEndorsedAndResume(
ht, carolIntercept, hasEndorsement, expectedValue,
validateAccountableAndResume(
ht, carolIntercept, hasAccountability, expectedValue,
)
validateEndorsedAndResume(ht, daveIntercept, false, nil)
validateAccountableAndResume(ht, daveIntercept, false, nil)
var preimage lntypes.Preimage
copy(preimage[:], invoice.RPreimage)
ht.AssertPaymentStatus(alice, preimage.Hash(), lnrpc.Payment_SUCCEEDED)
}
func validateEndorsedAndResume(ht *lntest.HarnessTest,
interceptor rpc.InterceptorClient, hasEndorsement bool,
func validateAccountableAndResume(ht *lntest.HarnessTest,
interceptor rpc.InterceptorClient, hasAccountable bool,
expectedValue []byte) {
packet := ht.ReceiveHtlcInterceptor(interceptor)
var expectedRecords map[uint64][]byte
if hasEndorsement {
u64Type := uint64(lnwire.ExperimentalEndorsementType)
if hasAccountable {
u64Type := uint64(lnwire.ExperimentalAccountableType)
expectedRecords = map[uint64][]byte{
u64Type: expectedValue,
}
+7 -7
View File
@@ -387,7 +387,7 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
// all intercepted packets. These packets are held to simulate a
// pending payment.
packet := ht.ReceiveHtlcInterceptor(bobInterceptor)
require.Equal(ht, lntest.CustomRecordsWithUnendorsed(
require.Equal(ht, lntest.CustomRecordsWithUnaccountable(
customRecords,
), packet.InWireCustomRecords)
@@ -433,21 +433,21 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
packet = ht.ReceiveHtlcInterceptor(bobInterceptor)
// Check the expected number of custom records based on whether the
// endorsement experiment is still active.
// accountability experiment is still active.
expectedLen := 1
if lntest.ExperimentalEndorsementActive() {
if lntest.ExperimentalAccountabilityActive() {
expectedLen = 2
}
require.Len(ht, packet.InWireCustomRecords, expectedLen)
require.Equal(ht, lntest.CustomRecordsWithUnendorsed(customRecords),
require.Equal(ht, lntest.CustomRecordsWithUnaccountable(customRecords),
packet.InWireCustomRecords)
// And now we forward the payment at Carol, expecting only an
// endorsement signal in our incoming custom records (if the experiment
// accountability signal in our incoming custom records (if the experiment
// is still active).
packet = ht.ReceiveHtlcInterceptor(carolInterceptor)
expectedCarolLen := 0
if lntest.ExperimentalEndorsementActive() {
if lntest.ExperimentalAccountabilityActive() {
expectedCarolLen = 1
}
require.Len(ht, packet.InWireCustomRecords, expectedCarolLen)
@@ -462,7 +462,7 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
alice, preimage.Hash(), lnrpc.Payment_SUCCEEDED,
func(p *lnrpc.Payment) error {
recordsEqual := reflect.DeepEqual(
lntest.CustomRecordsWithUnendorsed(
lntest.CustomRecordsWithUnaccountable(
sendReq.FirstHopCustomRecords,
), p.FirstHopCustomRecords,
)
+3 -3
View File
@@ -102,9 +102,9 @@ func testInvoiceHtlcModifierBasic(ht *lntest.HarnessTest) {
ht, tc.sendAmountMsat, modifierRequest.ExitHtlcAmt,
)
// Expect custom records plus endorsement signal.
// Expect custom records plus accountable signal.
require.Equal(
ht, lntest.CustomRecordsWithUnendorsed(
ht, lntest.CustomRecordsWithUnaccountable(
tc.lastHopCustomRecords,
), modifierRequest.ExitHtlcWireCustomRecords,
)
@@ -152,7 +152,7 @@ func testInvoiceHtlcModifierBasic(ht *lntest.HarnessTest) {
require.Len(ht, updatedInvoice.Htlcs, 1)
require.Equal(
ht, lntest.CustomRecordsWithUnendorsed(
ht, lntest.CustomRecordsWithUnaccountable(
tc.lastHopCustomRecords,
), updatedInvoice.Htlcs[0].CustomRecords,
)