File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,17 @@ type PaymentControl interface {
6161 InitPayment (lntypes.Hash , * PaymentCreationInfo ) error
6262
6363 // RegisterAttempt atomically records the provided HTLCAttemptInfo.
64+ //
65+ // IMPORTANT: Callers MUST serialize calls to RegisterAttempt for the
66+ // same payment hash. Concurrent calls will result in race conditions
67+ // where both calls read the same initial payment state, validate
68+ // against stale data, and could cause overpayment. For example:
69+ // - Both goroutines fetch payment with 400 sats sent
70+ // - Both validate sending 650 sats won't overpay (within limit)
71+ // - Both commit successfully
72+ // - Result: 1700 sats sent, exceeding the payment amount
73+ // The payment router/controller layer is responsible for ensuring
74+ // serialized access per payment hash.
6475 RegisterAttempt (lntypes.Hash , * HTLCAttemptInfo ) (* MPPayment , error )
6576
6677 // SettleAttempt marks the given attempt settled with the preimage. If
You can’t perform that action at this time.
0 commit comments