You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-checkblocks now takes a numeric argument: the number of blocks that must
be verified at the end of the chain. Default is 2500, and 0 means all
blocks.
-checklevel specifies how thorough the verification must be:
0: only check whether the block exists on disk
1: verify block validity (default)
2: verify transaction index validity
3: check transaction hashes
4: check whether spent txouts were spent within the main chain
5: check whether all prevouts are marked spent
6: check whether spent txouts were spent by a valid transaction that consumes them
printf("LoadBlockIndex(): *** found bad spend at %d, hashBlock=%s, hashTx=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str(), hashTx.ToString().c_str());
644
+
pindexFork = pindex->pprev;
645
+
}
646
+
// check level 6: check whether spent txouts were spent by a valid transaction that consume them
647
+
if (nCheckLevel>5)
648
+
{
649
+
CTransaction txSpend;
650
+
if (!txSpend.ReadFromDisk(txpos))
651
+
{
652
+
printf("LoadBlockIndex(): *** cannot read spending transaction of %s:%i from disk\n", hashTx.ToString().c_str(), nOutput);
653
+
pindexFork = pindex->pprev;
654
+
}
655
+
elseif (!txSpend.CheckTransaction())
656
+
{
657
+
printf("LoadBlockIndex(): *** spending transaction of %s:%i is invalid\n", hashTx.ToString().c_str(), nOutput);
658
+
pindexFork = pindex->pprev;
659
+
}
660
+
else
661
+
{
662
+
boolfFound = false;
663
+
BOOST_FOREACH(const CTxIn &txin, txSpend.vin)
664
+
if (txin.prevout.hash == hashTx && txin.prevout.n == nOutput)
665
+
fFound = true;
666
+
if (!fFound)
667
+
{
668
+
printf("LoadBlockIndex(): *** spending transaction of %s:%i does not spend it\n", hashTx.ToString().c_str(), nOutput);
669
+
pindexFork = pindex->pprev;
670
+
}
671
+
}
672
+
}
673
+
}
674
+
nOutput++;
675
+
}
676
+
}
677
+
// check level 5: check whether all prevouts are marked spent
678
+
if (nCheckLevel>4)
679
+
BOOST_FOREACH(const CTxIn &txin, tx.vin)
680
+
{
681
+
CTxIndex txindex;
682
+
if (ReadTxIndex(txin.prevout.hash, txindex))
683
+
if (txindex.vSpent.size()-1 < txin.prevout.n || txindex.vSpent[txin.prevout.n].IsNull())
684
+
{
685
+
printf("LoadBlockIndex(): *** found unspent prevout %s:%i in %s\n", txin.prevout.hash.ToString().c_str(), txin.prevout.n, hashTx.ToString().c_str());
0 commit comments