Page MenuHomePhabricator

tweak auto-unparking message
ClosedPublic

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

Details

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
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien added inline comments.
src/validation.cpp
2620 ↗(On Diff #15434)

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

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)

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