-
-
Notifications
You must be signed in to change notification settings - Fork 107
/
transaction_e2e_test.go
57 lines (48 loc) · 1.68 KB
/
transaction_e2e_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* Copyright (c) 2018 LI Zhennan
*
* Use of this work is governed by a MIT License.
* You may find a license copy in project root.
*/
package etherscan
import (
"testing"
)
func TestClient_ExecutionStatus(t *testing.T) {
var err error
// bad execution
bad, err := api.ExecutionStatus("0x15f8e5ea1079d9a0bb04a4c58ae5fe7654b5b2b4463375ff7ffb490aa0032f3a")
noError(t, err, "api.ExecutionStatus")
if bad.IsError != 1 && bad.ErrDescription != "Bad jump destination" {
t.Errorf("api.ExecutionStatus not working, got\n%+v", bad)
}
// good execution
good, err := api.ExecutionStatus("0xe8253035f1a1e93be24f43a3592a2c6cdbe3360e6f738ff40d46305252b44f5c")
noError(t, err, "api.ExecutionStatus")
if good.IsError != 0 && good.ErrDescription != "" {
t.Errorf("api.ExecutionStatus not working, got\n%+v", good)
}
}
func TestClient_ReceiptStatus(t *testing.T) {
var err error
// bad execution
bad, err := api.ReceiptStatus("0xe7bbbeb43cf863e20ec865021d63005149c133d7822e8edc1e6cb746d6728d4e")
noError(t, err, "api.ReceiptStatus")
if bad != 0 {
t.Errorf("api.ExecutionStatus not working, got %v, want 0", bad)
}
// good execution
good, err := api.ReceiptStatus("0xe8253035f1a1e93be24f43a3592a2c6cdbe3360e6f738ff40d46305252b44f5c")
noError(t, err, "api.ReceiptStatus")
if good != 1 {
t.Errorf("api.ExecutionStatus not working, got %v, want 1", good)
}
// tx before byzantium fork
before, err := api.ReceiptStatus("0x836b403cc1516eb1337c151ff3660c3ebd528d850e6ac20a75652c705ea769f4")
if err != ErrPreByzantiumTx {
t.Errorf("api.ReceiptStatus does not throw error for tx before byzantium fork")
}
if before != -1 {
t.Errorf("api.ExecutionStatus not working, got %v, want -1", before)
}
}