X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fscript.cpp;h=c97c8946a72d70f6004b7974d946229dab1714aa;hb=e10fa48ea2c24f9647668aafa1f9caa48a51de2f;hp=26b7c941f428169e910ccea6c0dbe8ae239712c4;hpb=e5e4c598dc43bb5e01b3a30aaeb2dfc9376bd7b4;p=novacoin.git diff --git a/src/script.cpp b/src/script.cpp index 26b7c94..c97c894 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -294,7 +294,7 @@ bool IsDERSignature(const valtype &vchSig, bool fWithHashType, bool fCheckLow) { if (5 + nLenR >= vchSig.size()) return error("Non-canonical signature: S length misplaced"); unsigned int nLenS = vchSig[5+nLenR]; - if ((unsigned long)(nLenR + nLenS + (fWithHashType ? 7 : 6)) != vchSig.size()) + if ((nLenR + nLenS + (fWithHashType ? 7 : 6)) != vchSig.size()) return error("Non-canonical signature: R+S length mismatch"); const unsigned char *R = &vchSig[4]; @@ -1195,7 +1195,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector SMALLDATA_SWITCH_TIME) + if (fTestNet || GetTime() > SMALLDATA_SWITCH_TIME) { // Malleable pubkey tx hack, sender provides generated pubkey combined with R parameter. The R parameter is dropped before checking a signature. mTemplates.insert(make_pair(TX_PUBKEY_DROP, CScript() << OP_PUBKEY << OP_PUBKEY << OP_DROP << OP_CHECKSIG)); @@ -1507,14 +1507,9 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey) case TX_PUBKEY_DROP: { CPubKey key = CPubKey(vSolutions[0]); - if (keystore.HaveKey(key.GetID())) + CPubKey R = CPubKey(vSolutions[1]); + if (keystore.CheckOwnership(key, R)) return MINE_SPENDABLE; - else - { - CPubKey R = CPubKey(vSolutions[1]); - if (keystore.CheckOwnership(key, R)) - return MINE_SPENDABLE; - } } break; case TX_PUBKEYHASH: @@ -1559,7 +1554,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) if (!Solver(scriptPubKey, whichType, vSolutions)) return false; - if (whichType == TX_PUBKEY || whichType == TX_PUBKEY_DROP) + if (whichType == TX_PUBKEY) { addressRet = CPubKey(vSolutions[0]).GetID(); return true; @@ -1624,7 +1619,10 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto if (!Solver(scriptPubKey, typeRet, vSolutions)) return false; if (typeRet == TX_NULL_DATA) + { + nRequiredRet = 0; return true; + } if (typeRet == TX_MULTISIG) { @@ -1638,6 +1636,8 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto else { nRequiredRet = 1; + if (typeRet == TX_PUBKEY_DROP) + return true; CTxDestination address; if (!ExtractDestination(scriptPubKey, address)) return false; @@ -1972,6 +1972,13 @@ void CScript::SetDestination(const CTxDestination& dest) boost::apply_visitor(CScriptVisitor(this), dest); } +void CScript::SetDestination(const CPubKey& R, CPubKey& pubKeyVariant) +{ + this->clear(); + *this << pubKeyVariant << R << OP_DROP << OP_CHECKSIG; +} + + void CScript::SetMultisig(int nRequired, const std::vector& keys) { this->clear();