mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 07:37:20 +00:00
ethclient: fix timeout param for eth_sendRawTransactionSync (#33693)
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:
parent
a179ccf6f0
commit
845009f684
3 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue