Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet: add tests for the chain state and fix markState #870

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

nodech
Copy link
Contributor

@nodech nodech commented Nov 2, 2023

This is part of review for this: #622

Only adds test cases to the codebase related to chain state. Does not fix/change anything.

Covers discovered bug which is currently skipped. There's bug related to corruption but it's currently skipped as it's not solved.

More discussion on the issue.

@coveralls
Copy link

coveralls commented Nov 2, 2023

Coverage Status

coverage: 68.585% (-0.01%) from 68.596%
when pulling 2601f3c on nodech:wallet-test-chainstate
into 6446828 on handshake-org:master.

@nodech nodech requested a review from rithvikvibhu November 2, 2023 13:03
@nodech nodech added wallet part of the codebase tests part of the codebase patch Release version labels Nov 2, 2023
@nodech
Copy link
Contributor Author

nodech commented Nov 3, 2023

From latest commit comment - fixes two issues:

  • On close/crash of walletdb on add block wdb state would have
    incorrect state for the startHeight/startHash and mark. WalletDB
    could end up having incorrect startHeight/startHash for the rest
    of the walletDB until rescan before height. Check the
    wallet-chainstate-test case for corruption.
  • On the specific height where the walletDB received first
    transaction, state.height would also be incorrect (only for one
    block).

@nodech nodech changed the title Wallet: add tests for the chain state Wallet: add tests for the chain state and fix markState Nov 3, 2023
Fixes two markState issues:
  - On close/crash of walletdb on add block wdb state would have
    incorrect state for the startHeight/startHash and mark. WalletDB
    could end up having incorrect startHeight/startHash for the rest
    of the walletDB until rescan before height. Check the
    wallet-chainstate-test case for corruption.
  - On the specific height where the walletDB received first
    transaction, state.height would also be incorrect (only for one
    block).
@nodech nodech force-pushed the wallet-test-chainstate branch from bed5f09 to 2601f3c Compare November 3, 2023 09:26
@nodech nodech added this to the hsd 7.0.0 milestone Nov 3, 2023
Copy link
Member

@rithvikvibhu rithvikvibhu left a comment

Choose a reason for hiding this comment

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

Love the test! Feels like it repeats a lot, but very easy to read

@nodech nodech merged commit 5955e91 into handshake-org:master Dec 4, 2023
6 checks passed
@nodech nodech deleted the wallet-test-chainstate branch December 4, 2023 11:05
@nodech nodech mentioned this pull request Nov 29, 2024
@nodech nodech mentioned this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Release version tests part of the codebase wallet part of the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants