- WriteableEcdsaChannelSigner underlying_wecs = underlying_sp.derive_channel_signer(channel_value_satoshis, channel_keys_id);
- EcdsaChannelSigner underlying_ecs = underlying_wecs.get_ecdsa_channel_signer();
- ChannelSigner underlying_cs = underlying_ecs.get_channel_signer();
- ChannelSigner.ChannelSignerInterface csi = new ChannelSigner.ChannelSignerInterface() {
- @Override public byte[] get_per_commitment_point(long idx) { return underlying_cs.get_per_commitment_point(idx); }
- @Override public byte[] release_commitment_secret(long idx) { return underlying_cs.release_commitment_secret(idx); }
- @Override public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx, byte[][] preimages) {
- return underlying_cs.validate_holder_commitment(holder_tx, preimages);
- }
- @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[][] preimages) {
- return underlying_ecs.sign_counterparty_commitment(commitment_tx, preimages);
- }
- @Override public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) {
- return underlying_ecs.validate_counterparty_revocation(idx, secret);
- }
- @Override public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) {
- return underlying_ecs.sign_holder_commitment_and_htlcs(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);
- }
- };
- WriteableEcdsaChannelSigner.WriteableEcdsaChannelSignerInterface wecsi = new WriteableEcdsaChannelSigner.WriteableEcdsaChannelSignerInterface() {
- @Override public byte[] write() { return underlying_wecs.write(); }
- };
- WriteableEcdsaChannelSigner resp = WriteableEcdsaChannelSigner.new_impl(wecsi, ecsi, csi, underlying_cs.get_pubkeys());
- must_free_objs.add(new WeakReference<>(wecsi));
- 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_wecs));
- must_free_objs.add(new WeakReference<>(underlying_ecs));
- must_free_objs.add(new WeakReference<>(underlying_cs));
- return resp;
+ if (!use_full_km_wrapper) {
+ WriteableEcdsaChannelSigner 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 {
+ WriteableEcdsaChannelSigner underlying_wecs = underlying_sp.derive_channel_signer(channel_value_satoshis, channel_keys_id);
+ EcdsaChannelSigner underlying_ecs = underlying_wecs.get_ecdsa_channel_signer();
+ ChannelSigner underlying_cs = underlying_ecs.get_channel_signer();
+ ChannelSigner.ChannelSignerInterface csi = new ChannelSigner.ChannelSignerInterface() {
+ @Override public byte[] get_per_commitment_point(long idx) { return underlying_cs.get_per_commitment_point(idx); }
+ @Override public byte[] release_commitment_secret(long idx) { return underlying_cs.release_commitment_secret(idx); }
+ @Override public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx, byte[][] preimages) {
+ return underlying_cs.validate_holder_commitment(holder_tx, preimages);
+ }
+ @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[][] preimages) {
+ return underlying_ecs.sign_counterparty_commitment(commitment_tx, preimages);
+ }
+ @Override public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) {
+ return underlying_ecs.validate_counterparty_revocation(idx, secret);
+ }
+ @Override public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) {
+ return underlying_ecs.sign_holder_commitment_and_htlcs(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);
+ }
+ };
+ WriteableEcdsaChannelSigner.WriteableEcdsaChannelSignerInterface wecsi = new WriteableEcdsaChannelSigner.WriteableEcdsaChannelSignerInterface() {
+ @Override public byte[] write() { return underlying_wecs.write(); }
+ };
+ WriteableEcdsaChannelSigner resp = WriteableEcdsaChannelSigner.new_impl(wecsi, ecsi, csi, underlying_cs.get_pubkeys());
+ must_free_objs.add(new WeakReference<>(wecsi));
+ 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_wecs));
+ must_free_objs.add(new WeakReference<>(underlying_ecs));
+ must_free_objs.add(new WeakReference<>(underlying_cs));
+ return resp;
+ }