As of the changes in this PR, was able to recreate the txhashset on a new node syncing from a single testnet client on a closed network. Also ensures that the PIBD process can continue where it left off when the grin process is killed and restarted.
Note that the code isn't currently moving on the sync state to the next (validation) phase; that will be the focus of the next PR.
Specific Changes:
'Fix' for pmmr backend failing to flush prune list on file sync. This omission may not have mattered earlier as the prune list was only updated on compaction, but this flush is needed to deal with killing and resuming a node that's in the process of syncing via pibd.
Addition of PIBD_HEAD to database to keep track of the state of PIBD reconstruction.
Modification to startup code to check for existence of PIBD head, and don't attempt rollback to regular head when PIBD is underway (essentially allowing PIBD to continue)
Function to rewind all mmrs to the position of the last inserted leaf on startup
Add validation thread to Desegmenter that saves the last full block header represented by the state of the PIBD trees. This will ultimately trigger validation to occur while PIBD download is in process.
As of the changes in this PR, was able to recreate the txhashset on a new node syncing from a single testnet client on a closed network. Also ensures that the PIBD process can continue where it left off when the grin process is killed and restarted.
Note that the code isn't currently moving on the sync state to the next (validation) phase; that will be the focus of the next PR.
Specific Changes:
PIBD_HEAD
to database to keep track of the state of PIBD reconstruction.