@@ -463,15 +463,16 @@ impl ChannelKeys for InMemoryChannelKeys {
463
463
fn key_derivation_params ( & self ) -> ( u64 , u64 ) { self . key_derivation_params }
464
464
465
465
fn sign_counterparty_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , commitment_tx : & CommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
466
- let keys = commitment_tx. untrusted_key_derivation ( ) ;
466
+ let trusted_tx = commitment_tx. trust ( ) ;
467
+ let keys = trusted_tx. keys ( ) ;
467
468
468
469
let funding_pubkey = PublicKey :: from_secret_key ( secp_ctx, & self . funding_key ) ;
469
470
let channel_funding_redeemscript = make_funding_redeemscript ( & funding_pubkey, & self . counterparty_pubkeys ( ) . funding_pubkey ) ;
470
471
471
- let built_tx = commitment_tx . untrusted_built_transaction ( ) ;
472
+ let built_tx = trusted_tx . built_transaction ( ) ;
472
473
let commitment_sig = built_tx. sign ( & self . funding_key , & channel_funding_redeemscript, self . channel_value_satoshis , secp_ctx) ;
473
474
474
- let commitment_txid = commitment_tx . untrusted_txid ( ) ;
475
+ let commitment_txid = trusted_tx . txid ( ) ;
475
476
476
477
let mut htlc_sigs = Vec :: with_capacity ( commitment_tx. htlcs ( ) . len ( ) ) ;
477
478
for htlc in commitment_tx. htlcs ( ) {
@@ -491,8 +492,8 @@ impl ChannelKeys for InMemoryChannelKeys {
491
492
fn sign_holder_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
492
493
let funding_pubkey = PublicKey :: from_secret_key ( secp_ctx, & self . funding_key ) ;
493
494
let funding_redeemscript = make_funding_redeemscript ( & funding_pubkey, & self . counterparty_pubkeys ( ) . funding_pubkey ) ;
494
-
495
- let built_tx = commitment_tx . inner . untrusted_built_transaction ( ) ;
495
+ let trusted_tx = commitment_tx . trust ( ) ;
496
+ let built_tx = trusted_tx . built_transaction ( ) ;
496
497
let sig = built_tx. sign ( & self . funding_key , & funding_redeemscript, self . channel_value_satoshis , secp_ctx) ;
497
498
let htlc_sigs_o = self . sign_holder_commitment_htlc_transactions ( & commitment_tx, secp_ctx) ?;
498
499
let htlc_sigs = htlc_sigs_o. iter ( ) . map ( |o| o. unwrap ( ) ) . collect ( ) ;
@@ -504,15 +505,17 @@ impl ChannelKeys for InMemoryChannelKeys {
504
505
fn unsafe_sign_holder_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , holder_commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
505
506
let funding_pubkey = PublicKey :: from_secret_key ( secp_ctx, & self . funding_key ) ;
506
507
let channel_funding_redeemscript = make_funding_redeemscript ( & funding_pubkey, & self . counterparty_pubkeys ( ) . funding_pubkey ) ;
508
+ let trusted_tx = holder_commitment_tx. trust ( ) ;
507
509
508
- let built_tx = holder_commitment_tx . inner . untrusted_built_transaction ( ) ;
510
+ let built_tx = trusted_tx . built_transaction ( ) ;
509
511
Ok ( built_tx. sign ( & self . funding_key , & channel_funding_redeemscript, self . channel_value_satoshis , secp_ctx) )
510
512
}
511
513
512
514
fn sign_holder_commitment_htlc_transactions < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Vec < Option < Signature > > , ( ) > {
513
515
let channel_parameters = self . make_channel_parameters ( ) ;
514
516
let channel_parameters = channel_parameters. as_holder_broadcastable ( ) ;
515
- commitment_tx. inner . get_htlc_sigs ( & self . htlc_base_key , & channel_parameters, secp_ctx)
517
+ let trusted_tx = commitment_tx. trust ( ) ;
518
+ trusted_tx. get_htlc_sigs ( & self . htlc_base_key , & channel_parameters, secp_ctx)
516
519
}
517
520
518
521
fn sign_justice_transaction < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & Option < HTLCOutputInCommitment > , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
0 commit comments