ethclient: fix timeout param for eth_sendRawTransactionSync (#33693)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

Fix timeout parameter in eth_sendRawTransactionSync
to be an integer instead of hex. The spec has now been
clarified on this point.
This commit is contained in:
milan-cb 2026-01-29 12:41:18 -08:00 committed by GitHub
parent a179ccf6f0
commit 845009f684
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View file

@ -729,9 +729,11 @@ func (ec *Client) SendRawTransactionSync(
rawTx []byte,
timeout *time.Duration,
) (*types.Receipt, error) {
var ms *hexutil.Uint64
var ms *uint64
if timeout != nil {
if d := hexutil.Uint64(timeout.Milliseconds()); d > 0 {
msInt := timeout.Milliseconds()
if msInt > 0 {
d := uint64(msInt)
ms = &d
}
}

View file

@ -1661,7 +1661,7 @@ func (api *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil
// SendRawTransactionSync will add the signed transaction to the transaction pool
// and wait until the transaction has been included in a block and return the receipt, or the timeout.
func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hexutil.Bytes, timeoutMs *hexutil.Uint64) (map[string]interface{}, error) {
func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hexutil.Bytes, timeoutMs *uint64) (map[string]interface{}, error) {
tx := new(types.Transaction)
if err := tx.UnmarshalBinary(input); err != nil {
return nil, err

View file

@ -4026,7 +4026,7 @@ func TestSendRawTransactionSync_Timeout(t *testing.T) {
raw, _ := makeSelfSignedRaw(t, api, b.acc.Address)
timeout := hexutil.Uint64(200) // 200ms
timeout := uint64(200) // 200ms
receipt, err := api.SendRawTransactionSync(context.Background(), raw, &timeout)
if receipt != nil {