multi: thread context through RegisterAttempt method

This commit is contained in:
ziggie committed 2026-02-25 08:02:24 +01:00
1 parent 60026494b1
commit 8bb7150dc2
9 files changed
+70 -42

No files matched your search

+5 -4
View File
@@ -31,7 +31,8 @@ type ControlTower interface {
// RegisterAttempt atomically records the provided HTLCAttemptInfo.
//
// NOTE: Subscribers should be notified by the new state of the payment.
RegisterAttempt(lntypes.Hash, *paymentsdb.HTLCAttemptInfo) error
RegisterAttempt(context.Context, lntypes.Hash,
*paymentsdb.HTLCAttemptInfo) error
// SettleAttempt marks the given attempt settled with the preimage. If
// this is a multi shard payment, this might implicitly mean the the
@@ -196,13 +197,13 @@ func (p *controlTower) DeleteFailedAttempts(paymentHash lntypes.Hash) error {
// RegisterAttempt atomically records the provided HTLCAttemptInfo to the
// DB.
func (p *controlTower) RegisterAttempt(paymentHash lntypes.Hash,
attempt *paymentsdb.HTLCAttemptInfo) error {
func (p *controlTower) RegisterAttempt(ctx context.Context,
paymentHash lntypes.Hash, attempt *paymentsdb.HTLCAttemptInfo) error {
p.paymentsMtx.Lock(paymentHash)
defer p.paymentsMtx.Unlock(paymentHash)
payment, err := p.db.RegisterAttempt(paymentHash, attempt)
payment, err := p.db.RegisterAttempt(ctx, paymentHash, attempt)
if err != nil {
return err
}