Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockwatch: Sync to latest block available on each polling interval #564

Merged
merged 35 commits into from Dec 5, 2019

Conversation

@fabioberger
Copy link
Contributor

fabioberger commented Nov 28, 2019

Fixes: #561

In addition, this PR also:

  • Removes the StartBlockDepth config since with fast-sync, we always want to start the BlockWatcher at the latest block.
  • Immediately fetches the first block when blockWatcher.Watch() is called instead of waiting for the first Ticker tick.
  • Ensures that we only emit block events if our state of the chain has moved forward in terms of block number. If an error is thrown during a block-reorg for instance, all state changes are reverted to the last known good state. This reduces the amount of block event thrash and gives us this nice property that block events always leave the node at a higher block number which we can use to asynchronously update fillableTakerAssetAmounts in the DB in a subsequent PR.
  • Persists changes to the stored block headers in the DB only once finalized. Updates are done atomically using transactions.
@fabioberger fabioberger requested a review from albrow Nov 28, 2019
fabioberger added 10 commits Nov 28, 2019
…heckpoint or reset once the changes are considered final
…into refactor/blockWatcher
ethereum/blockwatch/block_watcher.go Outdated Show resolved Hide resolved
ethereum/blockwatch/simple_stack.go Outdated Show resolved Hide resolved
ethereum/dbstack/db_stack_test.go Outdated Show resolved Hide resolved
ethereum/blockwatch/block_watcher.go Show resolved Hide resolved
ethereum/blockwatch/simple_stack.go Outdated Show resolved Hide resolved
ethereum/dbstack/db_stack_test.go Show resolved Hide resolved
ethereum/dbstack/db_stack.go Show resolved Hide resolved
ethereum/blockwatch/block_watcher.go Outdated Show resolved Hide resolved
ethereum/blockwatch/block_watcher.go Show resolved Hide resolved
ethereum/blockwatch/block_watcher.go Outdated Show resolved Hide resolved
@fabioberger fabioberger force-pushed the refactor/blockWatcher branch from 00ca05d to e70b98a Dec 3, 2019
@albrow albrow self-requested a review Dec 3, 2019
ethereum/blockwatch/block_watcher.go Outdated Show resolved Hide resolved
ethereum/simplestack/simple_stack.go Outdated Show resolved Hide resolved
ethereum/simplestack/simple_stack.go Outdated Show resolved Hide resolved
ethereum/simplestack/simple_stack.go Outdated Show resolved Hide resolved
ethereum/simplestack/simple_stack.go Show resolved Hide resolved
ethereum/simplestack/simple_stack.go Outdated Show resolved Hide resolved
ethereum/blockwatch/block_watcher.go Show resolved Hide resolved
@albrow albrow self-requested a review Dec 5, 2019
Copy link
Member

albrow left a comment

Just a few small comments this round. Looking pretty good!

ethereum/blockwatch/block_watcher.go Outdated Show resolved Hide resolved
ethereum/dbstack/db_stack.go Outdated Show resolved Hide resolved
@albrow albrow self-requested a review Dec 5, 2019
@albrow
albrow approved these changes Dec 5, 2019
@fabioberger fabioberger merged commit 88ca410 into development Dec 5, 2019
2 checks passed
2 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
continuous-integration/drone/push Build is passing
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.