Skip to content

Commit

Permalink
Merge pull request #6026 from mysteriumnetwork/fix-leaking-payments
Browse files Browse the repository at this point in the history
Add sane timeout for the aligning balances with transactor
  • Loading branch information
soffokl authored Apr 2, 2024
2 parents 453bb8b + 148e949 commit 39432b9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions session/pingpong/consumer_balance_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (

"github.com/cenkalti/backoff/v4"
"github.com/ethereum/go-ethereum/common"
"github.com/rs/zerolog/log"

"github.com/mysteriumnetwork/node/config"
nodevent "github.com/mysteriumnetwork/node/core/node/event"
"github.com/mysteriumnetwork/node/eventbus"
Expand All @@ -37,7 +39,6 @@ import (
"github.com/mysteriumnetwork/node/session/pingpong/event"
"github.com/mysteriumnetwork/payments/client"
"github.com/mysteriumnetwork/payments/units"
"github.com/rs/zerolog/log"
)

type balanceKey string
Expand Down Expand Up @@ -537,7 +538,7 @@ func (cbt *ConsumerBalanceTracker) ForceBalanceUpdate(chainID int64, id identity
return fallback.BCBalance
}

var before = new(big.Int)
before := new(big.Int)
if v, ok := cbt.getBalance(chainID, id); ok {
before = v.GetBalance()
}
Expand Down Expand Up @@ -572,7 +573,7 @@ func (cbt *ConsumerBalanceTracker) alignWithTransactor(chainID int64, id identit
}
}

ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()

go func() {
Expand Down

0 comments on commit 39432b9

Please sign in to comment.