@@ -2297,11 +2297,6 @@ bool BitcoindRPCCheck(const bool init)
22972297/* Takes federation redeeem script and adds HMAC_SHA256(pubkey, witnessProgram) as a tweak to each pubkey */
22982298CScript calculate_contract (const CScript& federationRedeemScript, const CScript& witnessProgram) {
22992299 CScript scriptDestination (federationRedeemScript);
2300- int version;
2301- std::vector<unsigned char > program;
2302- if (!witnessProgram.IsWitnessProgram (version, program)) {
2303- assert (false );
2304- }
23052300 txnouttype type;
23062301 std::vector<std::vector<unsigned char > > solutions;
23072302 // Sanity check fedRedeemScript
@@ -2395,11 +2390,9 @@ bool IsValidPeginWitness(const CScriptWitness& pegin_witness, const COutPoint& p
23952390 }
23962391 uint256 gen_hash (stack[2 ]);
23972392
2398- // Get witness program
2399- CScript witness_program (stack[3 ].begin (), stack[3 ].end ());
2400- int version = -1 ;
2401- std::vector<unsigned char > witnessProgram;
2402- if (!witness_program.IsWitnessProgram (version, witnessProgram)) {
2393+ // Get claim_script, sanity check size
2394+ CScript claim_script (stack[3 ].begin (), stack[3 ].end ());
2395+ if (claim_script.size () > 100 ) {
24032396 return false ;
24042397 }
24052398
@@ -2461,7 +2454,7 @@ bool IsValidPeginWitness(const CScriptWitness& pegin_witness, const COutPoint& p
24612454 }
24622455
24632456 // Check that the witness program matches the p2ch on the transaction output
2464- CScript tweaked_fedpegscript = calculate_contract (Params ().GetConsensus ().fedpegScript , witness_program );
2457+ CScript tweaked_fedpegscript = calculate_contract (Params ().GetConsensus ().fedpegScript , claim_script );
24652458
24662459 // Check against expected p2sh output
24672460 CScriptID expectedP2SH (tweaked_fedpegscript);
0 commit comments