Skip to content

Commit

Permalink
Merge pull request #5539 from stacks-network/fix/block-validation-ver…
Browse files Browse the repository at this point in the history
…sion

fix: when validating a block, clone the blocks version
  • Loading branch information
obycode authored Dec 8, 2024
2 parents 8c99a12 + 4f5f6f6 commit b93f2f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
- New RPC endpoints
- `/v2/clarity/marf/:marf_key_hash`
- `/v2/clarity/metadata/:principal/:contract_name/:clarity_metadata_key`
- When a proposed block is validated by a node, the block can be validated even when the block version is different than the node's default ([#5539](https://github.com/stacks-network/stacks-core/pull/5539))

### Changed

Expand Down
4 changes: 4 additions & 0 deletions stackslib/src/net/api/postblock_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ impl NakamotoBlockProposal {
}

let mut block = builder.mine_nakamoto_block(&mut tenure_tx);
// Override the block version with the one from the proposal. This must be
// done before computing the block hash, because the block hash includes the
// version in its computation.
block.header.version = self.block.header.version;
let size = builder.get_bytes_so_far();
let cost = builder.tenure_finish(tenure_tx)?;

Expand Down

0 comments on commit b93f2f5

Please sign in to comment.