@@ -1661,14 +1661,23 @@ impl ChannelSigner for InMemorySigner {
16611661 contest_delay,
16621662 & keys. broadcaster_delayed_payment_key ,
16631663 ) ;
1664- let sig = EcdsaChannelSigner :: sign_justice_revoked_output (
1665- self ,
1666- justice_tx,
1667- input,
1668- amount,
1669- per_commitment_key,
1670- secp_ctx,
1671- ) ?;
1664+ let revocation_key = chan_utils:: derive_private_revocation_key (
1665+ & secp_ctx,
1666+ & per_commitment_key,
1667+ & self . revocation_base_key ,
1668+ ) ;
1669+ let mut sighash_parts = sighash:: SighashCache :: new ( justice_tx) ;
1670+ let sighash = hash_to_message ! (
1671+ & sighash_parts
1672+ . p2wsh_signature_hash(
1673+ input,
1674+ & witness_script,
1675+ Amount :: from_sat( amount) ,
1676+ EcdsaSighashType :: All
1677+ )
1678+ . unwrap( ) [ ..]
1679+ ) ;
1680+ let sig = sign_with_aux_rand ( secp_ctx, & sighash, & revocation_key, & self ) ;
16721681 let ecdsa_sig = EcdsaSignature :: sighash_all ( sig) ;
16731682 Ok ( Witness :: from (
16741683 & [ ecdsa_sig. serialize ( ) . as_ref ( ) , & [ 1 ] [ ..] , witness_script. as_bytes ( ) ] [ ..] ,
@@ -1887,50 +1896,6 @@ impl EcdsaChannelSigner for InMemorySigner {
18871896 Ok ( ( commitment_sig, htlc_sigs) )
18881897 }
18891898
1890- fn sign_justice_revoked_output (
1891- & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey ,
1892- secp_ctx : & Secp256k1 < secp256k1:: All > ,
1893- ) -> Result < Signature , ( ) > {
1894- let revocation_key = chan_utils:: derive_private_revocation_key (
1895- & secp_ctx,
1896- & per_commitment_key,
1897- & self . revocation_base_key ,
1898- ) ;
1899- let per_commitment_point = PublicKey :: from_secret_key ( secp_ctx, & per_commitment_key) ;
1900- let revocation_pubkey = RevocationKey :: from_basepoint (
1901- & secp_ctx,
1902- & self . pubkeys ( ) . revocation_basepoint ,
1903- & per_commitment_point,
1904- ) ;
1905- let witness_script = {
1906- let counterparty_keys = self . counterparty_pubkeys ( ) . expect ( MISSING_PARAMS_ERR ) ;
1907- let holder_selected_contest_delay =
1908- self . holder_selected_contest_delay ( ) . expect ( MISSING_PARAMS_ERR ) ;
1909- let counterparty_delayedpubkey = DelayedPaymentKey :: from_basepoint (
1910- & secp_ctx,
1911- & counterparty_keys. delayed_payment_basepoint ,
1912- & per_commitment_point,
1913- ) ;
1914- chan_utils:: get_revokeable_redeemscript (
1915- & revocation_pubkey,
1916- holder_selected_contest_delay,
1917- & counterparty_delayedpubkey,
1918- )
1919- } ;
1920- let mut sighash_parts = sighash:: SighashCache :: new ( justice_tx) ;
1921- let sighash = hash_to_message ! (
1922- & sighash_parts
1923- . p2wsh_signature_hash(
1924- input,
1925- & witness_script,
1926- Amount :: from_sat( amount) ,
1927- EcdsaSighashType :: All
1928- )
1929- . unwrap( ) [ ..]
1930- ) ;
1931- return Ok ( sign_with_aux_rand ( secp_ctx, & sighash, & revocation_key, & self ) ) ;
1932- }
1933-
19341899 fn sign_justice_revoked_htlc (
19351900 & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey ,
19361901 htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1:: All > ,
0 commit comments