Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Fix jsonrpc ledger balance for entry v2 #1808

Merged
merged 1 commit into from
Sep 30, 2022

Conversation

PaulVMo
Copy link
Contributor

@PaulVMo PaulVMo commented Aug 19, 2022

Update the JSONRPC call for account balances to use ledger entry v2 when the token_version is set to 2 (or higher). This allows the JSONRPC call to continue to pull current balance since the MOBILE / subnetworks went were activated.

<<"balance">> => blockchain_ledger_entry_v1:balance(Entry)
}.
format_ledger_balance(Addr, Entry, Ledger) ->
case blockchain_ledger_v1:config(token_version, Ledger) of
Copy link
Member

Choose a reason for hiding this comment

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

You could call blockchain_ledger_v1:versioned_entry_mod_and_entries_cf/1 and not have to do the token_version check here by hand. So this function can be reduced to something like this:

{EntryMod, _} = blockchain_ledger_v1:versioned_entry_mod_and_entries_cf(Ledger),
#{<<"nonce">> = EntryMod:nonce(Entry), ...} 

@Vagabond Vagabond merged commit d56f1fc into helium:master Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants