Page MenuHomePhabricator

tweak auto-unparking message
ClosedPublic

Authored by markblundeberg on Tue, Jan 14, 08:53.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABC638e4857a2c4: tweak auto-unparking message
Summary
  1. UnparkBlock will only get called once per chain, i.e., we only see one

log message regardless of how many blocks got unparked on that chain,
since UnparkBlock will unpark all ancestors of pindexTest and it
results in everything from genesis to pindexNew being unparked. So
"unpark chain" rather than "unpark block" makes more sense as a message,
as I'd expect to see the latter one for every single block.

  1. Ideally when this message happens we should be in a state where

pindexNew == pindexTest, however it might somehow happen that this
isn't the case and we should print the tip of the chain that is being
unparked.

Test Plan

ninja check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markblundeberg created this revision.Tue, Jan 14, 08:53
Herald added a reviewer: Restricted Project. · View Herald TranscriptTue, Jan 14, 08:53
Fabien added a subscriber: Fabien.Tue, Jan 14, 13:11
Fabien added inline comments.
src/validation.cpp
2620 ↗(On Diff #15434)

Is there any non-bogus case where pindexNew can be different from pindexTest ?

markblundeberg added inline comments.Tue, Jan 14, 13:36
src/validation.cpp
2620 ↗(On Diff #15434)

It would be pretty rare it seems to me.

Example 1:

A -- B -- C*

You start out with tip on C.

A -- B -- C*
 \
  -- D

Block D comes in and gets parked because it's a 'deep reorg'.

A -- B* -- C
 \
  -- D

You invalidate C for some reason, so now your tip is on B

A -- B* -- C
 \
  -- D -- E

Block E comes in and is not parked during AcceptBlock because it wouldn't count as a 'deep reorg' anymore. Then FindMostWorkChain looks at E and sees it's the longest chain, so it unparks D.

Example 2: Something similar to the above happens because you shut down your node and restarted with -parkdeepreorg turned off -- the new incoming block on alt chain doesn't get parked.

Example 3: Probably can make something weird happen using parkblock RPC call.

(and I think this could also happen with multiple blocks on each chain)

deadalnix accepted this revision.Tue, Jan 14, 23:58
This revision is now accepted and ready to land.Tue, Jan 14, 23:58