mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Update ethclient_test.go
This commit is contained in:
parent
085274afef
commit
e92c26c6e3
1 changed files with 5 additions and 5 deletions
|
|
@ -643,27 +643,27 @@ func testAtFunctions(t *testing.T, client *rpc.Client) {
|
||||||
if !bytes.Equal(code, penCode) {
|
if !bytes.Equal(code, penCode) {
|
||||||
t.Fatalf("unexpected code: %v %v", code, penCode)
|
t.Fatalf("unexpected code: %v %v", code, penCode)
|
||||||
}
|
}
|
||||||
// Use HeaderByNumber to get a header for EstimateGasAt and EstimateGasAtHash
|
// Use HeaderByNumber to get a header for EstimateGasAtBlock and EstimateGasAtBlockHash
|
||||||
latestHeader, err := ec.HeaderByNumber(context.Background(), nil)
|
latestHeader, err := ec.HeaderByNumber(context.Background(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
// EstimateGasAt
|
// EstimateGasAtBlock
|
||||||
msg := ethereum.CallMsg{
|
msg := ethereum.CallMsg{
|
||||||
From: testAddr,
|
From: testAddr,
|
||||||
To: &common.Address{},
|
To: &common.Address{},
|
||||||
Gas: 21000,
|
Gas: 21000,
|
||||||
Value: big.NewInt(1),
|
Value: big.NewInt(1),
|
||||||
}
|
}
|
||||||
gas, err := ec.EstimateGasAt(context.Background(), msg, latestHeader.Number)
|
gas, err := ec.EstimateGasAtBlock(context.Background(), msg, latestHeader.Number)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
if gas != 21000 {
|
if gas != 21000 {
|
||||||
t.Fatalf("unexpected gas limit: %v", gas)
|
t.Fatalf("unexpected gas limit: %v", gas)
|
||||||
}
|
}
|
||||||
// EstimateGasAtHash
|
// EstimateGasAtBlockHash
|
||||||
gas, err = ec.EstimateGasAtHash(context.Background(), msg, latestHeader.Hash())
|
gas, err = ec.EstimateGasAtBlockHash(context.Background(), msg, latestHeader.Hash())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue