@@ -28,7 +28,7 @@ type BroadcastCfg struct {
2828 // If true, simulation is attempted but not printed;
2929 // the result is only returned in case of an error.
3030 testSimulate bool
31- GasFeeMargin int64
31+ GasFeeMargin uint64
3232}
3333
3434func NewBroadcastCmd (rootCfg * BaseCfg , io commands.IO ) * commands.Command {
@@ -144,7 +144,7 @@ func BroadcastHandler(cfg *BroadcastCfg) (*ctypes.ResultBroadcastTxCommit, error
144144 return bres , nil
145145}
146146
147- func estimateGasFee (cli client.ABCIClient , bres * ctypes.ResultBroadcastTxCommit , gasFeeMargin int64 ) error {
147+ func estimateGasFee (cli client.ABCIClient , bres * ctypes.ResultBroadcastTxCommit , gasFeeMargin uint64 ) error {
148148 gp := std.GasPrice {}
149149 qres , err := cli .ABCIQuery (context .Background (), "auth/gasprice" , []byte {})
150150 if err != nil {
@@ -162,7 +162,7 @@ func estimateGasFee(cli client.ABCIClient, bres *ctypes.ResultBroadcastTxCommit,
162162 fee := bres .DeliverTx .GasUsed / gp .Gas + 1
163163 fee = overflow .Mulp (fee , gp .Price .Amount )
164164 // gasFeeMargin is a percentage fee buffer to cover the sudden change of gas price
165- feeBuffer := overflow .Mulp (fee , gasFeeMargin ) / 100
165+ feeBuffer := overflow .Mulp (fee , int64 ( gasFeeMargin ) ) / 100
166166 fee = overflow .Addp (fee , feeBuffer )
167167 s := fmt .Sprintf ("estimated gas usage: %d, gas fee: %d%s, current gas price: %s\n " , bres .DeliverTx .GasUsed , fee , gp .Price .Denom , gp .String ())
168168 bres .DeliverTx .Info = s
0 commit comments