Skip to content

Commit 0e7d019

Browse files
committed
core: fire tx event on replace, expand tests
1 parent eaa4f8a commit 0e7d019

3 files changed

Lines changed: 191 additions & 4 deletions

File tree

‎core/bloombits/matcher_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func TestWildcardMatcher(t *testing.T) {
8585
}
8686

8787
// makeRandomIndexes generates a random filter system, composed on multiple filter
88-
// criteria, each having one bloom list component for the address and arbitrarilly
88+
// criteria, each having one bloom list component for the address and arbitrarily
8989
// many topic bloom list components.
9090
func makeRandomIndexes(lengths []int, max int) [][]bloomIndexes {
9191
res := make([][]bloomIndexes, len(lengths))

‎core/tx_pool.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,10 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) {
640640
pool.journalTx(from, tx)
641641

642642
log.Trace("Pooled new executable transaction", "hash", hash, "from", from, "to", tx.To())
643+
644+
// We've directly injected a replacement transaction, notify subsystems
645+
go pool.txFeed.Send(TxPreEvent{tx})
646+
643647
return old != nil, nil
644648
}
645649
// New transaction isn't replacing a pending one, push into queue
@@ -729,6 +733,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
729733
// Set the potentially new pending nonce and notify any subsystems of the new tx
730734
pool.beats[addr] = time.Now()
731735
pool.pendingState.SetNonce(addr, tx.Nonce()+1)
736+
732737
go pool.txFeed.Send(TxPreEvent{tx})
733738
}
734739

0 commit comments

Comments
 (0)