2021-03-02 22:47:44 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/ledgerwatch/turbo-geth/common"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/internal/ethapi"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestEstimateGas(t *testing.T) {
|
2021-03-30 09:53:54 +00:00
|
|
|
db, err := createTestKV()
|
2021-03-02 22:47:44 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("create test db: %v", err)
|
|
|
|
}
|
2021-04-01 05:15:22 +00:00
|
|
|
defer db.Close()
|
2021-05-17 12:15:19 +00:00
|
|
|
api := NewEthAPI(NewBaseApi(nil), db, nil, nil, nil, 5000000)
|
2021-03-02 22:47:44 +00:00
|
|
|
var from = common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
|
|
|
|
var to = common.HexToAddress("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e")
|
|
|
|
if _, err := api.EstimateGas(context.Background(), ethapi.CallArgs{
|
|
|
|
From: &from,
|
|
|
|
To: &to,
|
2021-03-31 04:32:52 +00:00
|
|
|
}, nil); err != nil {
|
2021-03-02 22:47:44 +00:00
|
|
|
t.Errorf("calling EstimateGas: %v", err)
|
|
|
|
}
|
|
|
|
}
|