diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-02-13 20:53:59 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-02-13 20:53:59 +0800 |
commit | cb85923828d5ea45b53189b3b29ab014d9601f09 (patch) | |
tree | 6ced6a59dc3ac84db21ce8021ebc36cfe1f9d8fe /core | |
parent | 770b29fd80b8f25be31c2db5af6904cc5d0688ef (diff) | |
parent | 987c1a595a6a318ac83b68e3b87812497070bf9b (diff) | |
download | dexon-cb85923828d5ea45b53189b3b29ab014d9601f09.tar dexon-cb85923828d5ea45b53189b3b29ab014d9601f09.tar.gz dexon-cb85923828d5ea45b53189b3b29ab014d9601f09.tar.bz2 dexon-cb85923828d5ea45b53189b3b29ab014d9601f09.tar.lz dexon-cb85923828d5ea45b53189b3b29ab014d9601f09.tar.xz dexon-cb85923828d5ea45b53189b3b29ab014d9601f09.tar.zst dexon-cb85923828d5ea45b53189b3b29ab014d9601f09.zip |
Merge pull request #2205 from obscuren/pending-filters
eth/filters: ✨ pending logs ✨
Diffstat (limited to 'core')
-rw-r--r-- | core/blockchain.go | 2 | ||||
-rw-r--r-- | core/blockchain_test.go | 4 | ||||
-rw-r--r-- | core/events.go | 7 |
3 files changed, 9 insertions, 4 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 95ed06d8d..22dd617ad 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1358,7 +1358,7 @@ func (self *BlockChain) reorg(oldBlock, newBlock *types.Block) error { go self.eventMux.Post(RemovedTransactionEvent{diff}) } if len(deletedLogs) > 0 { - go self.eventMux.Post(RemovedLogEvent{deletedLogs}) + go self.eventMux.Post(RemovedLogsEvent{deletedLogs}) } return nil diff --git a/core/blockchain_test.go b/core/blockchain_test.go index b4ac1696a..1bb5f646d 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -982,7 +982,7 @@ func TestLogReorgs(t *testing.T) { evmux := &event.TypeMux{} blockchain, _ := NewBlockChain(db, FakePow{}, evmux) - subs := evmux.Subscribe(RemovedLogEvent{}) + subs := evmux.Subscribe(RemovedLogsEvent{}) chain, _ := GenerateChain(genesis, db, 2, func(i int, gen *BlockGen) { if i == 1 { tx, err := types.NewContractCreation(gen.TxNonce(addr1), new(big.Int), big.NewInt(1000000), new(big.Int), code).SignECDSA(key1) @@ -1002,7 +1002,7 @@ func TestLogReorgs(t *testing.T) { } ev := <-subs.Chan() - if len(ev.Data.(RemovedLogEvent).Logs) == 0 { + if len(ev.Data.(RemovedLogsEvent).Logs) == 0 { t.Error("expected logs") } } diff --git a/core/events.go b/core/events.go index 1a760c71c..c23206cad 100644 --- a/core/events.go +++ b/core/events.go @@ -30,6 +30,11 @@ type TxPreEvent struct{ Tx *types.Transaction } // TxPostEvent is posted when a transaction has been processed. type TxPostEvent struct{ Tx *types.Transaction } +// PendingLogsEvent is posted pre mining and notifies of pending logs. +type PendingLogsEvent struct { + Logs vm.Logs +} + // NewBlockEvent is posted when a block has been imported. type NewBlockEvent struct{ Block *types.Block } @@ -40,7 +45,7 @@ type NewMinedBlockEvent struct{ Block *types.Block } type RemovedTransactionEvent struct{ Txs types.Transactions } // RemovedLogEvent is posted when a reorg happens -type RemovedLogEvent struct{ Logs vm.Logs } +type RemovedLogsEvent struct{ Logs vm.Logs } // ChainSplit is posted when a new head is detected type ChainSplitEvent struct { |