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
Contributor

@wezrule wezrule 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 the quality improvements This item indicates the need for or supplies changes that improve maintainability label Apr 2, 2019
@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 April 2, 2019 18:26
@zhyatt zhyatt requested a review from SergiySW April 4, 2019 14:02
@wezrule wezrule force-pushed the confirmation_height_processor branch from 6195e41 to dda6ca3 Compare April 8, 2019 09:11
@wezrule wezrule force-pushed the confirmation_height_processor branch from de4a441 to c2b2068 Compare April 19, 2019 14:50
Copy link
Contributor

@SergiySW SergiySW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wezrule wezrule merged commit 0b9007f into nanocurrency:master Apr 24, 2019
@wezrule wezrule deleted the confirmation_height_processor branch April 24, 2019 08:27
@zhyatt
Copy link
Collaborator

zhyatt commented Jul 11, 2019

@wezrule Can you help review the stats RPC documentation and help suggest updates? https://docs.nano.org/commands/rpc-protocol/#stats and https://docs.nano.org/running-a-node/troubleshooting/#statistics-from-rpc. Looks like we may want to combine and possibly expand some pieces, not sure. The other RPC and CLI command in this ticket look good in the docs. Another related stats ticket: #1955

@wezrule
Copy link
Contributor Author

wezrule commented Jul 11, 2019

@zhatt it was quite out of date, have added the missing stats.
nanocurrency/nano-docs#47

@zhyatt zhyatt removed the documentation This item indicates the need for or supplies updated or expanded documentation label Jul 11, 2019
@zhyatt
Copy link
Collaborator

zhyatt commented Jul 11, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality improvements This item indicates the need for or supplies changes that improve maintainability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants