Add missing include to script.h
[novacoin.git] / src / script.h
index 22a6020..b880838 100644 (file)
@@ -5,10 +5,13 @@
 #define H_BITCOIN_SCRIPT
 
 #include "base58.h"
+#include "keystore.h"
 
 #include <string>
 #include <vector>
 
+#include <boost/foreach.hpp>
+
 class CTransaction;
 
 enum
@@ -485,7 +488,7 @@ public:
     {
         // I'm not sure if this should push the script or concatenate scripts.
         // If there's ever a use for pushing a script onto a script, delete this member fn
-        assert(("warning: pushing a CScript onto a CScript with << is probably not intended, use + to concatenate", false));
+        assert(!"warning: pushing a CScript onto a CScript with << is probably not intended, use + to concatenate");
         return *this;
     }
 
@@ -621,7 +624,7 @@ public:
     }
 
 
-    uint160 GetBitcoinAddressHash160() const
+    CBitcoinAddress GetBitcoinAddress() const
     {
         opcodetype opcode;
         std::vector<unsigned char> vch;
@@ -633,36 +636,18 @@ public:
         if (!GetOp(pc, opcode, vch) || opcode != OP_EQUALVERIFY) return 0;
         if (!GetOp(pc, opcode, vch) || opcode != OP_CHECKSIG) return 0;
         if (pc != end()) return 0;
-        return hash160;
+        return CBitcoinAddress(hash160);
     }
 
-    std::string GetBitcoinAddress() const
-    {
-        uint160 hash160 = GetBitcoinAddressHash160();
-        if (hash160 == 0)
-            return "";
-        return Hash160ToAddress(hash160);
-    }
-
-    void SetBitcoinAddress(const uint160& hash160)
+    void SetBitcoinAddress(const CBitcoinAddress& address)
     {
         this->clear();
-        *this << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
+        *this << OP_DUP << OP_HASH160 << address.GetHash160() << OP_EQUALVERIFY << OP_CHECKSIG;
     }
 
     void SetBitcoinAddress(const std::vector<unsigned char>& vchPubKey)
     {
-        SetBitcoinAddress(Hash160(vchPubKey));
-    }
-
-    bool SetBitcoinAddress(const std::string& strAddress)
-    {
-        this->clear();
-        uint160 hash160;
-        if (!AddressToHash160(strAddress, hash160))
-            return false;
-        SetBitcoinAddress(hash160);
-        return true;
+        SetBitcoinAddress(CBitcoinAddress(vchPubKey));
     }
 
 
@@ -707,12 +692,10 @@ public:
 
 
 
-uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType);
 bool IsStandard(const CScript& scriptPubKey);
-bool IsMine(const CScript& scriptPubKey);
-bool ExtractPubKey(const CScript& scriptPubKey, bool fMineOnly, std::vector<unsigned char>& vchPubKeyRet);
-bool ExtractHash160(const CScript& scriptPubKey, uint160& hash160Ret);
-bool SignSignature(const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL, CScript scriptPrereq=CScript());
+bool IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
+bool ExtractAddress(const CScript& scriptPubKey, const CKeyStore* pkeystore, CBitcoinAddress& addressRet);
+bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL, CScript scriptPrereq=CScript());
 bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, int nHashType=0);
 
 #endif