diff options
author | Pieter Wuille <sipa@ulyssis.org> | 2013-11-05 02:27:39 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2013-11-10 19:22:53 +0100 |
commit | 84674082b0c4cfcdd54fb97a29bc841aa7f691c2 (patch) | |
tree | 87fb3462d81b84c0d4a64cb5eca7ab8c64895091 /src/rpcblockchain.cpp | |
parent | f76c122e2eac8ef66f69d142231bd33c88a24c50 (diff) |
Make CCoinsView use block hashes instead of indices
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 18e213257e..483d8d2e8d 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); |