Skip to content

Commit

Permalink
comments and minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhou committed Apr 5, 2024
1 parent a3bee39 commit 27bb1e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions eth/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const (
defaultTxTimeout = 6 * time.Hour
defaultTxQueryTimeout = 2 * time.Minute
defaultTxQueryRetryInterval = 10 * time.Second
defaultMaxPendingTxNum = 20
defaultMaxSubmittingTxNum = 10
defaultMaxPendingTxNum = 10
defaultMaxSubmittingTxNum = 5
)

// do not return pointer here as defaultTxOptions is always deep copied when used
Expand Down
8 changes: 4 additions & 4 deletions eth/transactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ func (t *Transactor) determineNonce(txopts txOptions) (uint64, uint64, error) {
if err != nil {
return 0, 0, fmt.Errorf("PendingNonceAt err: %w", err)
}
nonce := txopts.nonce
nonce := txopts.nonce // init as given by the txOption (should be zero in most cases)

if txopts.nonce != 0 {
if txopts.nonce == 0 { // nonce given by the txOption is zero, which is the common case
nonce = t.nonce
if pendingNonce > nonce || !t.sentTx || txopts.maxSubmittingTxNum == 1 {
nonce = pendingNonce
Expand Down Expand Up @@ -349,13 +349,13 @@ func printGasGwei(signer *bind.TransactOpts) string {
}
res := ""
if signer.GasPrice != nil && signer.GasPrice.Sign() > 0 {
res += fmt.Sprintf("price %d ", signer.GasPrice.Uint64()/1e9)
res += fmt.Sprintf("price %.2f ", float64(signer.GasPrice.Uint64())/1e9)
}
if signer.GasFeeCap != nil && signer.GasFeeCap.Sign() > 0 {
res += fmt.Sprintf("feecap %d ", signer.GasFeeCap.Uint64()/1e9)
}
if signer.GasTipCap != nil && signer.GasTipCap.Sign() > 0 {
res += fmt.Sprintf("tipcap %d ", signer.GasTipCap.Uint64()/1e9)
res += fmt.Sprintf("tipcap %.2f ", float64(signer.GasTipCap.Uint64())/1e9)
}
return strings.TrimSpace(res)
}
Expand Down

0 comments on commit 27bb1e4

Please sign in to comment.