@@ -1873,31 +1873,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1873
1873
( local_txn, ( commitment_txid, watch_outputs) )
1874
1874
}
1875
1875
1876
- /// Generate a spendable output event when closing_transaction get registered onchain.
1877
- fn check_spend_closing_transaction ( & self , tx : & Transaction ) -> Option < SpendableOutputDescriptor > {
1878
- if tx. input [ 0 ] . sequence == 0xFFFFFFFF && !tx. input [ 0 ] . witness . is_empty ( ) && tx. input [ 0 ] . witness . last ( ) . unwrap ( ) . len ( ) == 71 {
1879
- match self . key_storage {
1880
- Storage :: Local { ref shutdown_pubkey, .. } => {
1881
- let our_channel_close_key_hash = Hash160 :: hash ( & shutdown_pubkey. serialize ( ) ) ;
1882
- let shutdown_script = Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( & our_channel_close_key_hash[ ..] ) . into_script ( ) ;
1883
- for ( idx, output) in tx. output . iter ( ) . enumerate ( ) {
1884
- if shutdown_script == output. script_pubkey {
1885
- return Some ( SpendableOutputDescriptor :: StaticOutput {
1886
- outpoint : BitcoinOutPoint { txid : tx. txid ( ) , vout : idx as u32 } ,
1887
- output : output. clone ( ) ,
1888
- } ) ;
1889
- }
1890
- }
1891
- }
1892
- Storage :: Watchtower { .. } => {
1893
- //TODO: we need to ensure an offline client will generate the event when it
1894
- // comes back online after only the watchtower saw the transaction
1895
- }
1896
- }
1897
- }
1898
- None
1899
- }
1900
-
1901
1876
/// Used by ChannelManager deserialization to broadcast the latest local state if its copy of
1902
1877
/// the Channel was out-of-date. You may use it to get a broadcastable local toxic tx in case of
1903
1878
/// fallen-behind, i.e when receiving a channel_reestablish with a proof that our remote side knows
@@ -1988,11 +1963,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1988
1963
}
1989
1964
claimable_outpoints. append ( & mut new_outpoints) ;
1990
1965
}
1991
- if !funding_txo. is_none ( ) && claimable_outpoints. is_empty ( ) {
1992
- if let Some ( spendable_output) = self . check_spend_closing_transaction ( & tx) {
1993
- spendable_outputs. push ( spendable_output) ;
1994
- }
1995
- }
1996
1966
} else {
1997
1967
if let Some ( & ( commitment_number, _) ) = self . remote_commitment_txn_on_chain . get ( & prevout. txid ) {
1998
1968
let ( mut new_outpoints, new_outputs_option) = self . check_spend_remote_htlc ( & tx, commitment_number, height) ;
@@ -2323,6 +2293,20 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
2323
2293
output : outp. clone ( ) ,
2324
2294
} ) ;
2325
2295
}
2296
+ } else {
2297
+ match self . key_storage {
2298
+ Storage :: Local { ref shutdown_pubkey, .. } => {
2299
+ let our_channel_close_key_hash = Hash160 :: hash ( & shutdown_pubkey. serialize ( ) ) ;
2300
+ let shutdown_script = Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( & our_channel_close_key_hash[ ..] ) . into_script ( ) ;
2301
+ if shutdown_script == outp. script_pubkey {
2302
+ return Some ( SpendableOutputDescriptor :: StaticOutput {
2303
+ outpoint : BitcoinOutPoint { txid : tx. txid ( ) , vout : i as u32 } ,
2304
+ output : outp. clone ( ) ,
2305
+ } ) ;
2306
+ }
2307
+ } ,
2308
+ _ => { }
2309
+ }
2326
2310
}
2327
2311
}
2328
2312
None
0 commit comments