mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-19 20:25:51 +01:00
htlcswitch+router+server: handle payment error topology updates
In previous commits we have intoduced the onion errors. Some of this errors include lnwire.ChannelUpdate message. In order to change topology accordingly to the received error, from nodes where failure have occured, we have to propogate the update to the router subsystem.
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
6bbb7cbfc3
commit
79b8d26b1a
@@ -40,7 +40,11 @@ func TestSwitchForward(t *testing.T) {
|
||||
aliceChannelLink := newMockChannelLink(chanID1, aliceChanID, alicePeer)
|
||||
bobChannelLink := newMockChannelLink(chanID2, bobChanID, bobPeer)
|
||||
|
||||
s := New(Config{})
|
||||
s := New(Config{
|
||||
UpdateTopology: func(msg *lnwire.ChannelUpdate) error {
|
||||
return nil
|
||||
},
|
||||
})
|
||||
s.Start()
|
||||
if err := s.AddLink(aliceChannelLink); err != nil {
|
||||
t.Fatalf("unable to add alice link: %v", err)
|
||||
@@ -118,7 +122,11 @@ func TestSwitchCancel(t *testing.T) {
|
||||
aliceChannelLink := newMockChannelLink(chanID1, aliceChanID, alicePeer)
|
||||
bobChannelLink := newMockChannelLink(chanID2, bobChanID, bobPeer)
|
||||
|
||||
s := New(Config{})
|
||||
s := New(Config{
|
||||
UpdateTopology: func(msg *lnwire.ChannelUpdate) error {
|
||||
return nil
|
||||
},
|
||||
})
|
||||
s.Start()
|
||||
if err := s.AddLink(aliceChannelLink); err != nil {
|
||||
t.Fatalf("unable to add alice link: %v", err)
|
||||
@@ -194,7 +202,11 @@ func TestSwitchAddSamePayment(t *testing.T) {
|
||||
aliceChannelLink := newMockChannelLink(chanID1, aliceChanID, alicePeer)
|
||||
bobChannelLink := newMockChannelLink(chanID2, bobChanID, bobPeer)
|
||||
|
||||
s := New(Config{})
|
||||
s := New(Config{
|
||||
UpdateTopology: func(msg *lnwire.ChannelUpdate) error {
|
||||
return nil
|
||||
},
|
||||
})
|
||||
s.Start()
|
||||
if err := s.AddLink(aliceChannelLink); err != nil {
|
||||
t.Fatalf("unable to add alice link: %v", err)
|
||||
@@ -290,7 +302,11 @@ func TestSwitchSendPayment(t *testing.T) {
|
||||
alicePeer := newMockServer(t, "alice")
|
||||
aliceChannelLink := newMockChannelLink(chanID1, aliceChanID, alicePeer)
|
||||
|
||||
s := New(Config{})
|
||||
s := New(Config{
|
||||
UpdateTopology: func(msg *lnwire.ChannelUpdate) error {
|
||||
return nil
|
||||
},
|
||||
})
|
||||
s.Start()
|
||||
if err := s.AddLink(aliceChannelLink); err != nil {
|
||||
t.Fatalf("unable to add link: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user