You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// AccountNonce returns the current nonce of the account. This is the nonce to// be used while building a new transaction.func (client*Client) AccountNonce(ctx context.Context, addr address.Address) (pack.U256, error) {
targetAddr, err:=NewAddressFromHex(string(pack.String(addr)))
iferr!=nil {
return pack.U256{}, fmt.Errorf("bad to address '%v': %v", addr, err)
}
nonce, err:=client.EthClient.NonceAt(ctx, common.Address(targetAddr), nil)
iferr!=nil {
return pack.U256{}, fmt.Errorf("failed to get nonce for '%v': %v", addr, err)
}
returnpack.NewU256FromU64(pack.NewU64(nonce)), nil
}
Shouldn't this function use PendingNonceAt? After all, the comment above says that it should be used to craft the next Tx, but in Ethereum docs (https://pkg.go.dev/github.com/ethereum/go-ethereum/ethclient#Client.PendingNonceAt) it says to use PendingNonceAt. Any thoughts?
The text was updated successfully, but these errors were encountered: