@@ -1661,15 +1661,23 @@ impl ChannelSigner for InMemorySigner {
16611661 ) ;
16621662 let witness_script =
16631663 chan_utils:: get_htlc_redeemscript ( htlc, params. channel_type_features ( ) , & keys) ;
1664- let sig = EcdsaChannelSigner :: sign_justice_revoked_htlc (
1665- self ,
1666- justice_tx,
1667- input,
1668- amount,
1669- per_commitment_key,
1670- htlc,
1671- secp_ctx,
1672- ) ?;
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 ) ;
16731681 let ecdsa_sig = EcdsaSignature :: sighash_all ( sig) ;
16741682 Ok ( Witness :: from (
16751683 & [
@@ -1870,56 +1878,6 @@ impl EcdsaChannelSigner for InMemorySigner {
18701878 Ok ( ( commitment_sig, htlc_sigs) )
18711879 }
18721880
1873- fn sign_justice_revoked_htlc (
1874- & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey ,
1875- htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1:: All > ,
1876- ) -> Result < Signature , ( ) > {
1877- let revocation_key = chan_utils:: derive_private_revocation_key (
1878- & secp_ctx,
1879- & per_commitment_key,
1880- & self . revocation_base_key ,
1881- ) ;
1882- let per_commitment_point = PublicKey :: from_secret_key ( secp_ctx, & per_commitment_key) ;
1883- let revocation_pubkey = RevocationKey :: from_basepoint (
1884- & secp_ctx,
1885- & self . pubkeys ( ) . revocation_basepoint ,
1886- & per_commitment_point,
1887- ) ;
1888- let witness_script = {
1889- let counterparty_keys = self . counterparty_pubkeys ( ) . expect ( MISSING_PARAMS_ERR ) ;
1890- let counterparty_htlcpubkey = HtlcKey :: from_basepoint (
1891- & secp_ctx,
1892- & counterparty_keys. htlc_basepoint ,
1893- & per_commitment_point,
1894- ) ;
1895- let holder_htlcpubkey = HtlcKey :: from_basepoint (
1896- & secp_ctx,
1897- & self . pubkeys ( ) . htlc_basepoint ,
1898- & per_commitment_point,
1899- ) ;
1900- let chan_type = self . channel_type_features ( ) . expect ( MISSING_PARAMS_ERR ) ;
1901- chan_utils:: get_htlc_redeemscript_with_explicit_keys (
1902- & htlc,
1903- chan_type,
1904- & counterparty_htlcpubkey,
1905- & holder_htlcpubkey,
1906- & revocation_pubkey,
1907- )
1908- } ;
1909- let mut sighash_parts = sighash:: SighashCache :: new ( justice_tx) ;
1910- let sighash = hash_to_message ! (
1911- & sighash_parts
1912- . p2wsh_signature_hash(
1913- input,
1914- & witness_script,
1915- Amount :: from_sat( amount) ,
1916- EcdsaSighashType :: All
1917- )
1918- . unwrap( ) [ ..]
1919- ) ;
1920- return Ok ( sign_with_aux_rand ( secp_ctx, & sighash, & revocation_key, & self ) ) ;
1921- }
1922-
19231881 fn sign_counterparty_htlc_transaction (
19241882 & self , htlc_tx : & Transaction , input : usize , amount : u64 , per_commitment_point : & PublicKey ,
19251883 htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1:: All > ,
0 commit comments