aboutsummaryrefslogtreecommitdiffstats
path: root/ethclient/ethclient_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethclient/ethclient_test.go')
-rw-r--r--ethclient/ethclient_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go
index 74711bd39..2e464cd42 100644
--- a/ethclient/ethclient_test.go
+++ b/ethclient/ethclient_test.go
@@ -301,3 +301,21 @@ func TestBalanceAt(t *testing.T) {
})
}
}
+
+func TestTransactionInBlockInterrupted(t *testing.T) {
+ backend, _ := newTestBackend(t)
+ client, _ := backend.Attach()
+ defer backend.Stop()
+ defer client.Close()
+
+ ec := NewClient(client)
+ ctx, cancel := context.WithCancel(context.Background())
+ cancel()
+ tx, err := ec.TransactionInBlock(ctx, common.Hash{1}, 1)
+ if tx != nil {
+ t.Fatal("transaction should be nil")
+ }
+ if err == nil {
+ t.Fatal("error should not be nil")
+ }
+}