File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -7808,12 +7808,27 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
78087808
78097809 invUnits := req .AssetAmount
78107810
7811- // If the invoice was created over a satoshi amount, we need to
7812- // calculate the units.
78137811 if satsMode {
7812+ // If the invoice was created over a satoshi amount, we need to
7813+ // calculate the units.
78147814 invUnits = rfqmath .MilliSatoshiToUnits (
78157815 amtMsat , * askAssetRate ,
78167816 ).ToUint64 ()
7817+
7818+ // Now let's see if the negotiated quote can actually route the
7819+ // amount we need in msat.
7820+ maxFixedUnits := rfqmath .NewBigIntFixedPoint (
7821+ acceptedQuote .AssetMaxAmount , 0 ,
7822+ )
7823+ maxRoutableMsat := rfqmath .UnitsToMilliSatoshi (
7824+ maxFixedUnits , * askAssetRate ,
7825+ )
7826+
7827+ if maxRoutableMsat <= amtMsat {
7828+ return nil , fmt .Errorf ("cannot create invoice for %v " +
7829+ "msat, max routable amount is %v msat" , amtMsat ,
7830+ maxRoutableMsat )
7831+ }
78177832 }
78187833
78197834 // If the invoice is for an asset unit amount smaller than the minimal
You can’t perform that action at this time.
0 commit comments