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 13:50:06 +0800
commit206900aa9d13ba2057cbc5379bef4dcfd1ee0ef4 (patch)
tree2a433328e148052ba52a718385cf3de8f0e46091
parent0be5d4384d58847a158558cff838d51846a2db7c (diff)
downloaddexon-206900aa9d13ba2057cbc5379bef4dcfd1ee0ef4.tar.gz
dexon-206900aa9d13ba2057cbc5379bef4dcfd1ee0ef4.tar.zst
dexon-206900aa9d13ba2057cbc5379bef4dcfd1ee0ef4.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)
}