mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
remove block (multi)signature malleability vectors
This commit is contained in:
parent
864b122368
commit
8f92b21e04
1 changed files with 21 additions and 1 deletions
22
src/pow.cpp
22
src/pow.cpp
|
|
@ -61,7 +61,27 @@ bool CheckProof(const CBlockHeader& block, const Consensus::Params& params)
|
|||
{
|
||||
if (block.GetHash() == params.hashGenesisBlock)
|
||||
return true;
|
||||
return GenericVerifyScript(block.proof.solution, block.proof.challenge, SCRIPT_VERIFY_P2SH, block);
|
||||
|
||||
// Some important anti-DoS flags.
|
||||
// Note: Blockhashes do not commit to the proof.
|
||||
// Therefore we may have a signature be mealleated
|
||||
// to stay valid, but cause the block to fail
|
||||
// validation, in this case, block weight.
|
||||
// In that case, the block will be marked as permanently
|
||||
// invalid and not processed.
|
||||
// NOTE: These have only been deemed sufficient for OP_CMS
|
||||
// ANY OTHER SCRIPT TYPE MAY REQUIRE DIFFERENT FLAGS/CONSIDERATIONS
|
||||
// TODO: Better design to not have to worry about script specifics
|
||||
// i.e. exempt block header solution from weight limit
|
||||
unsigned int proof_flags = SCRIPT_VERIFY_P2SH // Just allows P2SH evaluation
|
||||
| SCRIPT_VERIFY_STRICTENC // Minimally-sized DER sigs
|
||||
| SCRIPT_VERIFY_NULLDUMMY // No extra data stuffed into OP_CMS witness
|
||||
| SCRIPT_VERIFY_CLEANSTACK // No extra pushes leftover in witness
|
||||
| SCRIPT_VERIFY_MINIMALDATA // Pushes are minimally-sized
|
||||
| SCRIPT_VERIFY_SIGPUSHONLY // Witness is push-only
|
||||
| SCRIPT_VERIFY_LOW_S // Stop easiest signature fiddling
|
||||
| SCRIPT_VERIFY_WITNESS; // Required for cleanstack eval in VerifyScript
|
||||
return GenericVerifyScript(block.proof.solution, block.proof.challenge, proof_flags, block);
|
||||
}
|
||||
|
||||
bool MaybeGenerateProof(CBlockHeader *pblock, CWallet *pwallet)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue