Add ability to populate missing blocks
* The command populates up to the highest known block number
* The anticipated use case is that the listener will be running
in parallel to the populateBlocks command
* This will mean that the listener is responsible for picking up
new blocks, and the populateBlocks command is reposible for
historical blocks
* Reformat SQL statements
This commit is contained in:
@@ -14,11 +14,12 @@ var _ = Describe("Reading from the Geth blockchain", func() {
|
||||
|
||||
var listener blockchain_listener.BlockchainListener
|
||||
var observer *fakes.BlockchainObserver
|
||||
var blockchain *geth.GethBlockchain
|
||||
|
||||
BeforeEach(func() {
|
||||
observer = fakes.NewFakeBlockchainObserver()
|
||||
cfg := config.NewConfig("private")
|
||||
blockchain := geth.NewGethBlockchain(cfg.Client.IPCPath)
|
||||
blockchain = geth.NewGethBlockchain(cfg.Client.IPCPath)
|
||||
observers := []core.BlockchainObserver{observer}
|
||||
listener = blockchain_listener.NewBlockchainListener(blockchain, observers)
|
||||
})
|
||||
@@ -43,4 +44,14 @@ var _ = Describe("Reading from the Geth blockchain", func() {
|
||||
close(done)
|
||||
}, 10)
|
||||
|
||||
It("retrieves the genesis block and first block", func(done Done) {
|
||||
genesisBlock := blockchain.GetBlockByNumber(int64(0))
|
||||
firstBlock := blockchain.GetBlockByNumber(int64(1))
|
||||
|
||||
Expect(genesisBlock.Number).To(Equal(int64(0)))
|
||||
Expect(firstBlock.Number).To(Equal(int64(1)))
|
||||
|
||||
close(done)
|
||||
}, 10)
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user