Skip to content

Ensure coin view database integrity#719

Merged
fassadlr merged 1 commit intostratisproject:release/1.1.0.0from
fassadlr:interfluxlpb
Sep 27, 2021
Merged

Ensure coin view database integrity#719
fassadlr merged 1 commit intostratisproject:release/1.1.0.0from
fassadlr:interfluxlpb

Conversation

@fassadlr
Copy link
Contributor

@fassadlr fassadlr commented Sep 24, 2021

Iain gave an data folder where the node wasnt advancing after startup. After more investigation it seems that when headers are presented, the ProvenHeaderCoinstakeRule header rule fails here:

        private UnspentOutput CheckIfCoinstakeIsSpentOnAnotherChain(ProvenBlockHeader header, PosRuleContext context)
        {
            Transaction coinstake = header.Coinstake;
            TxIn input = coinstake.Inputs[0];

            int? rewindDataIndex = this.PosParent.RewindDataIndexCache.Get(input.PrevOut.Hash, (int)input.PrevOut.N);
            if (!rewindDataIndex.HasValue)
            {
                this.Logger.LogTrace("(-)[NO_REWIND_DATA_INDEX_FOR_INPUT_PREVOUT]");
                context.ValidationContext.InsufficientHeaderInformation = true;
                ConsensusErrors.ReadTxPrevFailedInsufficient.Throw();
            }

I looked at what was in the coin database and saw that there were rewind items that existed in the database that is above chain tip.

To fix this issue on startup I removed those entries and the node continued syncing again.

Copy link
Contributor

@quantumagi quantumagi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Is it possible to detect missing rewind data between the last rewind entry and the tip and maybe catch-up during intialization?

@fassadlr fassadlr merged commit 1ba5981 into stratisproject:release/1.1.0.0 Sep 27, 2021
@fassadlr fassadlr deleted the interfluxlpb branch October 5, 2021 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants