Skip to content

Commit 7f321a5

Browse files
committed
f Register outputs with Filter in read
1 parent f9b68e3 commit 7f321a5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lightning/src/util/sweep.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,17 @@ where
776776
kv_store,
777777
logger,
778778
) = args;
779-
let sweeper_state = Readable::read(reader)?;
779+
let state = SweeperState::read(reader)?;
780+
let best_block = state.best_block;
781+
782+
if let Some(filter) = chain_data_source.as_ref() {
783+
for output_info in &state.outputs {
784+
let watched_output = output_info.to_watched_output(best_block.block_hash);
785+
filter.register_output(watched_output);
786+
}
787+
}
788+
789+
let sweeper_state = Mutex::new(state);
780790
Ok(Self {
781791
sweeper_state,
782792
broadcaster,
@@ -816,6 +826,14 @@ where
816826
) = args;
817827
let state = SweeperState::read(reader)?;
818828
let best_block = state.best_block;
829+
830+
if let Some(filter) = chain_data_source.as_ref() {
831+
for output_info in &state.outputs {
832+
let watched_output = output_info.to_watched_output(best_block.block_hash);
833+
filter.register_output(watched_output);
834+
}
835+
}
836+
819837
let sweeper_state = Mutex::new(state);
820838
Ok((
821839
best_block,

0 commit comments

Comments
 (0)