Class ChannelSigner


  • public class ChannelSigner
    extends Object
    A trait to handle Lightning channel key material without concretizing the channel type or the signature mechanism.
    • Method Detail

      • destroy

        public void destroy()
        Destroys the object, freeing associated resources. After this call, any access to this object may result in a SEGFAULT or worse. You should generally NEVER call this method. You should let the garbage collector do this for you when it finalizes objects. However, it may be useful for types which represent locks and should be closed immediately to avoid holding locks until the GC runs.
      • get_per_commitment_point

        public byte[] get_per_commitment_point​(long idx)
        Gets the per-commitment point for a specific commitment number Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
      • release_commitment_secret

        public byte[] release_commitment_secret​(long idx)
        Gets the commitment secret for a specific commitment number as part of the revocation process An external signer implementation should error here if the commitment was already signed and should refuse to sign it in the future. May be called more than once for the same index. Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
      • validate_holder_commitment

        public Result_NoneNoneZ validate_holder_commitment​(HolderCommitmentTransaction holder_tx,
                                                           byte[][] preimages)
        Validate the counterparty's signatures on the holder commitment transaction and HTLCs. This is required in order for the signer to make sure that releasing a commitment secret won't leave us without a broadcastable holder transaction. Policy checks should be implemented in this function, including checking the amount sent to us and checking the HTLCs. The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. A validating signer should ensure that an HTLC output is removed only when the matching preimage is provided, or when the value to holder is restored. Note that all the relevant preimages will be provided, but there may also be additional irrelevant or duplicate preimages.
      • channel_keys_id

        public byte[] channel_keys_id()
        Returns an arbitrary identifier describing the set of keys which are provided back to you in some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys.
      • provide_channel_parameters

        public void provide_channel_parameters​(ChannelTransactionParameters channel_parameters)
        Set the counterparty static channel data, including basepoints, `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. This data is static, and will never change for a channel once set. For a given [`ChannelSigner`] instance, LDK will call this method exactly once - either immediately after construction (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding information has been generated. channel_parameters.is_populated() MUST be true.
      • get_pubkeys

        public ChannelPublicKeys get_pubkeys()
        Frees any resources associated with this object given its this_arg pointer. Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.