lnd+lnrpc: update fwdinghistory message

In this commit we update the returned message for fwdinghistory
to include the htlcindex for all forwarded htlcs.
This commit is contained in:
Abdullahi Yunus
2025-05-15 12:24:42 +01:00
parent f79e6137c1
commit a0634e4ade
5 changed files with 860 additions and 778 deletions

View File

@@ -213,6 +213,31 @@ func testMultiHopPayments(ht *lntest.HarnessTest) {
require.Equal(ht, aliceAlias, event.PeerAliasOut)
}
// Verify HTLC IDs are not nil and unique across all forwarding events.
seenIDs := make(map[uint64]bool)
for _, event := range fwdingHistory.ForwardingEvents {
// We check that the incoming and outgoing htlc indices are not
// set to nil. The indices are required for any forwarding event
// recorded after v0.20.
require.NotNil(ht, event.IncomingHtlcId)
require.NotNil(ht, event.OutgoingHtlcId)
require.False(ht, seenIDs[*event.IncomingHtlcId])
require.False(ht, seenIDs[*event.OutgoingHtlcId])
seenIDs[*event.IncomingHtlcId] = true
seenIDs[*event.OutgoingHtlcId] = true
}
// The HTLC IDs should be exactly 0, 1, 2, 3, 4.
expectedIDs := map[uint64]bool{
0: true,
1: true,
2: true,
3: true,
4: true,
}
require.Equal(ht, expectedIDs, seenIDs)
// We expect Carol to have successful forwards and settles for
// her sends.
ht.AssertHtlcEvents(