SiaFoundation / core

Core packages for the Sia project
MIT License
51 stars 8 forks source link

types: Fix (*V2Transaction).DeepCopy mutating V2StorageProof #172

Closed lukechampine closed 3 months ago

lukechampine commented 3 months ago

@n8maninger noticed a flipped conditional in validateV2FileContracts; after fixing it, I updated TestValidateV2Block to update the ChainIndexElement proofs, but the test still failed -- with commitment hash mismatch, which is a weird error. Further investigation revealed that V2Block.EncodeTo was mutating the block. Specifically, it was nil-ing out the V2StorageProof history proof, which is why this wasn't caught earlier: since the test wasn't updating the proofs in the first place, they were always nil, so EncodeTo didn't affect them. Anyway, this cascade of failures has all been fixed now :P