Move signature verification functions to CPubKey.
[novacoin.git] / src / script.h
index 00b0525..8dd7ce9 100644 (file)
 
 #include "keystore.h"
 #include "bignum.h"
+#include "base58.h"
 
 typedef std::vector<uint8_t> valtype;
 
 class CTransaction;
+class CBitcoinAddress;
 
 static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
 
@@ -378,7 +380,7 @@ public:
 
     CScript& operator<<(const CPubKey& key)
     {
-        std::vector<uint8_t> vchKey = key.Raw();
+        std::vector<uint8_t> vchKey(key.begin(), key.end());
         return (*this) << vchKey;
     }
 
@@ -583,8 +585,8 @@ public:
     bool HasCanonicalPushes() const;
 
     void SetDestination(const CTxDestination& address);
-    void SetDestination(const CPubKey& R, CPubKey& pubKeyVariant);
-    void SetMultisig(int nRequired, const std::vector<CKey>& keys);
+    void SetAddress(const CBitcoinAddress& dest);
+    void SetMultisig(int nRequired, const std::vector<CPubKey>& keys);
 
 
     void PrintHex() const
@@ -635,9 +637,11 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::v
 int ScriptSigArgsExpected(txnouttype t, const std::vector<std::vector<unsigned char> >& vSolutions);
 bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType);
 isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
-isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest);
+//isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest);
+isminetype IsMine(const CKeyStore& keystore, const CBitcoinAddress& dest);
 void ExtractAffectedKeys(const CKeyStore &keystore, const CScript& scriptPubKey, std::vector<CKeyID> &vKeys);
 bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet);
+bool ExtractAddress(const CKeyStore &keystore, const CScript& scriptPubKey, CBitcoinAddress& addressRet);
 bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
 bool SignSignature(const CKeyStore& keystore, const CScript& fromPubKey, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL);
 bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL);