Conversation
Prior commits relate to supporting a limited size network. It looks like there is an edge case where it is possible for a hash to be in the mapIndex, without a pindex. If a block with such a hash is tried to be Accepted, the AcceptBlockHeader returns true but with a null pindex, and AcceptBlock fails. The code says that this indicates that the hash was added from a blockheader without a block, but I didn’t see that happening. In any case, it happens a lot on a 2 node network. So much so that if one node is just mining, before too long the other node will not accept the block and once that happens, no subsequent block would work as the prior block is missing. Of course, with more nodes, these blocks will be around a lot more and likely it won’t be such an issue, but not so sure that it doesn’t require restarting the node to get it back on track again. These prior commits implement a KOMODO_LIMITED_NETWORKSIZE logic where if it sees that a block has come in which is in the mapIndex but has no pindex, it automatically addtoblockindex. There is one edge case still left where both the current block being processed and its previous block are in this limbo state. Since the pindex is not mapped to the block, it is problematic to retrieve the CBlock for the pprev and without the valid pprev the pindex will have a null pprev and no nHeight set. It is possible that all the other code will properly deal with such a case and automatically fix it, but rather than rely on that, in such a case the automatic addtoblockindex is not done. A node in such a state would need to exit and restart or somehow fill in the data from other nodes. From what I can tell, the above is the main reason why the PoS/PoW networks were having problems staying in sync. Since even with one mining node, it was just a matter of time before the other node got stuck, with more than one mining node we end up with independent forks that won’t reconcile until the node is restarted.
DeckerSU
pushed a commit
to DeckerSU/komodo
that referenced
this pull request
Nov 7, 2023
bump version [0.8.1]
miketout
pushed a commit
to miketout/VerusCoin
that referenced
this pull request
Jul 29, 2025
Release v1.2.9-2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior commits relate to supporting a limited size network.
It looks like there is an edge case where it is possible for a hash to
be in the mapIndex, without a pindex. If a block with such a hash is
tried to be Accepted, the AcceptBlockHeader returns true but with a
null pindex, and AcceptBlock fails.
The code says that this indicates that the hash was added from a
blockheader without a block, but I didn’t see that happening. In any
case, it happens a lot on a 2 node network. So much so that if one node
is just mining, before too long the other node will not accept the
block and once that happens, no subsequent block would work as the
prior block is missing.
Of course, with more nodes, these blocks will be around a lot more and
likely it won’t be such an issue, but not so sure that it doesn’t
require restarting the node to get it back on track again.
These prior commits implement a KOMODO_LIMITED_NETWORKSIZE logic where
if it sees that a block has come in which is in the mapIndex but has no
pindex, it automatically addtoblockindex.
There is one edge case still left where both the current block being
processed and its previous block are in this limbo state. Since the
pindex is not mapped to the block, it is problematic to retrieve the
CBlock for the pprev and without the valid pprev the pindex will have a
null pprev and no nHeight set. It is possible that all the other code
will properly deal with such a case and automatically fix it, but
rather than rely on that, in such a case the automatic addtoblockindex
is not done.
A node in such a state would need to exit and restart or somehow fill
in the data from other nodes.
From what I can tell, the above is the main reason why the PoS/PoW
networks were having problems staying in sync. Since even with one
mining node, it was just a matter of time before the other node got
stuck, with more than one mining node we end up with independent forks
that won’t reconcile until the node is restarted.