diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2011-10-03 13:05:43 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2011-12-19 12:40:19 -0500 |
commit | e679ec969c8b22c676ebb10bea1038f6c8f13b33 (patch) | |
tree | c584f1a152c376ca0df93261d447c5b719449508 /src/wallet.cpp | |
parent | cc40ba2151a627b6da9af4932e0bee58e69aacb5 (diff) |
OP_EVAL implementation
OP_EVAL is a new opcode that evaluates an item on the stack as a script.
It enables a new type of bitcoin address that needs an arbitrarily
complex script to redeem.
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r-- | src/wallet.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index a662111d49..5d44b1fb8d 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -42,6 +42,15 @@ bool CWallet::AddCryptedKey(const vector<unsigned char> &vchPubKey, const vector return false; } +bool CWallet::AddCScript(const uint160 &hash, const std::vector<unsigned char>& data) +{ + if (!CCryptoKeyStore::AddCScript(hash, data)) + return false; + if (!fFileBacked) + return true; + return CWalletDB(strWalletFile).WriteCScript(hash, data); +} + bool CWallet::Unlock(const SecureString& strWalletPassphrase) { if (!IsLocked()) @@ -374,6 +383,16 @@ int64 CWallet::GetDebit(const CTxIn &txin) const return 0; } +bool CWallet::IsChange(const CTxOut& txout) const +{ + CBitcoinAddress address; + if (ExtractAddress(txout.scriptPubKey, this, address) && !address.IsScript()) + CRITICAL_BLOCK(cs_wallet) + if (!mapAddressBook.count(address)) + return true; + return false; +} + int64 CWalletTx::GetTxTime() const { return nTimeReceived; @@ -443,8 +462,7 @@ void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, l nFee = nDebit - nValueOut; } - // Sent/received. Standard client will never generate a send-to-multiple-recipients, - // but non-standard clients might (so return a list of address/amount pairs) + // Sent/received. BOOST_FOREACH(const CTxOut& txout, vout) { CBitcoinAddress address; |