X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fscript.cpp;h=2212fe1f58bd7846cad4730c04e8971dc82ef21c;hb=85088c59fcf0c562afcdb805c35d732de2a49ccb;hp=040c90698eb070b7c97ad905ceb6679739d7ddfb;hpb=5af8418fee23af1be2065382dda14a97034fdf56;p=novacoin.git diff --git a/src/script.cpp b/src/script.cpp index 040c906..2212fe1 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1647,6 +1647,13 @@ isminetype IsMine(const CKeyStore &keystore, const CTxDestination& dest) return IsMine(keystore, script); } +isminetype IsMine(const CKeyStore &keystore, const CBitcoinAddress& dest) +{ + CScript script; + script.SetAddress(dest); + return IsMine(keystore, script); +} + isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey) { vector vSolutions; @@ -2136,13 +2143,25 @@ void CScript::SetDestination(const CTxDestination& dest) boost::apply_visitor(CScriptVisitor(this), dest); } -void CScript::SetDestination(const CPubKey& R, CPubKey& pubKeyVariant) +void CScript::SetAddress(const CBitcoinAddress& dest) { this->clear(); - *this << pubKeyVariant << R << OP_DROP << OP_CHECKSIG; + if (dest.IsScript()) + *this << OP_HASH160 << dest.GetData() << OP_EQUAL; + else if (dest.IsPubKey()) + *this << OP_DUP << OP_HASH160 << dest.GetData() << OP_EQUALVERIFY << OP_CHECKSIG; + else if (dest.IsPair()) { + // Pubkey pair address, going to generate + // new one-time public key. + CMalleablePubKey mpk; + if (!mpk.setvch(dest.GetData())) + return; + CPubKey R, pubKeyVariant; + mpk.GetVariant(R, pubKeyVariant); + *this << pubKeyVariant << R << OP_DROP << OP_CHECKSIG; + } } - void CScript::SetMultisig(int nRequired, const std::vector& keys) { this->clear();