Skip to content

Conversation

@jeffro256
Copy link
Contributor

This change adds offline unit testing for wallet2::process_parsed_blocks(), the main driver of the chain-processing logic in wallet2. The transactions are constructed using cryptonote::construct_tx_and_get_tx_key, which makes them realistic to pruned transactions that appear in the wild. The fake_pruned_blockchain maintains lists of cryptonote::block_complete_entry and tools::wallet2::parsed_block structs 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.

This change adds offline unit testing for `wallet2::process_parsed_blocks()`, the main driver of the chain-processing logic in `wallet2`.
The transactions are constructed using `cryptonote::construct_tx_and_get_tx_key`, which makes them realistic to pruned transactions that appear in the wild.
The `fake_pruned_blockchain` maintains lists of `cryptonote::block_complete_entry` and `tools::wallet2::parsed_block` structs 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.

Part of upstreaming Carrot.
@tobtoht tobtoht added this to the fcmp++ hf milestone Apr 3, 2025
@jeffro256 jeffro256 marked this pull request as draft April 3, 2025 14:57
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.

3 participants