@@ -502,9 +502,9 @@ pub(crate) enum ChannelMonitorUpdateStep {
502
502
impl Writeable for ChannelMonitorUpdateStep {
503
503
fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , :: std:: io:: Error > {
504
504
match self {
505
- & ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { commitment_info : ref commitment_tx , ref htlc_outputs } => {
505
+ & ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { ref commitment_info , ref htlc_outputs } => {
506
506
0u8 . write ( w) ?;
507
- commitment_tx . write ( w) ?;
507
+ commitment_info . write ( w) ?;
508
508
( htlc_outputs. len ( ) as u64 ) . write ( w) ?;
509
509
for & ( ref output, ref signature, ref source) in htlc_outputs. iter ( ) {
510
510
output. write ( w) ?;
@@ -953,19 +953,26 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
953
953
954
954
let mut onchain_tx_handler = OnchainTxHandler :: new ( destination_script. clone ( ) , keys. clone ( ) , channel_static_info. clone ( ) ) ;
955
955
956
- let current_holder_commitment_number = initial_holder_commitment_info. info . commitment_number ;
957
956
let secp_ctx = Secp256k1 :: new ( ) ;
958
957
959
958
let txid = initial_holder_commitment_info. txid ( channel_static_info, & secp_ctx) ;
960
- let holder_commitment_tx = HolderSignedTx {
961
- txid,
962
- revocation_key : initial_holder_commitment_info. info . keys . revocation_key ,
963
- a_htlc_key : initial_holder_commitment_info. info . keys . broadcaster_htlc_key ,
964
- b_htlc_key : initial_holder_commitment_info. info . keys . countersignatory_htlc_key ,
965
- delayed_payment_key : initial_holder_commitment_info. info . keys . broadcaster_delayed_payment_key ,
966
- per_commitment_point : initial_holder_commitment_info. info . keys . per_commitment_point ,
967
- feerate_per_kw : initial_holder_commitment_info. info . feerate_per_kw ,
968
- htlc_outputs : Vec :: new ( ) , // There are never any HTLCs in the initial commitment transactions
959
+
960
+ // block for Rust 1.34 compat
961
+ let ( holder_commitment_tx, current_holder_commitment_number) = {
962
+ let info = & initial_holder_commitment_info. info ;
963
+ let tx_keys = & info. keys ;
964
+ let current_holder_commitment_number = info. commitment_number ;
965
+ let holder_commitment_tx = HolderSignedTx {
966
+ txid,
967
+ revocation_key : tx_keys. revocation_key ,
968
+ a_htlc_key : tx_keys. broadcaster_htlc_key ,
969
+ b_htlc_key : tx_keys. countersignatory_htlc_key ,
970
+ delayed_payment_key : tx_keys. broadcaster_delayed_payment_key ,
971
+ per_commitment_point : tx_keys. per_commitment_point ,
972
+ feerate_per_kw : info. feerate_per_kw ,
973
+ htlc_outputs : Vec :: new ( ) , // There are never any HTLCs in the initial commitment transactions
974
+ } ;
975
+ ( holder_commitment_tx, current_holder_commitment_number)
969
976
} ;
970
977
onchain_tx_handler. provide_latest_holder_tx ( initial_holder_commitment_info) ;
971
978
@@ -1017,7 +1024,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1017
1024
holder_tx_signed : false ,
1018
1025
1019
1026
last_block_hash : Default :: default ( ) ,
1020
- secp_ctx : secp_ctx ,
1027
+ secp_ctx,
1021
1028
}
1022
1029
}
1023
1030
@@ -1127,17 +1134,23 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1127
1134
/// Panics if set_on_holder_tx_csv has never been called.
1128
1135
fn provide_latest_holder_commitment_tx_info ( & mut self , commitment_info : HolderCommitmentTransactionInfo , htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > ) -> Result < ( ) , MonitorUpdateError > {
1129
1136
let txid = commitment_info. txid ( & self . onchain_tx_handler . channel_static_info , & self . secp_ctx ) ;
1130
- let mut new_holder_commitment_tx = HolderSignedTx {
1131
- txid,
1132
- revocation_key : commitment_info. info . keys . revocation_key ,
1133
- a_htlc_key : commitment_info. info . keys . broadcaster_htlc_key ,
1134
- b_htlc_key : commitment_info. info . keys . countersignatory_htlc_key ,
1135
- delayed_payment_key : commitment_info. info . keys . broadcaster_delayed_payment_key ,
1136
- per_commitment_point : commitment_info. info . keys . per_commitment_point ,
1137
- feerate_per_kw : commitment_info. info . feerate_per_kw ,
1138
- htlc_outputs,
1137
+
1138
+ // block for Rust 1.34 compat
1139
+ let mut new_holder_commitment_tx = {
1140
+ let info = & commitment_info. info ;
1141
+ let tx_keys = & info. keys ;
1142
+ self . current_holder_commitment_number = info. commitment_number ;
1143
+ HolderSignedTx {
1144
+ txid,
1145
+ revocation_key : tx_keys. revocation_key ,
1146
+ a_htlc_key : tx_keys. broadcaster_htlc_key ,
1147
+ b_htlc_key : tx_keys. countersignatory_htlc_key ,
1148
+ delayed_payment_key : tx_keys. broadcaster_delayed_payment_key ,
1149
+ per_commitment_point : tx_keys. per_commitment_point ,
1150
+ feerate_per_kw : info. feerate_per_kw ,
1151
+ htlc_outputs,
1152
+ }
1139
1153
} ;
1140
- self . current_holder_commitment_number = commitment_info. info . commitment_number ;
1141
1154
self . onchain_tx_handler . provide_latest_holder_tx ( commitment_info) ;
1142
1155
mem:: swap ( & mut new_holder_commitment_tx, & mut self . current_holder_commitment_tx ) ;
1143
1156
self . prev_holder_signed_commitment_tx = Some ( new_holder_commitment_tx) ;
@@ -1176,9 +1189,9 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1176
1189
}
1177
1190
for update in updates. updates . drain ( ..) {
1178
1191
match update {
1179
- ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { commitment_info : commitment_tx , htlc_outputs } => {
1192
+ ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { commitment_info, htlc_outputs } => {
1180
1193
if self . lockdown_from_offchain { panic ! ( ) ; }
1181
- self . provide_latest_holder_commitment_tx_info ( commitment_tx , htlc_outputs) ?
1194
+ self . provide_latest_holder_commitment_tx_info ( commitment_info , htlc_outputs) ?
1182
1195
} ,
1183
1196
ChannelMonitorUpdateStep :: LatestCounterpartyCommitmentTXInfo { unsigned_commitment_tx, htlc_outputs, commitment_number, their_revocation_point } =>
1184
1197
self . provide_latest_counterparty_commitment_tx_info ( & unsigned_commitment_tx, htlc_outputs, commitment_number, their_revocation_point, logger) ,
0 commit comments