Skip to content

Commit 3dd15ef

Browse files
committed
rpcserver: add breathing room to AddInvoice quote max amt
1 parent 9f066a4 commit 3dd15ef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rpcserver.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7730,6 +7730,14 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
77307730
maxUnits = assetUnits.ToUint64()
77317731
}
77327732

7733+
// Since we used a different oracle price query above calculate the max
7734+
// amount of units, we want to add some breathing room to account for
7735+
// price fluctuations caused by the small time delay, plus the fact that
7736+
// the agreed upon quote may be different. If we don't add this safety
7737+
// window the peer may allow a routable amount that evaluates to less
7738+
// than what we ask for.
7739+
maxUnits = (maxUnits * 105) / 100
7740+
77337741
resp, err := r.AddAssetBuyOrder(ctx, &rfqrpc.AddAssetBuyOrderRequest{
77347742
AssetSpecifier: &rfqrpc.AssetSpecifier{
77357743
Id: &rfqrpc.AssetSpecifier_AssetId{

0 commit comments

Comments
 (0)