all: collate new transaction events together

This commit is contained in:
rjl493456442
2018-05-10 15:04:45 +08:00
committed by Péter Szilágyi
parent 6286c255f1
commit a2e43d28d0
19 changed files with 165 additions and 111 deletions

View File

@ -49,7 +49,7 @@ const (
// history request.
historyUpdateRange = 50
// txChanSize is the size of channel listening to TxPreEvent.
// txChanSize is the size of channel listening to TxsPreEvent.
// The number is referenced from the size of tx pool.
txChanSize = 4096
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
@ -58,8 +58,8 @@ const (
type txPool interface {
// SubscribeTxPreEvent should return an event subscription of
// TxPreEvent and send events to the given channel.
SubscribeTxPreEvent(chan<- core.TxPreEvent) event.Subscription
// TxsPreEvent and send events to the given channel.
SubscribeTxPreEvent(chan<- core.TxsPreEvent) event.Subscription
}
type blockChain interface {
@ -150,7 +150,7 @@ func (s *Service) loop() {
headSub := blockchain.SubscribeChainHeadEvent(chainHeadCh)
defer headSub.Unsubscribe()
txEventCh := make(chan core.TxPreEvent, txChanSize)
txEventCh := make(chan core.TxsPreEvent, txChanSize)
txSub := txpool.SubscribeTxPreEvent(txEventCh)
defer txSub.Unsubscribe()