diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2011-07-05 16:42:32 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2011-07-17 12:07:59 +0200 |
commit | 03fbd7904903928b0d1c8542a3d597aaf5bdd31b (patch) | |
tree | 562344a9b651ea1b2cc3f7ffd348377e5bed6090 /src/wallet.cpp | |
parent | 133ccbe4087514501dec1f7496c62489437f0db8 (diff) |
get rid of mapPubKeys
Make CKeyStore's interface work on uint160's instead of pubkeys, so
no separate global mapPubKeys is necessary anymore.
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r-- | src/wallet.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index 2ee918fdab..ba5018639a 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -124,7 +124,6 @@ public: bool CWallet::EncryptWallet(const string& strWalletPassphrase) { - CRITICAL_BLOCK(cs_mapPubKeys) CRITICAL_BLOCK(cs_KeyStore) CRITICAL_BLOCK(cs_vMasterKey) CRITICAL_BLOCK(cs_pwalletdbEncryption) @@ -439,10 +438,8 @@ void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, l string address; uint160 hash160; vector<unsigned char> vchPubKey; - if (ExtractHash160(txout.scriptPubKey, hash160)) + if (ExtractHash160(txout.scriptPubKey, pwallet, hash160)) address = Hash160ToAddress(hash160); - else if (ExtractPubKey(txout.scriptPubKey, NULL, vchPubKey)) - address = PubKeyToAddress(vchPubKey); else { printf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n", @@ -1136,7 +1133,7 @@ int CWallet::LoadWallet(bool& fFirstRunRet) return nLoadWalletRet; fFirstRunRet = vchDefaultKey.empty(); - if (!HaveKey(vchDefaultKey)) + if (!HaveKey(Hash160(vchDefaultKey))) { // Create new keyUser and set as default key RandAddSeedPerfmon(); @@ -1263,7 +1260,7 @@ void CWallet::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool) setKeyPool.erase(setKeyPool.begin()); if (!walletdb.ReadPool(nIndex, keypool)) throw runtime_error("ReserveKeyFromKeyPool() : read failed"); - if (!HaveKey(keypool.vchPubKey)) + if (!HaveKey(Hash160(keypool.vchPubKey))) throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool"); assert(!keypool.vchPubKey.empty()); printf("keypool reserve %"PRI64d"\n", nIndex); |