Remove pubsub and replace w/ polling head of chain (#122)

* Rename geth package structs to not be prefaced with package name

* No longer need to dump schema since Travis uses migrate

* Rearrange history package

* Removed double request for receipt from block rewards

* Remove Listener + Observers and Replace w/ Polling Head

* Potential Short term Issue w/ Infura (ignore these tests for now)
This commit is contained in:
Matt K
2018-01-05 11:55:00 -06:00
committed by GitHub
parent 095cb1e7b7
commit 6decf0b54b
38 changed files with 368 additions and 1034 deletions
+8 -32
View File
@@ -66,30 +66,6 @@ var _ = Describe("Populating blocks", func() {
Expect(err).To(HaveOccurred())
})
It("updates the repository with a range of blocks w/in sliding window ", func() {
blockchain := fakes.NewBlockchainWithBlocks([]core.Block{
{Number: 1},
{Number: 2},
{Number: 3},
{Number: 4},
{Number: 5},
})
repository := repositories.NewInMemory()
repository.CreateOrUpdateBlock(blockchain.GetBlockByNumber(5))
history.UpdateBlocksWindow(blockchain, repository, 2)
Expect(repository.BlockCount()).To(Equal(3))
Expect(repository.HandleBlockCallCount).To(Equal(3))
})
It("Generates a range of int64", func() {
numberOfBlocksCreated := history.MakeRange(0, 5)
expected := []int64{0, 1, 2, 3, 4}
Expect(numberOfBlocksCreated).To(Equal(expected))
})
It("returns the number of blocks created", func() {
blockchain := fakes.NewBlockchainWithBlocks([]core.Block{
{Number: 4},
@@ -105,19 +81,19 @@ var _ = Describe("Populating blocks", func() {
Expect(numberOfBlocksCreated).To(Equal(2))
})
It("returns the window size", func() {
window := history.Window{1, 3, 10}
Expect(window.Size()).To(Equal(2))
})
It("returns the number of largest block", func() {
It("updates the repository with a range of blocks w/in the range ", func() {
blockchain := fakes.NewBlockchainWithBlocks([]core.Block{
{Number: 1},
{Number: 2},
{Number: 3},
{Number: 4},
{Number: 5},
})
maxBlockNumber := blockchain.LastBlock()
repository := repositories.NewInMemory()
Expect(maxBlockNumber.Int64()).To(Equal(int64(3)))
history.RetrieveAndUpdateBlocks(blockchain, repository, history.MakeRange(2, 5))
Expect(repository.BlockCount()).To(Equal(3))
Expect(repository.CreateOrUpdateBlockCallCount).To(Equal(3))
})
})