mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +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) {
|
||||
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)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
// EstimateGasAt
|
||||
// EstimateGasAtBlock
|
||||
msg := ethereum.CallMsg{
|
||||
From: testAddr,
|
||||
To: &common.Address{},
|
||||
Gas: 21000,
|
||||
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 {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if gas != 21000 {
|
||||
t.Fatalf("unexpected gas limit: %v", gas)
|
||||
}
|
||||
// EstimateGasAtHash
|
||||
gas, err = ec.EstimateGasAtHash(context.Background(), msg, latestHeader.Hash())
|
||||
// EstimateGasAtBlockHash
|
||||
gas, err = ec.EstimateGasAtBlockHash(context.Background(), msg, latestHeader.Hash())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue