mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
use pointer for timeout param
This commit is contained in:
parent
eed426c36f
commit
b05fbc1868
1 changed files with 8 additions and 6 deletions
|
|
@ -703,24 +703,26 @@ func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) er
|
||||||
func (ec *Client) SendTransactionSync(
|
func (ec *Client) SendTransactionSync(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
tx *types.Transaction,
|
tx *types.Transaction,
|
||||||
timeout ...time.Duration,
|
timeout *time.Duration,
|
||||||
) (*types.Receipt, error) {
|
) (*types.Receipt, error) {
|
||||||
raw, err := tx.MarshalBinary()
|
raw, err := tx.MarshalBinary()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return ec.SendRawTransactionSync(ctx, raw, timeout...)
|
return ec.SendRawTransactionSync(ctx, raw, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *Client) SendRawTransactionSync(
|
func (ec *Client) SendRawTransactionSync(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
rawTx []byte,
|
rawTx []byte,
|
||||||
timeout ...time.Duration,
|
timeout *time.Duration,
|
||||||
) (*types.Receipt, error) {
|
) (*types.Receipt, error) {
|
||||||
var ms *hexutil.Uint64
|
var ms *hexutil.Uint64
|
||||||
if len(timeout) > 0 && timeout[0] > 0 {
|
if timeout != nil {
|
||||||
v := hexutil.Uint64(timeout[0] / time.Millisecond)
|
if d := timeout.Milliseconds(); d > 0 {
|
||||||
ms = &v
|
ms = new(hexutil.Uint64)
|
||||||
|
*ms = hexutil.Uint64(uint64(d))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var receipt types.Receipt
|
var receipt types.Receipt
|
||||||
if err := ec.c.CallContext(ctx, &receipt, "eth_sendRawTransactionSync", hexutil.Bytes(rawTx), ms); err != nil {
|
if err := ec.c.CallContext(ctx, &receipt, "eth_sendRawTransactionSync", hexutil.Bytes(rawTx), ms); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue