@@ -701,10 +701,10 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
701701
702702 // ... and merge in other signatures:
703703 BOOST_FOREACH (const CTransaction& txv, txVariants)
704- sigdata = CombineSignatures (prevPubKey, MutableTransactionNoWithdrawsSignatureChecker (&mergedTx, i, amount), sigdata, DataFromTransaction (txv, i));
704+ sigdata = CombineSignatures (prevPubKey, MutableTransactionSignatureChecker (&mergedTx, i, amount), sigdata, DataFromTransaction (txv, i));
705705 UpdateTransaction (mergedTx, i, sigdata);
706706
707- if (!VerifyScript (txin.scriptSig , prevPubKey, (mergedTx.wit .vtxinwit .size () > i) ? &mergedTx.wit .vtxinwit [i].scriptWitness : NULL , STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionNoWithdrawsSignatureChecker (&mergedTx, i, amount)))
707+ if (!VerifyScript (txin.scriptSig , prevPubKey, (mergedTx.wit .vtxinwit .size () > i) ? &mergedTx.wit .vtxinwit [i].scriptWitness : NULL , STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker (&mergedTx, i, amount)))
708708 fComplete = false ;
709709 }
710710
@@ -716,58 +716,6 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
716716 tx = mergedTx;
717717}
718718
719- static void MutateTxPeginSign (CMutableTransaction& tx, const std::string& flagStr)
720- {
721- if (!registers.count (" peginkeys" ))
722- throw std::runtime_error (" peginkeys register variable must be set." );
723- UniValue keysObj = registers[" peginkeys" ];
724-
725- if (!keysObj.isObject ())
726- throw std::runtime_error (" peginkeysObjs must be an object" );
727- std::map<std::string,UniValue::VType> types = boost::assign::map_list_of (" contract" ,UniValue::VSTR)(" txoutproof" ,UniValue::VSTR)(" tx" ,UniValue::VSTR)(" nout" ,UniValue::VNUM);
728- if (!keysObj.checkObject (types))
729- throw std::runtime_error (" peginkeysObjs internal object typecheck fail" );
730-
731- std::vector<unsigned char > contractData (ParseHexUV (keysObj[" contract" ], " contract" ));
732- std::vector<unsigned char > txoutproofData (ParseHexUV (keysObj[" txoutproof" ], " txoutproof" ));
733- std::vector<unsigned char > txData (ParseHexUV (keysObj[" tx" ], " tx" ));
734- int nOut = atoi (keysObj[" nout" ].getValStr ());
735-
736- if (contractData.size () != 40 )
737- throw std::runtime_error (" contract must be 40 bytes" );
738-
739- CDataStream ssProof (txoutproofData,SER_NETWORK, PROTOCOL_VERSION);
740- Sidechain::Bitcoin::CMerkleBlock merkleBlock;
741- ssProof >> merkleBlock;
742-
743- CDataStream ssTx (txData, SER_NETWORK, PROTOCOL_VERSION);
744- Sidechain::Bitcoin::CTransactionRef txBTCRef;
745- ssTx >> txBTCRef;
746- Sidechain::Bitcoin::CTransaction txBTC (*txBTCRef);
747-
748- std::vector<uint256> transactionHashes;
749- std::vector<unsigned int > transactionIndices;
750- if (!CheckBitcoinProof (merkleBlock.header .GetHash (), merkleBlock.header .nBits ) ||
751- merkleBlock.txn .ExtractMatches (transactionHashes, transactionIndices) != merkleBlock.header .hashMerkleRoot ||
752- transactionHashes.size () != 1 ||
753- transactionHashes[0 ] != txBTC.GetHash ())
754- throw std::runtime_error (" txoutproof is invalid or did not match tx" );
755-
756- if (nOut < 0 || (unsigned int ) nOut >= txBTC.vout .size ())
757- throw std::runtime_error (" nout must be >= 0, < txout count" );
758-
759- CScript scriptSig;
760- scriptSig << contractData;
761- scriptSig.PushWithdraw (txoutproofData);
762- scriptSig.PushWithdraw (txData);
763- scriptSig << nOut;
764-
765- // TODO: Verify the withdraw proof
766- for (unsigned int i = 0 ; i < tx.vin .size (); i++) {
767- tx.vin [i].scriptSig = scriptSig;
768- }
769- }
770-
771719class Secp256k1Init
772720{
773721 ECCVerifyHandle globalVerifyHandle;
@@ -815,17 +763,13 @@ static void MutateTx(CMutableTransaction& tx, const std::string& command,
815763 } else if (command == " blind" ) {
816764 if (!ecc) { ecc.reset (new Secp256k1Init ()); }
817765 MutateTxBlind (tx, commandVal);
818- } else if (command == " peginsign" )
819- MutateTxPeginSign (tx, commandVal);
820-
821- else if (command == " load" )
766+ } else if (command == " load" ) {
822767 RegisterLoad (commandVal);
823-
824- else if (command == " set" )
768+ } else if (command == " set" ) {
825769 RegisterSet (commandVal);
826-
827- else
770+ } else {
828771 throw std::runtime_error (" unknown command" );
772+ }
829773}
830774
831775static void OutputTxJSON (const CTransaction& tx)
0 commit comments