@@ -147,14 +147,15 @@ pub struct SimpleManyChannelMonitor<Key> {
147
147
}
148
148
149
149
impl < Key : Send + cmp:: Eq + hash:: Hash > ChainListener for SimpleManyChannelMonitor < Key > {
150
- fn block_connected ( & self , header : & BlockHeader , height : u32 , txn_matched : & [ & Transaction ] , _indexes_of_txn_matched : & [ u32 ] ) {
150
+
151
+ fn block_connected ( & self , header : & BlockHeader , height : u32 , txn_matched : & [ Transaction ] , _indexes_of_txn_matched : & [ u32 ] ) {
151
152
let block_hash = header. bitcoin_hash ( ) ;
152
153
let mut new_events: Vec < events:: Event > = Vec :: with_capacity ( 0 ) ;
153
154
let mut htlc_updated_infos = Vec :: new ( ) ;
154
155
{
155
156
let mut monitors = self . monitors . lock ( ) . unwrap ( ) ;
156
157
for monitor in monitors. values_mut ( ) {
157
- let ( txn_outputs, spendable_outputs, mut htlc_updated) = monitor. block_connected ( txn_matched, height, & block_hash, & * self . broadcaster , & * self . fee_estimator ) ;
158
+ let ( txn_outputs, spendable_outputs, mut htlc_updated) = monitor. block_connected ( txn_matched. clone ( ) , height, & block_hash, & * self . broadcaster , & * self . fee_estimator ) ;
158
159
if spendable_outputs. len ( ) > 0 {
159
160
new_events. push ( events:: Event :: SpendableOutputs {
160
161
outputs : spendable_outputs,
@@ -2113,7 +2114,7 @@ impl ChannelMonitor {
2113
2114
}
2114
2115
}
2115
2116
2116
- fn block_connected ( & mut self , txn_matched : & [ & Transaction ] , height : u32 , block_hash : & Sha256dHash , broadcaster : & BroadcasterInterface , fee_estimator : & FeeEstimator ) -> ( Vec < ( Sha256dHash , Vec < TxOut > ) > , Vec < SpendableOutputDescriptor > , Vec < ( HTLCSource , Option < PaymentPreimage > , PaymentHash ) > ) {
2117
+ fn block_connected ( & mut self , txn_matched : & [ Transaction ] , height : u32 , block_hash : & Sha256dHash , broadcaster : & BroadcasterInterface , fee_estimator : & FeeEstimator ) -> ( Vec < ( Sha256dHash , Vec < TxOut > ) > , Vec < SpendableOutputDescriptor > , Vec < ( HTLCSource , Option < PaymentPreimage > , PaymentHash ) > ) {
2117
2118
let mut watch_outputs = Vec :: new ( ) ;
2118
2119
let mut spendable_outputs = Vec :: new ( ) ;
2119
2120
let mut htlc_updated = Vec :: new ( ) ;
@@ -2135,14 +2136,14 @@ impl ChannelMonitor {
2135
2136
} ;
2136
2137
if funding_txo. is_none ( ) || ( prevout. txid == funding_txo. as_ref ( ) . unwrap ( ) . 0 . txid && prevout. vout == funding_txo. as_ref ( ) . unwrap ( ) . 0 . index as u32 ) {
2137
2138
if ( tx. input [ 0 ] . sequence >> 8 * 3 ) as u8 == 0x80 && ( tx. lock_time >> 8 * 3 ) as u8 == 0x20 {
2138
- let ( remote_txn, new_outputs, mut spendable_output) = self . check_spend_remote_transaction ( tx, height, fee_estimator) ;
2139
+ let ( remote_txn, new_outputs, mut spendable_output) = self . check_spend_remote_transaction ( & tx, height, fee_estimator) ;
2139
2140
txn = remote_txn;
2140
2141
spendable_outputs. append ( & mut spendable_output) ;
2141
2142
if !new_outputs. 1 . is_empty ( ) {
2142
2143
watch_outputs. push ( new_outputs) ;
2143
2144
}
2144
2145
if txn. is_empty ( ) {
2145
- let ( local_txn, mut spendable_output, new_outputs) = self . check_spend_local_transaction ( tx, height) ;
2146
+ let ( local_txn, mut spendable_output, new_outputs) = self . check_spend_local_transaction ( & tx, height) ;
2146
2147
spendable_outputs. append ( & mut spendable_output) ;
2147
2148
txn = local_txn;
2148
2149
if !new_outputs. 1 . is_empty ( ) {
@@ -2151,13 +2152,13 @@ impl ChannelMonitor {
2151
2152
}
2152
2153
}
2153
2154
if !funding_txo. is_none ( ) && txn. is_empty ( ) {
2154
- if let Some ( spendable_output) = self . check_spend_closing_transaction ( tx) {
2155
+ if let Some ( spendable_output) = self . check_spend_closing_transaction ( & tx) {
2155
2156
spendable_outputs. push ( spendable_output) ;
2156
2157
}
2157
2158
}
2158
2159
} else {
2159
2160
if let Some ( & ( commitment_number, _) ) = self . remote_commitment_txn_on_chain . get ( & prevout. txid ) {
2160
- let ( tx, spendable_output) = self . check_spend_remote_htlc ( tx, commitment_number, height, fee_estimator) ;
2161
+ let ( tx, spendable_output) = self . check_spend_remote_htlc ( & tx, commitment_number, height, fee_estimator) ;
2161
2162
if let Some ( tx) = tx {
2162
2163
txn. push ( tx) ;
2163
2164
}
@@ -2173,7 +2174,7 @@ impl ChannelMonitor {
2173
2174
// While all commitment/HTLC-Success/HTLC-Timeout transactions have one input, HTLCs
2174
2175
// can also be resolved in a few other ways which can have more than one output. Thus,
2175
2176
// we call is_resolving_htlc_output here outside of the tx.input.len() == 1 check.
2176
- let mut updated = self . is_resolving_htlc_output ( tx, height) ;
2177
+ let mut updated = self . is_resolving_htlc_output ( & tx, height) ;
2177
2178
if updated. len ( ) > 0 {
2178
2179
htlc_updated. append ( & mut updated) ;
2179
2180
}
0 commit comments