@@ -875,7 +875,7 @@ struct FundingScope {
875
875
outpoint : OutPoint ,
876
876
script_pubkey : ScriptBuf ,
877
877
redeem_script : ScriptBuf ,
878
- channel_value_satoshis : u64 ,
878
+ channel_parameters : ChannelTransactionParameters ,
879
879
880
880
current_counterparty_commitment_txid : Option < Txid > ,
881
881
prev_counterparty_commitment_txid : Option < Txid > ,
@@ -1118,7 +1118,7 @@ impl<Signer: EcdsaChannelSigner> Writeable for ChannelMonitorImpl<Signer> {
1118
1118
1119
1119
self . counterparty_commitment_params . write ( writer) ?;
1120
1120
self . funding . redeem_script . write ( writer) ?;
1121
- self . funding . channel_value_satoshis . write ( writer) ?;
1121
+ self . funding . channel_parameters . channel_value_satoshis . write ( writer) ?;
1122
1122
1123
1123
match self . their_cur_per_commitment_points {
1124
1124
Some ( ( idx, pubkey, second_option) ) => {
@@ -1378,7 +1378,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
1378
1378
on_counterparty_tx_csv : u16 , destination_script : & Script , funding_outpoint : OutPoint ,
1379
1379
funding_script : ScriptBuf , channel_parameters : & ChannelTransactionParameters ,
1380
1380
holder_pays_commitment_tx_fee : bool , funding_redeemscript : ScriptBuf ,
1381
- channel_value_satoshis : u64 , commitment_transaction_number_obscure_factor : u64 ,
1381
+ commitment_transaction_number_obscure_factor : u64 ,
1382
1382
initial_holder_commitment_tx : HolderCommitmentTransaction , best_block : BestBlock ,
1383
1383
counterparty_node_id : PublicKey , channel_id : ChannelId ,
1384
1384
) -> ChannelMonitor < Signer > {
@@ -1418,8 +1418,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
1418
1418
} ;
1419
1419
1420
1420
let onchain_tx_handler = OnchainTxHandler :: new (
1421
- channel_value_satoshis, channel_keys_id, destination_script. into ( ) , keys ,
1422
- channel_parameters. clone ( ) , initial_holder_commitment_tx, secp_ctx
1421
+ channel_parameters . channel_value_satoshis , channel_keys_id, destination_script. into ( ) ,
1422
+ keys , channel_parameters. clone ( ) , initial_holder_commitment_tx, secp_ctx
1423
1423
) ;
1424
1424
1425
1425
let mut outputs_to_watch = new_hash_map ( ) ;
@@ -1432,7 +1432,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
1432
1432
outpoint : funding_outpoint,
1433
1433
script_pubkey : funding_script,
1434
1434
redeem_script : funding_redeemscript,
1435
- channel_value_satoshis ,
1435
+ channel_parameters : channel_parameters . clone ( ) ,
1436
1436
1437
1437
current_counterparty_commitment_txid : None ,
1438
1438
prev_counterparty_commitment_txid : None ,
@@ -3146,7 +3146,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3146
3146
fn generate_claimable_outpoints_and_watch_outputs ( & mut self , reason : ClosureReason ) -> ( Vec < PackageTemplate > , Vec < TransactionOutputs > ) {
3147
3147
let funding_outp = HolderFundingOutput :: build (
3148
3148
self . funding . redeem_script . clone ( ) ,
3149
- self . funding . channel_value_satoshis ,
3149
+ self . funding . channel_parameters . channel_value_satoshis ,
3150
3150
self . onchain_tx_handler . channel_type_features ( ) . clone ( )
3151
3151
) ;
3152
3152
let commitment_package = PackageTemplate :: build_package (
@@ -3403,7 +3403,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3403
3403
let commitment_txid = commitment_tx. compute_txid ( ) ;
3404
3404
debug_assert_eq ! ( self . funding. current_holder_commitment_tx. txid, commitment_txid) ;
3405
3405
let pending_htlcs = self . funding . current_holder_commitment_tx . non_dust_htlcs ( ) ;
3406
- let commitment_tx_fee_satoshis = self . funding . channel_value_satoshis -
3406
+ let channel_value_satoshis = self . funding . channel_parameters . channel_value_satoshis ;
3407
+ let commitment_tx_fee_satoshis = channel_value_satoshis -
3407
3408
commitment_tx. output . iter ( ) . fold ( 0u64 , |sum, output| sum + output. value . to_sat ( ) ) ;
3408
3409
ret. push ( Event :: BumpTransaction ( BumpTransactionEvent :: ChannelClose {
3409
3410
channel_id,
@@ -3415,7 +3416,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3415
3416
anchor_descriptor : AnchorDescriptor {
3416
3417
channel_derivation_parameters : ChannelDerivationParameters {
3417
3418
keys_id : self . channel_keys_id ,
3418
- value_satoshis : self . funding . channel_value_satoshis ,
3419
+ value_satoshis : channel_value_satoshis,
3419
3420
transaction_parameters : self . onchain_tx_handler . channel_transaction_parameters . clone ( ) ,
3420
3421
} ,
3421
3422
outpoint : BitcoinOutPoint {
@@ -3436,7 +3437,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3436
3437
htlc_descriptors. push ( HTLCDescriptor {
3437
3438
channel_derivation_parameters : ChannelDerivationParameters {
3438
3439
keys_id : self . channel_keys_id ,
3439
- value_satoshis : self . funding . channel_value_satoshis ,
3440
+ value_satoshis : self . funding . channel_parameters . channel_value_satoshis ,
3440
3441
transaction_parameters : self . onchain_tx_handler . channel_transaction_parameters . clone ( ) ,
3441
3442
} ,
3442
3443
commitment_txid : htlc. commitment_txid ,
@@ -4809,7 +4810,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4809
4810
output : outp. clone ( ) ,
4810
4811
revocation_pubkey : broadcasted_holder_revokable_script. 2 ,
4811
4812
channel_keys_id : self . channel_keys_id ,
4812
- channel_value_satoshis : self . funding . channel_value_satoshis ,
4813
+ channel_value_satoshis : self . funding . channel_parameters . channel_value_satoshis ,
4813
4814
channel_transaction_parameters : Some ( self . onchain_tx_handler . channel_transaction_parameters . clone ( ) ) ,
4814
4815
} ) ) ;
4815
4816
}
@@ -4819,7 +4820,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4819
4820
outpoint : OutPoint { txid : tx. compute_txid ( ) , index : i as u16 } ,
4820
4821
output : outp. clone ( ) ,
4821
4822
channel_keys_id : self . channel_keys_id ,
4822
- channel_value_satoshis : self . funding . channel_value_satoshis ,
4823
+ channel_value_satoshis : self . funding . channel_parameters . channel_value_satoshis ,
4823
4824
channel_transaction_parameters : Some ( self . onchain_tx_handler . channel_transaction_parameters . clone ( ) ) ,
4824
4825
} ) ) ;
4825
4826
}
@@ -5183,12 +5184,14 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
5183
5184
To continue, run a v0.1 release, send/route a payment over the channel or close it.", channel_id) ;
5184
5185
}
5185
5186
5187
+ let channel_parameters = onchain_tx_handler. channel_transaction_parameters . clone ( ) ;
5188
+
5186
5189
Ok ( ( best_block. block_hash , ChannelMonitor :: from_impl ( ChannelMonitorImpl {
5187
5190
funding : FundingScope {
5188
5191
outpoint,
5189
5192
script_pubkey : funding_script,
5190
5193
redeem_script : funding_redeemscript,
5191
- channel_value_satoshis ,
5194
+ channel_parameters ,
5192
5195
5193
5196
current_counterparty_commitment_txid,
5194
5197
prev_counterparty_commitment_txid,
@@ -5485,7 +5488,7 @@ mod tests {
5485
5488
let best_block = BestBlock :: from_network ( Network :: Testnet ) ;
5486
5489
let monitor = ChannelMonitor :: new (
5487
5490
Secp256k1 :: new ( ) , keys, Some ( shutdown_script. into_inner ( ) ) , 0 , & ScriptBuf :: new ( ) ,
5488
- funding_txo, ScriptBuf :: new ( ) , & channel_parameters, true , ScriptBuf :: new ( ) , 46 , 0 ,
5491
+ funding_txo, ScriptBuf :: new ( ) , & channel_parameters, true , ScriptBuf :: new ( ) , 0 ,
5489
5492
HolderCommitmentTransaction :: dummy ( 0 , & mut Vec :: new ( ) ) , best_block, dummy_key, channel_id,
5490
5493
) ;
5491
5494
@@ -5738,7 +5741,7 @@ mod tests {
5738
5741
let best_block = BestBlock :: from_network ( Network :: Testnet ) ;
5739
5742
let monitor = ChannelMonitor :: new (
5740
5743
Secp256k1 :: new ( ) , keys, Some ( shutdown_script. into_inner ( ) ) , 0 , & ScriptBuf :: new ( ) ,
5741
- funding_txo, ScriptBuf :: new ( ) , & channel_parameters, true , ScriptBuf :: new ( ) , 46 , 0 ,
5744
+ funding_txo, ScriptBuf :: new ( ) , & channel_parameters, true , ScriptBuf :: new ( ) , 0 ,
5742
5745
HolderCommitmentTransaction :: dummy ( 0 , & mut Vec :: new ( ) ) , best_block, dummy_key, channel_id,
5743
5746
) ;
5744
5747
0 commit comments