peer: fix bug, use the existing timestamp for the ChannelUpdate msg
This commit fixes a lingering bug within the logic for the peer/htlcswitch/channellink. When the link needs to fetch the latest update to send to a sending party due to a violation of the set routing policy, previously it would modify the timestamp on the message read from disk. This was incorrect as it would invalidate the signature within the message itself. We fix this by instead
This commit is contained in:
parent
3086a9d06a
commit
b069406d1e
14
peer.go
14
peer.go
@ -1784,7 +1784,7 @@ func createGetLastUpdate(router *routing.ChannelRouter,
|
||||
error) {
|
||||
|
||||
return func() (*lnwire.ChannelUpdate, error) {
|
||||
_, edge1, edge2, err := router.GetChannelByID(chanID)
|
||||
info, edge1, edge2, err := router.GetChannelByID(chanID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -1802,15 +1802,21 @@ func createGetLastUpdate(router *routing.ChannelRouter,
|
||||
local = edge1
|
||||
}
|
||||
|
||||
return &lnwire.ChannelUpdate{
|
||||
update := &lnwire.ChannelUpdate{
|
||||
Signature: local.Signature,
|
||||
ChainHash: info.ChainHash,
|
||||
ShortChannelID: lnwire.NewShortChanIDFromInt(local.ChannelID),
|
||||
Timestamp: uint32(time.Now().Unix()),
|
||||
Timestamp: uint32(local.LastUpdate.Unix()),
|
||||
Flags: local.Flags,
|
||||
TimeLockDelta: local.TimeLockDelta,
|
||||
HtlcMinimumMsat: local.MinHTLC,
|
||||
BaseFee: uint32(local.FeeBaseMSat),
|
||||
FeeRate: uint32(local.FeeProportionalMillionths),
|
||||
}, nil
|
||||
}
|
||||
|
||||
hswcLog.Debugf("Sending latest channel_update: %v",
|
||||
spew.Sdump(update))
|
||||
|
||||
return update, nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user