Skip to content

Commit

Permalink
gas / gas adjustment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adamewozniak committed Jan 16, 2024
1 parent aea1297 commit c2b0d00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion oracle/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (oc OracleClient) CreateTxFactory() (tx.Factory, error) {
return tx.Factory{}, err
}

if oc.GasAdjustment == -1 {
if oc.GasAdjustment > 0 {
return tx.Factory{}.
WithAccountRetriever(clientCtx.AccountRetriever).
WithChainID(oc.ChainID).
Expand Down
12 changes: 7 additions & 5 deletions oracle/client/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ func BroadcastTx(clientCtx client.Context, txf tx.Factory, msgs ...sdk.Msg) (*sd
return nil, err
}

_, adjusted, err := tx.CalculateGas(clientCtx, txf, msgs...)
if err != nil {
return nil, err
}
if txf.GasAdjustment() > 0 {
_, adjusted, err := tx.CalculateGas(clientCtx, txf, msgs...)
if err != nil {
return nil, err
}

txf = txf.WithGas(adjusted)
txf = txf.WithGas(adjusted)
}

unsignedTx, err := txf.BuildUnsignedTx(msgs...)
if err != nil {
Expand Down

0 comments on commit c2b0d00

Please sign in to comment.