lnrpc: set a zero value endorsement signal on sender outgoing htlc

Before we have sufficient signaling in the network to relay this
signal, set a zero value experimental endorsement value on the sender's
outgoing htlc. Once the network is relaying this signal and a flag day
has been set, we'll be able to set a non-zero value here.
This commit is contained in:
Carla Kirk-Cohen committed 2024-11-22 09:16:57 -05:00
1 parent 774bfa740a
commit 4bb5b0c27c
3 files changed
+45 -16

No files matched your search

+18 -16
View File
@@ -515,12 +515,9 @@ func testForwardInterceptorWireRecords(ht *lntest.HarnessTest) {
// all intercepted packets. These packets are held to simulate a
// pending payment.
packet := ht.ReceiveHtlcInterceptor(bobInterceptor)
require.Len(ht, packet.InWireCustomRecords, 1)
val, ok := packet.InWireCustomRecords[65537]
require.True(ht, ok, "expected custom record")
require.Equal(ht, []byte("test"), val)
require.Equal(ht, lntest.CustomRecordsWithUnendorsed(
customRecords,
), packet.InWireCustomRecords)
// Just resume the payment on Bob.
err := bobInterceptor.Send(&routerrpc.ForwardHtlcInterceptResponse{
@@ -569,7 +566,9 @@ func testForwardInterceptorWireRecords(ht *lntest.HarnessTest) {
func(p *lnrpc.Payment) error {
recordsEqual := reflect.DeepEqual(
p.FirstHopCustomRecords,
sendReq.FirstHopCustomRecords,
lntest.CustomRecordsWithUnendorsed(
customRecords,
),
)
if !recordsEqual {
return fmt.Errorf("expected custom records to "+
@@ -643,9 +642,9 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
// all intercepted packets. These packets are held to simulate a
// pending payment.
packet := ht.ReceiveHtlcInterceptor(bobInterceptor)
require.Len(ht, packet.InWireCustomRecords, 1)
require.Equal(ht, customRecords, packet.InWireCustomRecords)
require.Equal(ht, lntest.CustomRecordsWithUnendorsed(
customRecords,
), packet.InWireCustomRecords)
// We accept the payment at Bob and resume it, so it gets to Carol.
// This means the HTLC should now be fully locked in on Alice's side and
@@ -681,8 +680,9 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
// We should get another notification about the held HTLC.
packet = ht.ReceiveHtlcInterceptor(bobInterceptor)
require.Len(ht, packet.InWireCustomRecords, 1)
require.Equal(ht, customRecords, packet.InWireCustomRecords)
require.Len(ht, packet.InWireCustomRecords, 2)
require.Equal(ht, lntest.CustomRecordsWithUnendorsed(customRecords),
packet.InWireCustomRecords)
err = carolInterceptor.Send(&routerrpc.ForwardHtlcInterceptResponse{
IncomingCircuitKey: packet.IncomingCircuitKey,
@@ -690,9 +690,10 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
})
require.NoError(ht, err, "failed to send request")
// And now we forward the payment at Carol.
// And now we forward the payment at Carol, expecting only an
// endorsement signal in our incoming custom records.
packet = ht.ReceiveHtlcInterceptor(carolInterceptor)
require.Len(ht, packet.InWireCustomRecords, 0)
require.Len(ht, packet.InWireCustomRecords, 1)
err = carolInterceptor.Send(&routerrpc.ForwardHtlcInterceptResponse{
IncomingCircuitKey: packet.IncomingCircuitKey,
Action: actionResume,
@@ -704,8 +705,9 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
alice, preimage, lnrpc.Payment_SUCCEEDED,
func(p *lnrpc.Payment) error {
recordsEqual := reflect.DeepEqual(
p.FirstHopCustomRecords,
sendReq.FirstHopCustomRecords,
lntest.CustomRecordsWithUnendorsed(
sendReq.FirstHopCustomRecords,
), p.FirstHopCustomRecords,
)
if !recordsEqual {
return fmt.Errorf("expected custom records to "+