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:
Olaoluwa Osuntokun 2017-08-21 23:57:52 -07:00
parent 3086a9d06a
commit b069406d1e
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
1 changed files with 10 additions and 4 deletions

14
peer.go
View File

@ -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
}
}