unit_tests: add wallet_scanning #9882
Draft
+751
−0
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.
This change adds offline unit testing for
wallet2::process_parsed_blocks(), the main driver of the chain-processing logic inwallet2. The transactions are constructed usingcryptonote::construct_tx_and_get_tx_key, which makes them realistic to pruned transactions that appear in the wild. Thefake_pruned_blockchainmaintains lists ofcryptonote::block_complete_entryandtools::wallet2::parsed_blockstructs for each block, with easy miner transaction adding, automatic assigning of unique output indices for outputs in the block, and correct blockID hashing. The blockchain can also start at an offset, but if it starts at 0, then it uses the real genesis block for that network type.The provided unit test creates one of each transaction type a-h, adds it to the fake blockchain, then calls
wallet2::process_parsed_blocks()on the block data. After each update, it checks that the balance increases according to the amount in the relevant transaction output.Part of upstreaming Carrot.