aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-04-06 11:51:59 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:59 +0800
commit552282d50681b3d929cb804f41ba1c1cc6fbbdae (patch)
treed308e69f6b117b057282be044221bab63e768d5e
parent01f837cabe728108ceaa008308ea63473f5025bd (diff)
downloaddexon-552282d50681b3d929cb804f41ba1c1cc6fbbdae.tar
dexon-552282d50681b3d929cb804f41ba1c1cc6fbbdae.tar.gz
dexon-552282d50681b3d929cb804f41ba1c1cc6fbbdae.tar.bz2
dexon-552282d50681b3d929cb804f41ba1c1cc6fbbdae.tar.lz
dexon-552282d50681b3d929cb804f41ba1c1cc6fbbdae.tar.xz
dexon-552282d50681b3d929cb804f41ba1c1cc6fbbdae.tar.zst
dexon-552282d50681b3d929cb804f41ba1c1cc6fbbdae.zip
cmd: monkey: use suggested gas price
-rw-r--r--cmd/zoo/monkey/monkey.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/zoo/monkey/monkey.go b/cmd/zoo/monkey/monkey.go
index 2afffa87c..a511c42fa 100644
--- a/cmd/zoo/monkey/monkey.go
+++ b/cmd/zoo/monkey/monkey.go
@@ -124,16 +124,21 @@ func (m *Monkey) prepareTx(ctx *transferContext) *types.Transaction {
}
}
+ gasPrice, err := m.client.SuggestGasPrice(context.Background())
+ if err != nil {
+ panic(err)
+ }
+
tx := types.NewTransaction(
ctx.Nonce,
ctx.ToAddress,
ctx.Amount,
ctx.Gas,
- big.NewInt(1e9),
+ gasPrice,
ctx.Data)
signer := types.NewEIP155Signer(m.networkID)
- tx, err := types.SignTx(tx, signer, ctx.Key)
+ tx, err = types.SignTx(tx, signer, ctx.Key)
if err != nil {
panic(err)
}