Skip to content

Commit

Permalink
client/eth: Ignore deadline exceeded.
Browse files Browse the repository at this point in the history
When checking swap status do not use the pending state. It eats an error
caused by a timeout imposed by geth. Also ignore this error when
checking swap confirmations as it is always returned on testnet for
pending swaps but does not indicate anything is wrong with the swap.
  • Loading branch information
JoeGruffins committed Mar 31, 2022
1 parent fb76b59 commit 8f9fe9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion client/asset/eth/contractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ func (c *contractorV0) redeem(txOpts *bind.TransactOpts, redemptions []*asset.Re

func (c *contractorV0) swap(ctx context.Context, secretHash [32]byte) (*dexeth.SwapState, error) {
callOpts := &bind.CallOpts{
Pending: true,
From: c.acctAddr,
Context: ctx,
}
Expand Down
6 changes: 6 additions & 0 deletions client/asset/eth/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,12 @@ func (eth *ExchangeWallet) SwapConfirmations(ctx context.Context, _ dex.Bytes, c

swapData, err := eth.node.swap(ctx, secretHash, contractVer)
if err != nil {
// This error seems to always happen once for new swaps. It can
// be safely ignored.
if errors.Is(err, context.DeadlineExceeded) {
eth.log.Debugf("SwapConfirmations deadline exceeded for secret hash %x", secretHash)
return 0, false, nil
}
return 0, false, fmt.Errorf("error finding swap state: %w", err)
}

Expand Down

0 comments on commit 8f9fe9d

Please sign in to comment.