diff options
| author | Gavin Andresen <[email protected]> | 2013-11-10 18:09:58 -0800 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2013-11-10 18:09:58 -0800 |
| commit | 7d7df381f85112f5d00dc8f164451dea5baa48bb (patch) | |
| tree | 624d282fc308688102fa17c1fd331e99e9ac0720 /src/rpcblockchain.cpp | |
| parent | Merge pull request #3185 from gavinandresen/reject (diff) | |
| parent | Move CCoins-related logic to coins.{cpp.h} (diff) | |
| download | discoin-7d7df381f85112f5d00dc8f164451dea5baa48bb.tar.xz discoin-7d7df381f85112f5d00dc8f164451dea5baa48bb.zip | |
Merge pull request #3199 from sipa/mempoolmove
Cleanup refactoring of coins/mempool
Diffstat (limited to 'src/rpcblockchain.cpp')
| -rw-r--r-- | src/rpcblockchain.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 18e213257..483d8d2e8 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -245,11 +245,13 @@ Value gettxout(const Array& params, bool fHelp) if (n<0 || (unsigned int)n>=coins.vout.size() || coins.vout[n].IsNull()) return Value::null; - ret.push_back(Pair("bestblock", pcoinsTip->GetBestBlock()->GetBlockHash().GetHex())); + std::map<uint256, CBlockIndex*>::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); + CBlockIndex *pindex = it->second; + ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex())); if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT) ret.push_back(Pair("confirmations", 0)); else - ret.push_back(Pair("confirmations", pcoinsTip->GetBestBlock()->nHeight - coins.nHeight + 1)); + ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1)); ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue))); Object o; ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true); |