@@ -1624,14 +1624,23 @@ impl ChannelSigner for InMemorySigner {
16241624 contest_delay,
16251625 & keys. broadcaster_delayed_payment_key ,
16261626 ) ;
1627- let sig = EcdsaChannelSigner :: sign_justice_revoked_output (
1628- self ,
1629- justice_tx,
1630- input,
1631- amount,
1632- per_commitment_key,
1633- secp_ctx,
1634- ) ?;
1627+ let revocation_key = chan_utils:: derive_private_revocation_key (
1628+ & secp_ctx,
1629+ & per_commitment_key,
1630+ & self . revocation_base_key ,
1631+ ) ;
1632+ let mut sighash_parts = sighash:: SighashCache :: new ( justice_tx) ;
1633+ let sighash = hash_to_message ! (
1634+ & sighash_parts
1635+ . p2wsh_signature_hash(
1636+ input,
1637+ & witness_script,
1638+ Amount :: from_sat( amount) ,
1639+ EcdsaSighashType :: All
1640+ )
1641+ . unwrap( ) [ ..]
1642+ ) ;
1643+ let sig = sign_with_aux_rand ( secp_ctx, & sighash, & revocation_key, & self ) ;
16351644 let ecdsa_sig = EcdsaSignature :: sighash_all ( sig) ;
16361645 Ok ( Witness :: from (
16371646 & [ ecdsa_sig. serialize ( ) . as_ref ( ) , & [ 1 ] [ ..] , witness_script. as_bytes ( ) ] [ ..] ,
@@ -1861,50 +1870,6 @@ impl EcdsaChannelSigner for InMemorySigner {
18611870 Ok ( ( commitment_sig, htlc_sigs) )
18621871 }
18631872
1864- fn sign_justice_revoked_output (
1865- & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey ,
1866- secp_ctx : & Secp256k1 < secp256k1:: All > ,
1867- ) -> Result < Signature , ( ) > {
1868- let revocation_key = chan_utils:: derive_private_revocation_key (
1869- & secp_ctx,
1870- & per_commitment_key,
1871- & self . revocation_base_key ,
1872- ) ;
1873- let per_commitment_point = PublicKey :: from_secret_key ( secp_ctx, & per_commitment_key) ;
1874- let revocation_pubkey = RevocationKey :: from_basepoint (
1875- & secp_ctx,
1876- & self . pubkeys ( ) . revocation_basepoint ,
1877- & per_commitment_point,
1878- ) ;
1879- let witness_script = {
1880- let counterparty_keys = self . counterparty_pubkeys ( ) . expect ( MISSING_PARAMS_ERR ) ;
1881- let holder_selected_contest_delay =
1882- self . holder_selected_contest_delay ( ) . expect ( MISSING_PARAMS_ERR ) ;
1883- let counterparty_delayedpubkey = DelayedPaymentKey :: from_basepoint (
1884- & secp_ctx,
1885- & counterparty_keys. delayed_payment_basepoint ,
1886- & per_commitment_point,
1887- ) ;
1888- chan_utils:: get_revokeable_redeemscript (
1889- & revocation_pubkey,
1890- holder_selected_contest_delay,
1891- & counterparty_delayedpubkey,
1892- )
1893- } ;
1894- let mut sighash_parts = sighash:: SighashCache :: new ( justice_tx) ;
1895- let sighash = hash_to_message ! (
1896- & sighash_parts
1897- . p2wsh_signature_hash(
1898- input,
1899- & witness_script,
1900- Amount :: from_sat( amount) ,
1901- EcdsaSighashType :: All
1902- )
1903- . unwrap( ) [ ..]
1904- ) ;
1905- return Ok ( sign_with_aux_rand ( secp_ctx, & sighash, & revocation_key, & self ) ) ;
1906- }
1907-
19081873 fn sign_justice_revoked_htlc (
19091874 & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey ,
19101875 htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1:: All > ,
0 commit comments