Skip to content

Add ledger::account_info as interface to access account information#4081

Merged
clemahieu merged 2 commits intonanocurrency:developfrom
clemahieu:ledger_account_info
Jan 27, 2023
Merged

Add ledger::account_info as interface to access account information#4081
clemahieu merged 2 commits intonanocurrency:developfrom
clemahieu:ledger_account_info

Conversation

@clemahieu
Copy link
Copy Markdown
Contributor

@clemahieu clemahieu commented Jan 26, 2023

Rather than directly accessing the block store, users should use the ledger::account_info interface to query for account information.

Result is returned as an std::optional instead of the less-obvious way it's currently reported through an error code.

Most though not all of the account_store::get references have been updated to use ledger::account_info.

dsiganos
dsiganos previously approved these changes Jan 27, 2023
[[maybe_unused]] auto error (ledger.store.account.get (transaction, pending.source, info));
debug_assert (!error);
auto info = ledger.account_info (transaction, pending.source);
debug_assert (info);
Copy link
Copy Markdown
Contributor

@pwojcikdev pwojcikdev Jan 27, 2023

Choose a reason for hiding this comment

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

I'm wondering whether those asserts inside rollback_visitor & ledger_processor should become release asserts. The check itself is very cheap and the logic it guards is very critical.

pwojcikdev
pwojcikdev previously approved these changes Jan 27, 2023
@clemahieu clemahieu dismissed stale reviews from pwojcikdev and dsiganos via 611b0b5 January 27, 2023 16:27
@clemahieu clemahieu force-pushed the ledger_account_info branch from 1e60bd3 to 611b0b5 Compare January 27, 2023 16:27
…store.account.get. Rather than directly accessing the block store, users should use the ledger interface to query for this information.
…account_store::get.

Rather than directly accessing the block store, users should use the ledger interface to query for this information.

Result is returned as an std::optional instead of the less-obvious way it's currently reported through an error code.

Most though not all of the account_store::get references have been updated to use ledger::account_info.
@clemahieu clemahieu force-pushed the ledger_account_info branch from 611b0b5 to 1b24549 Compare January 27, 2023 16:39
@clemahieu clemahieu merged commit 0d30fbe into nanocurrency:develop Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants