mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 07:33:01 +02:00
htlcswitch.test: add message interceptor handler
Add message interceptor which checks the order and may skip the messages which were denoted to be skipeed.
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
f29b4f60e4
commit
1eb906bcfb
@@ -253,22 +253,26 @@ func createTestChannel(alicePrivKey, bobPrivKey []byte,
|
||||
}
|
||||
|
||||
// getChanID retrieves the channel point from nwire message.
|
||||
func getChanID(msg lnwire.Message) lnwire.ChannelID {
|
||||
var point lnwire.ChannelID
|
||||
func getChanID(msg lnwire.Message) (lnwire.ChannelID, error) {
|
||||
var chanID lnwire.ChannelID
|
||||
switch msg := msg.(type) {
|
||||
case *lnwire.UpdateAddHTLC:
|
||||
point = msg.ChanID
|
||||
chanID = msg.ChanID
|
||||
case *lnwire.UpdateFufillHTLC:
|
||||
point = msg.ChanID
|
||||
chanID = msg.ChanID
|
||||
case *lnwire.UpdateFailHTLC:
|
||||
point = msg.ChanID
|
||||
chanID = msg.ChanID
|
||||
case *lnwire.RevokeAndAck:
|
||||
point = msg.ChanID
|
||||
chanID = msg.ChanID
|
||||
case *lnwire.CommitSig:
|
||||
point = msg.ChanID
|
||||
chanID = msg.ChanID
|
||||
case *lnwire.ChannelReestablish:
|
||||
chanID = msg.ChanID
|
||||
default:
|
||||
return chanID, errors.New("unknown type")
|
||||
}
|
||||
|
||||
return point
|
||||
return chanID, nil
|
||||
}
|
||||
|
||||
// generatePayment generates the htlc add request by given path blob and
|
||||
|
Reference in New Issue
Block a user