htlcswitch: fix returned failure for insufficient balance
In the scenario where the requested channel does not have enough balance and another channel towards the same node generates a different failure, we erroneously returned UnknownNextPeer instead of the expected TemporaryChannelFailure. This commit rewrites the non-strict forwarding logic in the switch to return the proper failure message. Part of this is moving the link balance check inside the link.
This commit is contained in:
4 files changed
+48
-71
No files matched your search
+12
-1
@@ -5406,6 +5406,15 @@ func TestCheckHtlcForward(t *testing.T) {
|
||||
return &lnwire.ChannelUpdate{}, nil
|
||||
}
|
||||
|
||||
testChannel, _, fCleanUp, err := createTestChannel(
|
||||
alicePrivKey, bobPrivKey, 100000, 100000,
|
||||
1000, 1000, lnwire.ShortChannelID{},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer fCleanUp()
|
||||
|
||||
link := channelLink{
|
||||
cfg: ChannelLinkConfig{
|
||||
FwrdingPolicy: ForwardingPolicy{
|
||||
@@ -5417,7 +5426,9 @@ func TestCheckHtlcForward(t *testing.T) {
|
||||
FetchLastChannelUpdate: fetchLastChannelUpdate,
|
||||
MaxOutgoingCltvExpiry: DefaultMaxOutgoingCltvExpiry,
|
||||
},
|
||||
log: log,
|
||||
log: log,
|
||||
channel: testChannel.channel,
|
||||
overflowQueue: newPacketQueue(input.MaxHTLCNumber / 2),
|
||||
}
|
||||
|
||||
var hash [32]byte
|
||||
|
||||
Reference in new issue
Block a user