Throw error in wallet if ReadBlockFromDisk fails
This commit is contained in:
@@ -1032,7 +1032,10 @@ int CWallet::VerifyAndSetInitialWitness(const CBlockIndex* pindex, bool witnessO
|
|||||||
//Cycle through blocks and transactions building sapling tree until the commitment needed is reached
|
//Cycle through blocks and transactions building sapling tree until the commitment needed is reached
|
||||||
const CBlock* pblock;
|
const CBlock* pblock;
|
||||||
CBlock block;
|
CBlock block;
|
||||||
ReadBlockFromDisk(block, pblockindex, 1);
|
if (!ReadBlockFromDisk(block, pblockindex, 1)) {
|
||||||
|
throw std::runtime_error(
|
||||||
|
strprintf("Cannot read block height %d (%s) from disk", pindex->GetHeight(), pindex->GetBlockHash().GetHex()));
|
||||||
|
}
|
||||||
pblock = █
|
pblock = █
|
||||||
|
|
||||||
for (const CTransaction& tx : block.vtx) {
|
for (const CTransaction& tx : block.vtx) {
|
||||||
@@ -1102,7 +1105,10 @@ void CWallet::BuildWitnessCache(const CBlockIndex* pindex, bool witnessOnly)
|
|||||||
|
|
||||||
//Cycle through blocks and transactions building sapling tree until the commitment needed is reached
|
//Cycle through blocks and transactions building sapling tree until the commitment needed is reached
|
||||||
CBlock block;
|
CBlock block;
|
||||||
ReadBlockFromDisk(block, pblockindex, 1);
|
if (!ReadBlockFromDisk(block, pblockindex, 1)) {
|
||||||
|
throw std::runtime_error(
|
||||||
|
strprintf("Cannot read block height %d (%s) from disk", pindex->GetHeight(), pindex->GetBlockHash().GetHex()));
|
||||||
|
}
|
||||||
|
|
||||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||||
|
|
||||||
@@ -2721,7 +2727,11 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
|||||||
|
|
||||||
CBlock block;
|
CBlock block;
|
||||||
bool involvesMe = false;
|
bool involvesMe = false;
|
||||||
ReadBlockFromDisk(block, pindex,1);
|
if (!ReadBlockFromDisk(block, pindex,1)) {
|
||||||
|
throw std::runtime_error(
|
||||||
|
strprintf("Cannot read block height %d (%s) from disk", pindex->GetHeight(), pindex->GetBlockHash().GetHex()));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(CTransaction& tx, block.vtx)
|
BOOST_FOREACH(CTransaction& tx, block.vtx)
|
||||||
{
|
{
|
||||||
if (AddToWalletIfInvolvingMe(tx, &block, fUpdate)) {
|
if (AddToWalletIfInvolvingMe(tx, &block, fUpdate)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user