kaspanet / rusty-kaspa

Kaspa full-node and related libraries in the Rust programming language. This is a stable version at the initial rollout phases.
ISC License
371 stars 118 forks source link

TN11 bug fix: activate mass hashing when modifying a cached block template #476

Open michaelsutton opened 1 month ago

michaelsutton commented 1 month ago

Fixes a TN11 bug where transaction mass field hashing was not activated when modifying a cached block template. This produced invalid blocks when two miners with different addresses were connected to the same node, frequently triggering this code path and resulting in many bad Merkle root blocks

michaelsutton commented 3 weeks ago

Perhaps a better way to handle this is to move more of modify_block_template logic to within consensus where storage mass activation is already accessible and can be checked. It feels slightly weird that consensus sensitive code is in the mempool block builder

coderofstuff commented 3 weeks ago

Perhaps a better way to handle this is to move more of modify_block_template logic to within consensus where storage mass activation is already accessible and can be checked. It feels slightly weird that consensus sensitive code is in the mempool block builder

I agree that it feels a bit off that consensus sensitive logic isn't in consensus. I would think a better way is for consensus to have something like consensus.calc_hash_merkle_root and from within consensus, decide whether to use the HF version or not.