Skip to content

Commit a0634e4

Browse files
committed
lnd+lnrpc: update fwdinghistory message
In this commit we update the returned message for fwdinghistory to include the htlcindex for all forwarded htlcs.
1 parent f79e613 commit a0634e4

File tree

5 files changed

+853
-771
lines changed

5 files changed

+853
-771
lines changed

itest/lnd_multi-hop-payments_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,31 @@ func testMultiHopPayments(ht *lntest.HarnessTest) {
213213
require.Equal(ht, aliceAlias, event.PeerAliasOut)
214214
}
215215

216+
// Verify HTLC IDs are not nil and unique across all forwarding events.
217+
seenIDs := make(map[uint64]bool)
218+
for _, event := range fwdingHistory.ForwardingEvents {
219+
// We check that the incoming and outgoing htlc indices are not
220+
// set to nil. The indices are required for any forwarding event
221+
// recorded after v0.20.
222+
require.NotNil(ht, event.IncomingHtlcId)
223+
require.NotNil(ht, event.OutgoingHtlcId)
224+
225+
require.False(ht, seenIDs[*event.IncomingHtlcId])
226+
require.False(ht, seenIDs[*event.OutgoingHtlcId])
227+
seenIDs[*event.IncomingHtlcId] = true
228+
seenIDs[*event.OutgoingHtlcId] = true
229+
}
230+
231+
// The HTLC IDs should be exactly 0, 1, 2, 3, 4.
232+
expectedIDs := map[uint64]bool{
233+
0: true,
234+
1: true,
235+
2: true,
236+
3: true,
237+
4: true,
238+
}
239+
require.Equal(ht, expectedIDs, seenIDs)
240+
216241
// We expect Carol to have successful forwards and settles for
217242
// her sends.
218243
ht.AssertHtlcEvents(

0 commit comments

Comments
 (0)