X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FSpendableOutputDescriptor.java;h=34ff18ac1ec03dc60d5a8e10d9d5b42a0823af8e;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=236a33fe07d50fd25322a433db75599bff417dcc;hpb=e30b350e325e7d517ea744578876d473839ad495;p=ldk-java diff --git a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java index 236a33fe..34ff18ac 100644 --- a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java @@ -36,6 +36,13 @@ public class SpendableOutputDescriptor extends CommonBase { assert false; return null; // Unreachable without extending the (internal) bindings interface } + /** + * An output to a script which was provided via KeysInterface directly, either from + * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know + * how to spend it. No secret keys are provided as rust-lightning was never given any key. + * These may include outputs from a transaction punishing our counterparty or claiming an HTLC + * on-chain using the payment preimage or after it has timed out. + */ public final static class StaticOutput extends SpendableOutputDescriptor { /** * The outpoint which is spendable @@ -56,6 +63,36 @@ public class SpendableOutputDescriptor extends CommonBase { this.output = output_conv; } } + /** + * An output to a P2WSH script which can be spent with a single signature after a CSV delay. + * + * The witness in the spending input should be: + * (MINIMALIF standard rule) + * + * Note that the nSequence field in the spending input must be set to to_self_delay + * (which means the transaction is not broadcastable until at least to_self_delay + * blocks after the outpoint confirms). + * + * These are generally the result of a \"revocable\" output to us, spendable only by us unless + * it is an output from an old state which we broadcast (which should never happen). + * + * To derive the delayed_payment key which is used to sign for this input, you must pass the + * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in + * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to + * chan_utils::derive_private_key. The public key can be generated without the secret key + * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in + * Sign::pubkeys(). + * + * To derive the revocation_pubkey provided here (which is used in the witness + * script generation), you must pass the counterparty revocation_basepoint (which appears in the + * call to Sign::ready_channel) and the provided per_commitment point + * to chan_utils::derive_public_revocation_key. + * + * The witness script which is hashed and included in the output script_pubkey may be + * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey + * (derived as above), and the to_self_delay contained here to + * chan_utils::get_revokeable_redeemscript. + */ public final static class DelayedPaymentOutput extends SpendableOutputDescriptor { public final DelayedPaymentOutputDescriptor delayed_payment_output; private DelayedPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput obj) { @@ -66,6 +103,15 @@ public class SpendableOutputDescriptor extends CommonBase { this.delayed_payment_output = delayed_payment_output_hu_conv; } } + /** + * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which + * corresponds to the public key in Sign::pubkeys().payment_point). + * The witness in the spending input, is, thus, simply: + * + * + * These are generally the result of our counterparty having broadcast the current state, + * allowing us to claim the non-HTLC-encumbered outputs immediately. + */ public final static class StaticPaymentOutput extends SpendableOutputDescriptor { public final StaticPaymentOutputDescriptor static_payment_output; private StaticPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput obj) { @@ -76,6 +122,11 @@ public class SpendableOutputDescriptor extends CommonBase { this.static_payment_output = static_payment_output_hu_conv; } } + long clone_ptr() { + long ret = bindings.SpendableOutputDescriptor_clone_ptr(this.ptr); + return ret; + } + /** * Creates a copy of the SpendableOutputDescriptor */