Skip to content

Commit 3243db8

Browse files
committed
rpcserver: enforce keysend minimum carrier HTLC amount
Fixes an issue where attempting to pay a below-dust carrier HTLC satoshi amount would knock a channel offline.
1 parent ffcc47b commit 3243db8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

rpcserver.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7787,6 +7787,16 @@ func (r *rpcServer) SendPayment(req *tchrpc.SendPaymentRequest,
77877787
"for keysend payment")
77887788
}
77897789

7790+
// We must enforce a minimum satoshi amount to make sure the
7791+
// carrier HTLC is above dust. This is handled by the traffic
7792+
// shaper for invoice-based payments, but for keysend payments
7793+
// we need to do it here.
7794+
if pReq.Amt < int64(rfqmath.DefaultOnChainHtlcSat) {
7795+
return fmt.Errorf("keysend payment satoshi amount "+
7796+
"must be greater than or equal to %d satoshis",
7797+
rfqmath.DefaultOnChainHtlcSat)
7798+
}
7799+
77907800
if len(req.PaymentRequest.Dest) == 0 {
77917801
return fmt.Errorf("destination node must be " +
77927802
"specified for keysend payment")

0 commit comments

Comments
 (0)