When listsinceblock
is called with a block hash that belongs to a non-main chain, the system will mistakenly use its relative position in its chain vs the current active chain’s height to determine which transactions should be included.
This patch locates the fork point and uses that as reference instead.
The problem can be observed in the following scenario: with address A
belonging to node n1
in a network with n1
through n4
:
- Split network into two partitions,
n12
andn34
. - Create and send a transaction
tx
fromn3
to addressA
. - Generate 6 blocks on
n1
. Note last block hash as<lastKnownHash>
. - Generate 6 blocks on
n3
. - Merge network into
n1234
. - Generate 1 block on
n3
to activaten34
chain. - Do
listsinceblock <lastKnownHash>
onn1
.
The resulting transaction list should contain tx
, but it does not.