mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Fail GetTransaction when the block from txindex is not in mapBlockIndex (#3606)
This indicates a previous crash where the TX made it into the txindex but the block was not flushed to disk. When dashd is restarted then, there is a short time where GetTransaction would return a non-existant block, while callers very often assume that the returned block hash is known.
This commit is contained in:
parent
62c3fb5748
commit
a170c649b8
@ -977,6 +977,9 @@ bool GetTransaction(const uint256& hash, CTransactionRef& txOut, const Consensus
|
|||||||
hashBlock = header.GetHash();
|
hashBlock = header.GetHash();
|
||||||
if (txOut->GetHash() != hash)
|
if (txOut->GetHash() != hash)
|
||||||
return error("%s: txid mismatch", __func__);
|
return error("%s: txid mismatch", __func__);
|
||||||
|
if (!mapBlockIndex.count(hashBlock)) {
|
||||||
|
return error("%s: hashBlock %s not in mapBlockIndex", __func__, hashBlock.ToString());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user