Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
swap/chain: add txqueue
Browse files Browse the repository at this point in the history
  • Loading branch information
ralph-pichler committed Feb 25, 2020
1 parent 7c3e83f commit 2e02111
Show file tree
Hide file tree
Showing 4 changed files with 931 additions and 10 deletions.
11 changes: 1 addition & 10 deletions swap/chain/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package chain

import (
"context"
"errors"
"time"

"github.com/ethereum/go-ethereum/log"
Expand All @@ -12,11 +11,6 @@ import (
"github.com/ethereum/go-ethereum/core/types"
)

var (
// ErrTransactionReverted is given when the transaction that cashes a cheque is reverted
ErrTransactionReverted = errors.New("Transaction reverted")
)

// Backend is the minimum amount of functionality required by the underlying ethereum backend
type Backend interface {
bind.ContractBackend
Expand All @@ -30,12 +24,9 @@ func WaitMined(ctx context.Context, b Backend, hash common.Hash) (*types.Receipt
for {
receipt, err := b.TransactionReceipt(ctx, hash)
if err != nil {
log.Error("receipt retrieval failed", "err", err)
log.Trace("receipt retrieval failed", "err", err)
}
if receipt != nil {
if receipt.Status != types.ReceiptStatusSuccessful {
return nil, ErrTransactionReverted
}
return receipt, nil
}

Expand Down
Loading

0 comments on commit 2e02111

Please sign in to comment.