@ -124,8 +124,8 @@ const (
PendingLogsSubscription
// MinedAndPendingLogsSubscription queries for logs in mined and pending blocks.
MinedAndPendingLogsSubscription
// PendingTransactionsSubscription queries tx hashes for pending
// transactions entering t he pending state
// PendingTransactionsSubscription queries for pending transactions enter ing
// the pending state
PendingTransactionsSubscription
// BlocksSubscription queries hashes for blocks that are imported
BlocksSubscription
@ -151,7 +151,7 @@ type subscription struct {
created time . Time
logsCrit ethereum . FilterQuery
logs chan [ ] * types . Log
hashes chan [ ] common . Hash
txs chan [ ] * types . Transaction
headers chan * types . Header
installed chan struct { } // closed when the filter is installed
err chan error // closed when the filter is uninstalled
@ -244,7 +244,7 @@ func (sub *Subscription) Unsubscribe() {
case sub . es . uninstall <- sub . f :
break uninstallLoop
case <- sub . f . logs :
case <- sub . f . hashe s:
case <- sub . f . tx s:
case <- sub . f . headers :
}
}
@ -311,7 +311,7 @@ func (es *EventSystem) subscribeMinedPendingLogs(crit ethereum.FilterQuery, logs
logsCrit : crit ,
created : time . Now ( ) ,
logs : logs ,
hashes : make ( chan [ ] common . Hash ) ,
txs : make ( chan [ ] * types . Transaction ) ,
headers : make ( chan * types . Header ) ,
installed : make ( chan struct { } ) ,
err : make ( chan error ) ,
@ -328,7 +328,7 @@ func (es *EventSystem) subscribeLogs(crit ethereum.FilterQuery, logs chan []*typ
logsCrit : crit ,
created : time . Now ( ) ,
logs : logs ,
hashes : make ( chan [ ] common . Hash ) ,
txs : make ( chan [ ] * types . Transaction ) ,
headers : make ( chan * types . Header ) ,
installed : make ( chan struct { } ) ,
err : make ( chan error ) ,
@ -345,7 +345,7 @@ func (es *EventSystem) subscribePendingLogs(crit ethereum.FilterQuery, logs chan
logsCrit : crit ,
created : time . Now ( ) ,
logs : logs ,
hashes : make ( chan [ ] common . Hash ) ,
txs : make ( chan [ ] * types . Transaction ) ,
headers : make ( chan * types . Header ) ,
installed : make ( chan struct { } ) ,
err : make ( chan error ) ,
@ -361,7 +361,7 @@ func (es *EventSystem) SubscribeNewHeads(headers chan *types.Header) *Subscripti
typ : BlocksSubscription ,
created : time . Now ( ) ,
logs : make ( chan [ ] * types . Log ) ,
hashes : make ( chan [ ] common . Hash ) ,
txs : make ( chan [ ] * types . Transaction ) ,
headers : headers ,
installed : make ( chan struct { } ) ,
err : make ( chan error ) ,
@ -369,15 +369,15 @@ func (es *EventSystem) SubscribeNewHeads(headers chan *types.Header) *Subscripti
return es . subscribe ( sub )
}
// SubscribePendingTxs creates a subscription that writes transaction hashe s for
// SubscribePendingTxs creates a subscription that writes transactions for
// transactions that enter the transaction pool.
func ( es * EventSystem ) SubscribePendingTxs ( hashes chan [ ] common . Hash ) * Subscription {
func ( es * EventSystem ) SubscribePendingTxs ( txs chan [ ] * types . Transaction ) * Subscription {
sub := & subscription {
id : rpc . NewID ( ) ,
typ : PendingTransactionsSubscription ,
created : time . Now ( ) ,
logs : make ( chan [ ] * types . Log ) ,
hashes : hashe s,
txs : tx s,
headers : make ( chan * types . Header ) ,
installed : make ( chan struct { } ) ,
err : make ( chan error ) ,
@ -421,12 +421,8 @@ func (es *EventSystem) handleRemovedLogs(filters filterIndex, ev core.RemovedLog
}
func ( es * EventSystem ) handleTxsEvent ( filters filterIndex , ev core . NewTxsEvent ) {
hashes := make ( [ ] common . Hash , 0 , len ( ev . Txs ) )
for _ , tx := range ev . Txs {
hashes = append ( hashes , tx . Hash ( ) )
}
for _ , f := range filters [ PendingTransactionsSubscription ] {
f . hashes <- hashe s
f . txs <- ev . Txs
}
}