move new zindex stuff to the end of serialization and more logging

This commit is contained in:
Duke Leto
2019-12-18 15:20:31 -05:00
parent 97df4d43ec
commit aef3f37b0f
2 changed files with 23 additions and 15 deletions

View File

@@ -607,20 +607,6 @@ public:
READWRITE(VARINT(nStatus));
READWRITE(VARINT(nTx));
// These values only serialized when -zindex enabled
if((s.GetType() & SER_DISK) && fZindex) {
READWRITE(VARINT(nShieldedTx));
READWRITE(VARINT(nShieldingTx));
READWRITE(VARINT(nDeshieldingTx));
READWRITE(VARINT(nFullyShieldedTx));
READWRITE(VARINT(nShieldedPayments));
READWRITE(VARINT(nShieldingPayments));
READWRITE(VARINT(nDeshieldingPayments));
READWRITE(VARINT(nFullyShieldedPayments));
READWRITE(VARINT(nNotarizations));
}
if (nStatus & (BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO))
READWRITE(VARINT(nFile));
@@ -668,6 +654,21 @@ public:
READWRITE(nNotaryPay);
READWRITE(segid);
}
// These values only serialized when -zindex enabled
if((s.GetType() & SER_DISK) && fZindex) {
READWRITE(VARINT(nShieldedTx));
READWRITE(VARINT(nShieldingTx));
READWRITE(VARINT(nDeshieldingTx));
READWRITE(VARINT(nFullyShieldedTx));
READWRITE(VARINT(nPayments));
READWRITE(VARINT(nNotarizations));
READWRITE(VARINT(nShieldedPayments));
READWRITE(VARINT(nShieldingPayments));
READWRITE(VARINT(nDeshieldingPayments));
READWRITE(VARINT(nFullyShieldedPayments));
}
}
uint256 GetBlockHash() const

View File

@@ -692,18 +692,23 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
boost::scoped_ptr<CDBIterator> pcursor(NewIterator());
pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256()));
fprintf(stderr,"%s: Seeked cursor to block index\n",__FUNCTION__);
// Load mapBlockIndex
while (pcursor->Valid()) {
fprintf(stderr,"%s: Valid cursor\n",__FUNCTION__);
boost::this_thread::interruption_point();
std::pair<char, uint256> key;
if (pcursor->GetKey(key) && key.first == DB_BLOCK_INDEX) {
fprintf(stderr,"%s: Found DB_BLOCK_INDEX\n",__FUNCTION__);
CDiskBlockIndex diskindex;
if (pcursor->GetValue(diskindex)) {
// Construct block index object
CBlockIndex* pindexNew = InsertBlockIndex(diskindex.GetBlockHash());
fprintf(stderr,"%s: Creating CBlockIndex...\n",__FUNCTION__);
CBlockIndex* pindexNew = InsertBlockIndex(diskindex.GetBlockHash());
pindexNew->pprev = InsertBlockIndex(diskindex.hashPrev);
pindexNew->SetHeight(diskindex.GetHeight());
fprintf(stderr,"%s: Setting CBlockIndex height...\n",__FUNCTION__);
pindexNew->nFile = diskindex.nFile;
pindexNew->nDataPos = diskindex.nDataPos;
pindexNew->nUndoPos = diskindex.nUndoPos;
@@ -720,8 +725,10 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
pindexNew->nTx = diskindex.nTx;
pindexNew->nSproutValue = diskindex.nSproutValue;
pindexNew->nSaplingValue = diskindex.nSaplingValue;
fprintf(stderr,"%s: Setting CBlockIndex details...\n",__FUNCTION__);
pindexNew->segid = diskindex.segid;
pindexNew->nNotaryPay = diskindex.nNotaryPay;
pindexNew->nPayments = diskindex.nPayments;
pindexNew->nShieldedTx = diskindex.nShieldedTx;
pindexNew->nShieldedPayments = diskindex.nShieldedPayments;
pindexNew->nShieldingTx = diskindex.nShieldingTx;