Extract ledger::block_find for block lookup given hash and root#5045
Merged
pwojcikdev merged 1 commit intonanocurrency:developfrom Mar 20, 2026
Merged
Extract ledger::block_find for block lookup given hash and root#5045pwojcikdev merged 1 commit intonanocurrency:developfrom
ledger::block_find for block lookup given hash and root#5045pwojcikdev merged 1 commit intonanocurrency:developfrom
Conversation
Test Results for Commit 5e69c72Pull Request 5045: Results Test Case Results
Last updated: 2026-03-20 02:35:40 UTC |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extracts the block-lookup logic used by request_aggregator::aggregate into a reusable nano::ledger::block_find helper, preserving the existing three-step search strategy while reducing duplication and adding targeted unit coverage.
Changes:
- Add
nano::ledger::block_find(transaction, hash, root)to centralize lookup by hash, then by root successor, then by root-as-account open block. - Replace the duplicated lookup lambda in
request_aggregator::aggregatewith a call toledger.block_find. - Add comprehensive unit tests covering lookup precedence and edge cases (including epoch open and hash/account collisions).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| nano/secure/ledger.hpp | Declares the new ledger::block_find API. |
| nano/secure/ledger.cpp | Implements the extracted block lookup strategy. |
| nano/node/request_aggregator.cpp | Uses ledger.block_find instead of an inline lambda. |
| nano/core_test/ledger.cpp | Adds unit tests validating lookup behavior and precedence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the duplicated block lookup lambda in request_aggregator::aggregate and replaces it with a call to the newly extracted ledger::block_find, which implements the same three-step search strategy (hash, successor of root, open block of root-as-account).