Merge pull request #3790 from Roasbeef/pay-size-consistency
multi: make SendToRoute consistent with other payment RPC
This commit is contained in:
commit
773aa390b2
@ -2359,6 +2359,9 @@ func (f *fundingManager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
|
|||||||
if fwdMaxHTLC > capacityMSat {
|
if fwdMaxHTLC > capacityMSat {
|
||||||
fwdMaxHTLC = capacityMSat
|
fwdMaxHTLC = capacityMSat
|
||||||
}
|
}
|
||||||
|
if fwdMaxHTLC > MaxPaymentMSat {
|
||||||
|
fwdMaxHTLC = MaxPaymentMSat
|
||||||
|
}
|
||||||
|
|
||||||
// Create and broadcast the proofs required to make this channel
|
// Create and broadcast the proofs required to make this channel
|
||||||
// public and usable for other nodes for routing.
|
// public and usable for other nodes for routing.
|
||||||
|
@ -257,9 +257,9 @@ type ChannelLinkConfig struct {
|
|||||||
// configured set of watchtowers.
|
// configured set of watchtowers.
|
||||||
TowerClient TowerClient
|
TowerClient TowerClient
|
||||||
|
|
||||||
// MaxCltvExpiry is the maximum outgoing timelock that the link should
|
// MaxOutgoingCltvExpiry is the maximum outgoing timelock that the link
|
||||||
// accept for a forwarded HTLC. The value is relative to the current
|
// should accept for a forwarded HTLC. The value is relative to the
|
||||||
// block height.
|
// current block height.
|
||||||
MaxOutgoingCltvExpiry uint32
|
MaxOutgoingCltvExpiry uint32
|
||||||
|
|
||||||
// MaxFeeAllocation is the highest allocation we'll allow a channel's
|
// MaxFeeAllocation is the highest allocation we'll allow a channel's
|
||||||
|
@ -470,6 +470,13 @@ func (r *RouterBackend) UnmarshallRoute(rpcroute *lnrpc.Route) (
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if routeHop.AmtToForward > r.MaxPaymentMSat {
|
||||||
|
return nil, fmt.Errorf("payment of %v is too large, "+
|
||||||
|
"max payment allowed is %v",
|
||||||
|
routeHop.AmtToForward,
|
||||||
|
r.MaxPaymentMSat.ToSatoshis())
|
||||||
|
}
|
||||||
|
|
||||||
hops[i] = routeHop
|
hops[i] = routeHop
|
||||||
|
|
||||||
prevNodePubKey = routeHop.PubKeyBytes
|
prevNodePubKey = routeHop.PubKeyBytes
|
||||||
|
6
peer.go
6
peer.go
@ -535,6 +535,9 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) (
|
|||||||
FeeRate: selfPolicy.FeeProportionalMillionths,
|
FeeRate: selfPolicy.FeeProportionalMillionths,
|
||||||
TimeLockDelta: uint32(selfPolicy.TimeLockDelta),
|
TimeLockDelta: uint32(selfPolicy.TimeLockDelta),
|
||||||
}
|
}
|
||||||
|
if forwardingPolicy.MaxHTLC > MaxPaymentMSat {
|
||||||
|
forwardingPolicy.MaxHTLC = MaxPaymentMSat
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
peerLog.Warnf("Unable to find our forwarding policy "+
|
peerLog.Warnf("Unable to find our forwarding policy "+
|
||||||
"for channel %v, using default values",
|
"for channel %v, using default values",
|
||||||
@ -1866,6 +1869,9 @@ out:
|
|||||||
FeeRate: defaultPolicy.FeeRate,
|
FeeRate: defaultPolicy.FeeRate,
|
||||||
TimeLockDelta: defaultPolicy.TimeLockDelta,
|
TimeLockDelta: defaultPolicy.TimeLockDelta,
|
||||||
}
|
}
|
||||||
|
if forwardingPolicy.MaxHTLC > MaxPaymentMSat {
|
||||||
|
forwardingPolicy.MaxHTLC = MaxPaymentMSat
|
||||||
|
}
|
||||||
|
|
||||||
// Create the link and add it to the switch.
|
// Create the link and add it to the switch.
|
||||||
err = p.addLink(
|
err = p.addLink(
|
||||||
|
Loading…
Reference in New Issue
Block a user