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

blockchain: don't rely on BlockHeightByHash for prune height calculations #2122

Merged

Commits on Feb 16, 2024

  1. blockchain: return error in db.View instead of t.Fatal

    Calling t.Fatal inside db.View makes the test hang on failures.  Return
    the error and call t.Fatal outside of db.View avoids this.
    kcalvinalvin committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    8836219 View commit details
    Browse the repository at this point in the history
  2. blockchain: add case for pruning stale blocks

    Pruning stale blocks will make the block validation fail for the block
    that the prune was triggered on as BlockHeightByHash will not return the
    height for blocks that are not in the main chain.
    
    We add a test case to ensure that the test fails in the above case.
    kcalvinalvin committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    a0c9e3b View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. blockchain: don't rely on BlockHeightByHash for prune height

    calculations
    
    Since BlockHeightByHash only returns the heights for blocks that are in
    the main chain, when a block that is stale gets pruned, this will cause
    an error in the block height lookup and cause an error in block
    processing.
    
    Look up the node directly from the index and if the node isn't found,
    just skip that node. For utxoCache.lastFlushHash, if that isn't found,
    just force a flush.
    kcalvinalvin committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    f2caa8f View commit details
    Browse the repository at this point in the history