@@ -46,22 +46,23 @@ pub struct TrackedSpendableOutput {
46
46
}
47
47
48
48
impl TrackedSpendableOutput {
49
- fn to_watched_output ( & self ) -> WatchedOutput {
49
+ fn to_watched_output ( & self , cur_hash : BlockHash ) -> WatchedOutput {
50
+ let block_hash = self . status . first_broadcast_hash ( ) . or ( Some ( cur_hash) ) ;
50
51
match & self . descriptor {
51
52
SpendableOutputDescriptor :: StaticOutput { outpoint, output, channel_keys_id : _ } => {
52
53
WatchedOutput {
53
- block_hash : self . status . first_broadcast_hash ( ) ,
54
+ block_hash,
54
55
outpoint : * outpoint,
55
56
script_pubkey : output. script_pubkey . clone ( ) ,
56
57
}
57
58
} ,
58
59
SpendableOutputDescriptor :: DelayedPaymentOutput ( output) => WatchedOutput {
59
- block_hash : self . status . first_broadcast_hash ( ) ,
60
+ block_hash,
60
61
outpoint : output. outpoint ,
61
62
script_pubkey : output. output . script_pubkey . clone ( ) ,
62
63
} ,
63
64
SpendableOutputDescriptor :: StaticPaymentOutput ( output) => WatchedOutput {
64
- block_hash : self . status . first_broadcast_hash ( ) ,
65
+ block_hash,
65
66
outpoint : output. outpoint ,
66
67
script_pubkey : output. output . script_pubkey . clone ( ) ,
67
68
} ,
@@ -372,7 +373,7 @@ where
372
373
) -> Self {
373
374
if let Some ( filter) = chain_data_source. as_ref ( ) {
374
375
for output_info in & outputs {
375
- let watched_output = output_info. to_watched_output ( ) ;
376
+ let watched_output = output_info. to_watched_output ( best_block . block_hash ) ;
376
377
filter. register_output ( watched_output) ;
377
378
}
378
379
}
@@ -506,7 +507,7 @@ where
506
507
let respend_outputs = sweeper_state. outputs . iter_mut ( ) . filter ( |o| filter_fn ( & * * o) ) ;
507
508
for output_info in respend_outputs {
508
509
if let Some ( filter) = self . chain_data_source . as_ref ( ) {
509
- let watched_output = output_info. to_watched_output ( ) ;
510
+ let watched_output = output_info. to_watched_output ( cur_hash ) ;
510
511
filter. register_output ( watched_output) ;
511
512
}
512
513
0 commit comments