From 9958f531a04f41133dfb10ff14c1422164ec1080 Mon Sep 17 00:00:00 2001 From: MASM fan Date: Sat, 8 Nov 2014 00:27:43 +0400 Subject: [PATCH] Fix miner issues --- src/kernel.cpp | 2 +- src/kernel.h | 2 +- src/wallet.cpp | 10 +++++----- src/wallet.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/kernel.cpp b/src/kernel.cpp index 3b8e051..19a391e 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -393,7 +393,7 @@ bool ScanForStakeKernelHash(MetaMap &mapMeta, KernelSearchSettings &settings, Co { uint256 hashProofOfStake = 0; - // txid => ((txindex, (tx, vout.n)), (block, modifier)) + // (txid, vout.n) => ((txindex, (tx, vout.n)), (block, modifier)) for(MetaMap::const_iterator meta_item = mapMeta.begin(); meta_item != mapMeta.end(); meta_item++) { if (!fCoinsDataActual) diff --git a/src/kernel.h b/src/kernel.h index 0fd9407..5cfa946 100644 --- a/src/kernel.h +++ b/src/kernel.h @@ -46,7 +46,7 @@ typedef std::set > CoinsSet; // Preloaded coins metadata // txid => ((txindex, (tx, vout.n)), (block, modifier)) -typedef std::map >, std::pair > > MetaMap; +typedef std::map, std::pair >, std::pair > > MetaMap; // Scan given coins set for kernel solution bool ScanForStakeKernelHash(MetaMap &mapMeta, KernelSearchSettings &settings, CoinsSet::value_type &kernelcoin, unsigned int &nTimeTx, unsigned int &nBlockTime); diff --git a/src/wallet.cpp b/src/wallet.cpp index f127744..dc1000c 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1670,8 +1670,8 @@ bool CWallet::GetStakeWeight(const CKeyStore& keystore, uint64& nMinWeight, uint continue; // Add meta record - // txid => ((txindex, (tx, vout.n)), (block, modifier)) - mapMeta[pcoin->first->GetHash()] = make_pair(make_pair(txindex, *pcoin), make_pair(block, nStakeModifier)); + // (txid, vout.n) => ((txindex, (tx, vout.n)), (block, modifier)) + mapMeta[make_pair(pcoin->first->GetHash(), pcoin->second)] = make_pair(make_pair(txindex, *pcoin), make_pair(block, nStakeModifier)); if (fDebug) printf("Load coin: %s\n", pcoin->first->GetHash().GetHex().c_str()); @@ -1686,7 +1686,7 @@ bool CWallet::GetStakeWeight(const CKeyStore& keystore, uint64& nMinWeight, uint } - // txid => ((txindex, (tx, vout.n)), (block, modifier)) + // (txid, vout.n) => ((txindex, (tx, vout.n)), (block, modifier)) for(MetaMap::const_iterator meta_item = mapMeta.begin(); meta_item != mapMeta.end(); meta_item++) { // Get coin @@ -1904,7 +1904,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int // Add meta record // txid => ((txindex, (tx, vout.n)), (block, modifier)) - mapMeta[pcoin->first->GetHash()] = make_pair(make_pair(txindex, *pcoin), make_pair(block, nStakeModifier)); + mapMeta[make_pair(pcoin->first->GetHash(), pcoin->second)] = make_pair(make_pair(txindex, *pcoin), make_pair(block, nStakeModifier)); if (fDebug) printf("Load coin: %s\n", pcoin->first->GetHash().GetHex().c_str()); @@ -2000,7 +2000,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int if (nCredit == 0 || nCredit > nBalance - nReserveBalance) return false; - // txid => ((txindex, (tx, vout.n)), (block, modifier)) + // (txid, vout.n) => ((txindex, (tx, vout.n)), (block, modifier)) for(MetaMap::const_iterator meta_item = mapMeta.begin(); meta_item != mapMeta.end(); meta_item++) { // Get coin diff --git a/src/wallet.h b/src/wallet.h index a9be672..3522cc8 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -81,7 +81,7 @@ private: int nWalletMaxVersion; // selected coins metadata - std::map >, std::pair > > mapMeta; + std::map, std::pair >, std::pair > > mapMeta; public: mutable CCriticalSection cs_wallet; -- 1.7.1