+ public EcdsaChannelSigner derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id) {
+ if (!use_full_km_wrapper) {
+ EcdsaChannelSigner underlying_signer = underlying_sp.derive_channel_signer(channel_value_satoshis, channel_keys_id);
+ must_free_objs.add(new WeakReference<>(underlying_signer));
+ return underlying_signer;
+ } else {
+ EcdsaChannelSigner underlying_ecs = underlying_sp.derive_channel_signer(channel_value_satoshis, channel_keys_id);
+ ChannelSigner underlying_cs = underlying_ecs.get_channel_signer();
+ ChannelSigner.ChannelSignerInterface csi = new ChannelSigner.ChannelSignerInterface() {
+ @Override public Result_PublicKeyNoneZ get_per_commitment_point(long idx) { return underlying_cs.get_per_commitment_point(idx); }
+ @Override public Result__u832NoneZ release_commitment_secret(long idx) { return underlying_cs.release_commitment_secret(idx); }
+ @Override public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx, byte[][] preimages) {
+ Result_NoneNoneZ res = underlying_cs.validate_holder_commitment(holder_tx, preimages);
+ mid_test_must_free_objs.add(new WeakReference<>(res));
+ return res;
+ }
+ @Override public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) {
+ Result_NoneNoneZ res = underlying_cs.validate_counterparty_revocation(idx, secret);
+ mid_test_must_free_objs.add(new WeakReference<>(res));
+ return res;
+ }
+ @Override public byte[] channel_keys_id() { return underlying_cs.channel_keys_id(); }
+ @Override public void provide_channel_parameters(ChannelTransactionParameters channel_parameters) {
+ underlying_cs.provide_channel_parameters(channel_parameters);
+ }
+ };
+ EcdsaChannelSigner.EcdsaChannelSignerInterface ecsi = new EcdsaChannelSigner.EcdsaChannelSignerInterface() {
+ @Override public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] inbound_htlc_preimages, byte[][] outbound_htlc_preimages) {
+ return underlying_ecs.sign_counterparty_commitment(commitment_tx, inbound_htlc_preimages, outbound_htlc_preimages);
+ }
+ @Override public Result_ECDSASignatureNoneZ sign_holder_commitment(HolderCommitmentTransaction commitment_tx) {
+ return underlying_ecs.sign_holder_commitment(commitment_tx);
+ }
+ @Override public Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
+ return underlying_ecs.sign_justice_revoked_output(justice_tx, input, amount, per_commitment_key);
+ }
+ @Override public Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc) {
+ return underlying_ecs.sign_justice_revoked_htlc(justice_tx, input, amount, per_commitment_key, htlc);
+ }
+ @Override public Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, HTLCDescriptor htlc_descriptor) {
+ return underlying_ecs.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor);
+ }
+ @Override public Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc) {
+ return underlying_ecs.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc);
+ }
+ @Override public Result_ECDSASignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx) {
+ return underlying_ecs.sign_closing_transaction(closing_tx);
+ }
+ @Override public Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) {
+ return underlying_ecs.sign_holder_anchor_input(anchor_tx, input);
+ }
+ @Override public Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(UnsignedChannelAnnouncement msg) {
+ return underlying_ecs.sign_channel_announcement_with_funding_key(msg);
+ }
+ };
+ EcdsaChannelSigner resp = EcdsaChannelSigner.new_impl(ecsi, csi, underlying_cs.get_pubkeys());
+ must_free_objs.add(new WeakReference<>(ecsi));
+ must_free_objs.add(new WeakReference<>(csi));
+ must_free_objs.add(new WeakReference<>(resp));
+ must_free_objs.add(new WeakReference<>(underlying_ecs));
+ must_free_objs.add(new WeakReference<>(underlying_cs));
+ return resp;
+ }