Changeset View
Changeset View
Standalone View
Standalone View
src/coins.cpp
// Copyright (c) 2012-2016 The Bitcoin Core developers | // Copyright (c) 2012-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <coins.h> | #include <coins.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <logging.h> | |||||
#include <memusage.h> | #include <memusage.h> | ||||
#include <random.h> | #include <random.h> | ||||
#include <version.h> | #include <version.h> | ||||
#include <cassert> | #include <cassert> | ||||
bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { | bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | for (uint32_t n = 0; n < MAX_OUTPUTS_PER_TX; n++) { | ||||
const Coin &alternate = view.AccessCoin(COutPoint(txid, n)); | const Coin &alternate = view.AccessCoin(COutPoint(txid, n)); | ||||
if (!alternate.IsSpent()) { | if (!alternate.IsSpent()) { | ||||
return alternate; | return alternate; | ||||
} | } | ||||
} | } | ||||
return coinEmpty; | return coinEmpty; | ||||
} | } | ||||
bool CCoinsViewErrorCatcher::GetCoin(const COutPoint &outpoint, | |||||
Coin &coin) const { | |||||
try { | |||||
return CCoinsViewBacked::GetCoin(outpoint, coin); | |||||
} catch (const std::runtime_error &e) { | |||||
for (auto f : m_err_callbacks) { | |||||
f(); | |||||
} | |||||
LogPrintf("Error reading from database: %s\n", e.what()); | |||||
// Starting the shutdown sequence and returning false to the caller | |||||
// would be interpreted as 'entry not found' (as opposed to unable to | |||||
// read data), and could lead to invalid interpretation. Just exit | |||||
// immediately, as we can't continue anyway, and all writes should be | |||||
// atomic. | |||||
std::abort(); | |||||
} | |||||
} |