mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
clean
This commit is contained in:
parent
2ed437e361
commit
3aa3538507
3 changed files with 13 additions and 19 deletions
|
|
@ -1694,7 +1694,7 @@ func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hex
|
|||
for {
|
||||
select {
|
||||
case <-receiptCtx.Done():
|
||||
// Upstream cancellation -> bubble it; otherwise emit our timeout error
|
||||
// Upstream cancellation -> bubble it; otherwise emit the timeout error
|
||||
if err := ctx.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -447,8 +447,8 @@ type testBackend struct {
|
|||
sentTx *types.Transaction
|
||||
sentTxHash common.Hash
|
||||
|
||||
syncDefaultTO time.Duration
|
||||
syncMaxTO time.Duration
|
||||
syncDefaultTimeout time.Duration
|
||||
syncMaxTimeout time.Duration
|
||||
}
|
||||
|
||||
func fakeBlockHash(txh common.Hash) common.Hash {
|
||||
|
|
@ -613,24 +613,20 @@ func (b *testBackend) SendTx(ctx context.Context, tx *types.Transaction) error {
|
|||
if b.autoMine {
|
||||
// Synthesize a "mined" receipt at head+1
|
||||
num := b.chain.CurrentHeader().Number.Uint64() + 1
|
||||
|
||||
bh := fakeBlockHash(tx.Hash())
|
||||
receipt := &types.Receipt{
|
||||
TxHash: tx.Hash(),
|
||||
Status: types.ReceiptStatusSuccessful,
|
||||
BlockHash: bh,
|
||||
BlockHash: fakeBlockHash(tx.Hash()),
|
||||
BlockNumber: new(big.Int).SetUint64(num),
|
||||
TransactionIndex: 0,
|
||||
CumulativeGasUsed: 21000,
|
||||
GasUsed: 21000,
|
||||
}
|
||||
hdr := &types.Header{
|
||||
Number: new(big.Int).SetUint64(num),
|
||||
}
|
||||
|
||||
// Broadcast a ChainEvent that includes the receipts and txs
|
||||
b.chainFeed.Send(core.ChainEvent{
|
||||
Header: hdr,
|
||||
Header: &types.Header{
|
||||
Number: new(big.Int).SetUint64(num),
|
||||
},
|
||||
Receipts: types.Receipts{receipt},
|
||||
Transactions: types.Transactions{tx},
|
||||
})
|
||||
|
|
@ -3954,14 +3950,14 @@ func (b configTimeBackend) CurrentHeader() *types.Header {
|
|||
}
|
||||
|
||||
func (b *testBackend) RPCTxSyncDefaultTimeout() time.Duration {
|
||||
if b.syncDefaultTO != 0 {
|
||||
return b.syncDefaultTO
|
||||
if b.syncDefaultTimeout != 0 {
|
||||
return b.syncDefaultTimeout
|
||||
}
|
||||
return 2 * time.Second
|
||||
}
|
||||
func (b *testBackend) RPCTxSyncMaxTimeout() time.Duration {
|
||||
if b.syncMaxTO != 0 {
|
||||
return b.syncMaxTO
|
||||
if b.syncMaxTimeout != 0 {
|
||||
return b.syncMaxTimeout
|
||||
}
|
||||
return 5 * time.Minute
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,8 +176,6 @@ type blockGasLimitReachedError struct{ message string }
|
|||
func (e *blockGasLimitReachedError) Error() string { return e.message }
|
||||
func (e *blockGasLimitReachedError) ErrorCode() int { return errCodeBlockGasLimitReached }
|
||||
|
||||
func (e *txSyncTimeoutError) Error() string { return e.msg }
|
||||
func (e *txSyncTimeoutError) ErrorCode() int { return errCodeTxSyncTimeout }
|
||||
|
||||
// ErrorData should be JSON-safe; return the 0x-hex string.
|
||||
func (e *txSyncTimeoutError) Error() string { return e.msg }
|
||||
func (e *txSyncTimeoutError) ErrorCode() int { return errCodeTxSyncTimeout }
|
||||
func (e *txSyncTimeoutError) ErrorData() interface{} { return e.hash.Hex() }
|
||||
|
|
|
|||
Loading…
Reference in a new issue