discovery: push max htlc migration further up the call tree
As a preparation for making the gossiper less responsible for validating and supplementing local channel policy updates, this commits moves the on-the-fly max htlc migration up the call tree. The plan for a follow up commit is to move it out of the gossiper completely for local channel updates, so that we don't need to return a list of final applied policies anymore.
This commit is contained in:
parent
339ff357d1
commit
4b2eb9cb81
@ -1211,6 +1211,11 @@ func (d *AuthenticatedGossiper) retransmitStaleAnns(now time.Time) error {
|
||||
// introduction of the MaxHTLC field, then we'll update this
|
||||
// edge to propagate this information in the network.
|
||||
if !edge.MessageFlags.HasMaxHtlc() {
|
||||
// We'll make sure we support the new max_htlc field if
|
||||
// not already present.
|
||||
edge.MessageFlags |= lnwire.ChanUpdateOptionMaxHtlc
|
||||
edge.MaxHTLC = lnwire.NewMSatFromSatoshis(info.Capacity)
|
||||
|
||||
edgesToUpdate = append(edgesToUpdate, updateTuple{
|
||||
info: info,
|
||||
edge: edge,
|
||||
@ -1369,6 +1374,10 @@ func (d *AuthenticatedGossiper) processChanPolicyUpdate(
|
||||
)
|
||||
edge.TimeLockDelta = uint16(policyUpdate.newSchema.TimeLockDelta)
|
||||
|
||||
// Max htlc is currently always set to the channel capacity.
|
||||
edge.MessageFlags |= lnwire.ChanUpdateOptionMaxHtlc
|
||||
edge.MaxHTLC = lnwire.NewMSatFromSatoshis(info.Capacity)
|
||||
|
||||
edgesToUpdate = append(edgesToUpdate, edgeWithInfo{
|
||||
info: info,
|
||||
edge: edge,
|
||||
@ -2514,13 +2523,6 @@ func (d *AuthenticatedGossiper) updateChannel(info *channeldb.ChannelEdgeInfo,
|
||||
edge *channeldb.ChannelEdgePolicy) (*lnwire.ChannelAnnouncement,
|
||||
*lnwire.ChannelUpdate, error) {
|
||||
|
||||
// We'll make sure we support the new max_htlc field if not already
|
||||
// present.
|
||||
if !edge.MessageFlags.HasMaxHtlc() {
|
||||
edge.MessageFlags |= lnwire.ChanUpdateOptionMaxHtlc
|
||||
edge.MaxHTLC = lnwire.NewMSatFromSatoshis(info.Capacity)
|
||||
}
|
||||
|
||||
// Make sure timestamp is always increased, such that our update gets
|
||||
// propagated.
|
||||
timestamp := time.Now().Unix()
|
||||
|
Loading…
Reference in New Issue
Block a user