lnrpc: add unit test covering too many hop hints

This commit is contained in:
carla 2022-02-07 09:03:10 +02:00
parent 4ac6f82b5e
commit 5836d58a99
No known key found for this signature in database
GPG key ID: 4CA7FE54A6213C91

View file

@ -307,6 +307,36 @@ func TestSelectHopHints(t *testing.T) {
numHints: 1, numHints: 1,
expectedHints: nil, expectedHints: nil,
}, },
{
// This test case reproduces a bug where we have too
// many hop hints for our maximum hint number.
name: "too many hints",
setupMock: func(h *hopHintsConfigMock) {
setMockChannelUsed(
h, private1ShortID, privateChan1Policy,
)
setMockChannelUsed(
h, private2ShortID, privateChan2Policy,
)
},
// Set our amount to less than our channel balance of
// 100.
amount: 30,
channels: []*HopHintInfo{
privateChannel1, privateChannel2,
},
numHints: 1,
expectedHints: [][]zpay32.HopHint{
{
privateChannel1Hint,
},
{
privateChannel2Hint,
},
},
},
{ {
// If a channel has more balance than the amount we're // If a channel has more balance than the amount we're
// looking for, it'll be added in our first pass. We // looking for, it'll be added in our first pass. We