@@ -1698,15 +1698,23 @@ impl ChannelSigner for InMemorySigner {
16981698 ) ;
16991699 let witness_script =
17001700 chan_utils:: get_htlc_redeemscript ( htlc, params. channel_type_features ( ) , & keys) ;
1701- let sig = EcdsaChannelSigner :: sign_justice_revoked_htlc (
1702- self ,
1703- justice_tx,
1704- input,
1705- amount,
1706- per_commitment_key,
1707- htlc,
1708- secp_ctx,
1709- ) ?;
1701+ let revocation_key = chan_utils:: derive_private_revocation_key (
1702+ & secp_ctx,
1703+ & per_commitment_key,
1704+ & self . revocation_base_key ,
1705+ ) ;
1706+ let mut sighash_parts = sighash:: SighashCache :: new ( justice_tx) ;
1707+ let sighash = hash_to_message ! (
1708+ & sighash_parts
1709+ . p2wsh_signature_hash(
1710+ input,
1711+ & witness_script,
1712+ Amount :: from_sat( amount) ,
1713+ EcdsaSighashType :: All
1714+ )
1715+ . unwrap( ) [ ..]
1716+ ) ;
1717+ let sig = sign_with_aux_rand ( secp_ctx, & sighash, & revocation_key, & self ) ;
17101718 let ecdsa_sig = EcdsaSignature :: sighash_all ( sig) ;
17111719 Ok ( Witness :: from (
17121720 & [
@@ -1896,56 +1904,6 @@ impl EcdsaChannelSigner for InMemorySigner {
18961904 Ok ( ( commitment_sig, htlc_sigs) )
18971905 }
18981906
1899- fn sign_justice_revoked_htlc (
1900- & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey ,
1901- htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1:: All > ,
1902- ) -> Result < Signature , ( ) > {
1903- let revocation_key = chan_utils:: derive_private_revocation_key (
1904- & secp_ctx,
1905- & per_commitment_key,
1906- & self . revocation_base_key ,
1907- ) ;
1908- let per_commitment_point = PublicKey :: from_secret_key ( secp_ctx, & per_commitment_key) ;
1909- let revocation_pubkey = RevocationKey :: from_basepoint (
1910- & secp_ctx,
1911- & self . pubkeys ( ) . revocation_basepoint ,
1912- & per_commitment_point,
1913- ) ;
1914- let witness_script = {
1915- let counterparty_keys = self . counterparty_pubkeys ( ) . expect ( MISSING_PARAMS_ERR ) ;
1916- let counterparty_htlcpubkey = HtlcKey :: from_basepoint (
1917- & secp_ctx,
1918- & counterparty_keys. htlc_basepoint ,
1919- & per_commitment_point,
1920- ) ;
1921- let holder_htlcpubkey = HtlcKey :: from_basepoint (
1922- & secp_ctx,
1923- & self . pubkeys ( ) . htlc_basepoint ,
1924- & per_commitment_point,
1925- ) ;
1926- let chan_type = self . channel_type_features ( ) . expect ( MISSING_PARAMS_ERR ) ;
1927- chan_utils:: get_htlc_redeemscript_with_explicit_keys (
1928- & htlc,
1929- chan_type,
1930- & counterparty_htlcpubkey,
1931- & holder_htlcpubkey,
1932- & revocation_pubkey,
1933- )
1934- } ;
1935- let mut sighash_parts = sighash:: SighashCache :: new ( justice_tx) ;
1936- let sighash = hash_to_message ! (
1937- & sighash_parts
1938- . p2wsh_signature_hash(
1939- input,
1940- & witness_script,
1941- Amount :: from_sat( amount) ,
1942- EcdsaSighashType :: All
1943- )
1944- . unwrap( ) [ ..]
1945- ) ;
1946- return Ok ( sign_with_aux_rand ( secp_ctx, & sighash, & revocation_key, & self ) ) ;
1947- }
1948-
19491907 fn sign_counterparty_htlc_transaction (
19501908 & self , htlc_tx : & Transaction , input : usize , amount : u64 , per_commitment_point : & PublicKey ,
19511909 htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1:: All > ,
0 commit comments