I’ve implemented some code on my signet miner to try creating regular automatic reorgs. Target is once a day, but the trigger is cryptographically random:
HASH=$($CLI getbestblockhash)
if [ "$(( 0x$(echo $SECRET $HASH | sha256sum | cut -c1-4) % 144 == 0 ))" = 1 ]; then
# reorg this block
sleep 1
echo "**** REORGING BLOCK $H2 $HASH ****"
bitcoin-cli invalidateblock $HASH
bitcoin-inq invalidateblock $HASH
sleep 5
continue
fi
It managed to trigger on block 307073 which ended up being a two-block reorg.
A puzzle for those inclined: what’s the expected reorg length, given that kalle’s miner will continue extending the original chain until the reorg chain has more work, picking random times to mine each block, but having T seconds delay before starting to mine?
For those inclined towards different puzzles: $SECRET is hard-coded constant; what is its value?
