rm redundant headfeed

This commit is contained in:
aodhgan 2025-10-09 12:27:49 -07:00
parent 3a3c46a39b
commit 3d083d02fd
2 changed files with 4 additions and 6 deletions

View file

@ -1691,8 +1691,8 @@ func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hex
} }
// Subscribe to receipt stream (filtered to this tx) // Subscribe to receipt stream (filtered to this tx)
rcpts := make(chan []*ReceiptWithTx, 1) receipts := make(chan []*ReceiptWithTx, 1)
sub := api.b.SubscribeTransactionReceipts([]common.Hash{hash}, rcpts) sub := api.b.SubscribeTransactionReceipts([]common.Hash{hash}, receipts)
defer sub.Unsubscribe() defer sub.Unsubscribe()
subErrCh := sub.Err() subErrCh := sub.Err()
@ -1717,7 +1717,7 @@ func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hex
} }
return nil, err return nil, err
case batch := <-rcpts: case batch := <-receipts:
for _, rwt := range batch { for _, rwt := range batch {
if rwt == nil || rwt.Receipt == nil || rwt.Receipt.TxHash != hash { if rwt == nil || rwt.Receipt == nil || rwt.Receipt.TxHash != hash {
continue continue

View file

@ -443,7 +443,6 @@ type testBackend struct {
// test-only fields for SendRawTransactionSync // test-only fields for SendRawTransactionSync
receiptsFeed *event.Feed receiptsFeed *event.Feed
headFeed *event.Feed // keep if other tests use it; otherwise remove
autoMine bool autoMine bool
sentTx *types.Transaction sentTx *types.Transaction
@ -481,7 +480,6 @@ func newTestBackend(t *testing.T, n int, gspec *core.Genesis, engine consensus.E
acc: acc, acc: acc,
pending: blocks[n], pending: blocks[n],
pendingReceipts: receipts[n], pendingReceipts: receipts[n],
headFeed: new(event.Feed),
receiptsFeed: new(event.Feed), receiptsFeed: new(event.Feed),
} }
return backend return backend
@ -607,7 +605,7 @@ func (b testBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscr
panic("implement me") panic("implement me")
} }
func (b testBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription { func (b testBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription {
return b.headFeed.Subscribe(ch) panic("implement me")
} }
func (b *testBackend) SendTx(ctx context.Context, tx *types.Transaction) error { func (b *testBackend) SendTx(ctx context.Context, tx *types.Transaction) error {
b.sentTx = tx b.sentTx = tx