fixed the txindex data
This commit is contained in:
parent
737ee8c641
commit
bb240e290b
2 changed files with 7 additions and 4 deletions
|
@ -372,6 +372,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBlockTreeDB::WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos>> &list) {
|
bool CBlockTreeDB::WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos>> &list) {
|
||||||
|
if (list.empty()) return true;
|
||||||
db << "begin";
|
db << "begin";
|
||||||
auto query = db << "INSERT OR REPLACE INTO tx_to_block VALUES(?,?,?,?)";
|
auto query = db << "INSERT OR REPLACE INTO tx_to_block VALUES(?,?,?,?)";
|
||||||
for (auto& kvp: list) {
|
for (auto& kvp: list) {
|
||||||
|
|
|
@ -2088,10 +2088,12 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
|
||||||
if (fJustCheck)
|
if (fJustCheck)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (pindex->pprev != nullptr &&
|
if (pindex->pprev != nullptr) {
|
||||||
!WriteUndoDataForBlock(blockundo, state, pindex, chainparams) &&
|
if (!WriteUndoDataForBlock(blockundo, state, pindex, chainparams))
|
||||||
!pblocktree->WriteTxIndex(vPos))
|
return error("Unable to write to the Undo data block");
|
||||||
return false;
|
if (!pblocktree->WriteTxIndex(vPos))
|
||||||
|
return error("Unable to write to the TX Index");
|
||||||
|
}
|
||||||
|
|
||||||
if (!pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
|
if (!pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||||
pindex->RaiseValidity(BLOCK_VALID_SCRIPTS);
|
pindex->RaiseValidity(BLOCK_VALID_SCRIPTS);
|
||||||
|
|
Loading…
Reference in a new issue