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

Update confirmation height in another thread #1877

Merged
merged 56 commits into from Apr 24, 2019

Conversation

@wezrule
Copy link
Collaborator

commented Apr 2, 2019

Currently the confirmation height is updated on io threads, and if it touches a long chain it can take a very long time (30 minutes) because it can update pretty much the whole ledger. A different approach is now taken. When a block being confirmed, we go down to the lowest block in the chain which has not been confirmed and store each receive block along the way. We now start at the lowest (before it would have been the highest) receive and iterate to the source accounts until we get to a chain where there are no more unconfirmed receives, storing this in a collection of pending writes , working our way from the bottom upwards.

API changes:
RPC stats -> counters. confirmed_block_count shows the number of blocks confirmed during node start-up
RPC stats -> objects. confirmation_height_processor -> receive_source_pairs. The current number of receive-source pairs that still await iterative confirmation for the current block being confirmed. pending_confirmation_height -> pending - The number of top level block hashes in the queue awaiting confirmation
RPC {"action":"confirmation_height_currently_processing"} this will return the hash if any which is currently being processed. To be marked as unstable/debug.
CLI: --debug_cemented_block_count iterates over all account chains and sums up the confirmation heights (can take a little bit). For the first time the node is launched this will be 1 more than that in stats -> counters due to the implicitly confirmed genesis block.

@wezrule wezrule added this to the V19.0 milestone Apr 2, 2019

@wezrule wezrule self-assigned this Apr 2, 2019

@wezrule wezrule changed the title Update confirmation height to another thread Update confirmation height in another thread Apr 2, 2019

@zhyatt zhyatt requested review from argakiig, SergiySW and cryptocode and removed request for SergiySW Apr 2, 2019

@zhyatt zhyatt requested a review from SergiySW Apr 4, 2019

@zhyatt zhyatt added this to CP3 (2019-04-10) in V19 Apr 7, 2019

@wezrule wezrule force-pushed the wezrule:confirmation_height_processor branch from 6195e41 to dda6ca3 Apr 8, 2019

@wezrule wezrule force-pushed the wezrule:confirmation_height_processor branch from de4a441 to c2b2068 Apr 19, 2019

@SergiySW
Copy link
Collaborator

left a comment

LGTM

wezrule added some commits Apr 22, 2019

wezrule added some commits Apr 24, 2019

@wezrule wezrule merged commit 0b9007f into nanocurrency:master Apr 24, 2019

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@wezrule wezrule deleted the wezrule:confirmation_height_processor branch Apr 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.