mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
miner: add SubscribePendingLogs
This commit is contained in:
parent
ad9cc48ffc
commit
4e81a62b74
2 changed files with 10 additions and 1 deletions
|
|
@ -182,3 +182,9 @@ func (self *Miner) SetEtherbase(addr common.Address) {
|
|||
self.coinbase = addr
|
||||
self.worker.setEtherbase(addr)
|
||||
}
|
||||
|
||||
// SubscribePendingLogs starts delivering logs from pending transactions
|
||||
// to the given channel.
|
||||
func (self *Miner) SubscribePendingLogs(ch chan<- []*types.Log) event.Subscription {
|
||||
return self.worker.pendingLogsFeed.Subscribe(ch)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,6 +128,9 @@ type worker struct {
|
|||
eth Backend
|
||||
chain *core.BlockChain
|
||||
|
||||
// Feeds
|
||||
pendingLogsFeed event.Feed
|
||||
|
||||
// Subscriptions
|
||||
mux *event.TypeMux
|
||||
txsCh chan core.NewTxsEvent
|
||||
|
|
@ -818,7 +821,7 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
|
|||
cpy[i] = new(types.Log)
|
||||
*cpy[i] = *l
|
||||
}
|
||||
go w.mux.Post(core.PendingLogsEvent{Logs: cpy})
|
||||
w.pendingLogsFeed.Send(cpy)
|
||||
}
|
||||
// Notify resubmit loop to decrease resubmitting interval if current interval is larger
|
||||
// than the user-specified one.
|
||||
|
|
|
|||
Loading…
Reference in a new issue