Skip to content

Commit

Permalink
Set backfill sigset create_time to prevent instant checkpoint pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Feb 5, 2024
1 parent 2f1efee commit d46a6ff
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bitcoin/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2375,6 +2375,8 @@ impl CheckpointQueue {
) -> Result<()> {
let mut index = first_index;

let create_time = self.queue.get(0)?.unwrap().create_time();

for script in redeem_scripts {
if index >= self.first_index()? {
index -= 1;
Expand All @@ -2383,6 +2385,7 @@ impl CheckpointQueue {

let (mut sigset, _) = SignatorySet::from_script(&script)?;
sigset.index = index;
sigset.create_time = create_time;
let cp = Checkpoint::new(sigset)?;

self.queue.push_front(cp)?;
Expand Down

0 comments on commit d46a6ff

Please sign in to comment.