Class OpenChannel


  • public class OpenChannel
    extends Object
    An [`open_channel`] message to be sent to or received from a peer. Used in V1 channel establishment [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      OpenChannel clone()
      Creates a copy of the OpenChannel
      boolean eq​(OpenChannel b)
      Checks if two OpenChannels contain equal inner contents.
      boolean equals​(Object o)  
      protected void finalize()  
      byte[] get_chain_hash()
      The genesis hash of the blockchain where the channel is to be opened
      byte get_channel_flags()
      The channel flags to be used
      long get_channel_reserve_satoshis()
      The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
      ChannelTypeFeatures get_channel_type()
      The channel type that this channel will represent If this is `None`, we derive the channel type from the intersection of our feature bits with our counterparty's feature bits from the [`Init`] message.
      byte[] get_delayed_payment_basepoint()
      Used to derive a payment key to sender for transactions broadcast by sender
      long get_dust_limit_satoshis()
      The threshold below which outputs on transactions broadcast by sender will be omitted
      int get_feerate_per_kw()
      The feerate per 1000-weight of sender generated transactions, until updated by [`UpdateFee`]
      byte[] get_first_per_commitment_point()
      The first to-be-broadcast-by-sender transaction's per commitment point
      byte[] get_funding_pubkey()
      The sender's key controlling the funding transaction
      long get_funding_satoshis()
      The channel value
      byte[] get_htlc_basepoint()
      Used to derive an HTLC payment key to sender
      long get_htlc_minimum_msat()
      The minimum HTLC size incoming to sender, in milli-satoshi
      short get_max_accepted_htlcs()
      The maximum number of inbound HTLCs towards sender
      long get_max_htlc_value_in_flight_msat()
      The maximum inbound HTLC value in flight towards sender, in milli-satoshi
      byte[] get_payment_point()
      A payment key to sender for transactions broadcast by counterparty
      long get_push_msat()
      The amount to push to the counterparty as part of the open, in milli-satoshi
      byte[] get_revocation_basepoint()
      Used to derive a revocation key for transactions broadcast by counterparty
      Option_CVec_u8ZZ get_shutdown_scriptpubkey()
      A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
      byte[] get_temporary_channel_id()
      A temporary channel ID, until the funding outpoint is announced
      short get_to_self_delay()
      The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
      static OpenChannel of​(byte[] chain_hash_arg, byte[] temporary_channel_id_arg, long funding_satoshis_arg, long push_msat_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long channel_reserve_satoshis_arg, long htlc_minimum_msat_arg, int feerate_per_kw_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg, byte[] first_per_commitment_point_arg, byte channel_flags_arg, Option_CVec_u8ZZ shutdown_scriptpubkey_arg, ChannelTypeFeatures channel_type_arg)
      Constructs a new OpenChannel given each field Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
      static Result_OpenChannelDecodeErrorZ read​(byte[] ser)
      Read a OpenChannel from a byte array, created by OpenChannel_write
      void set_chain_hash​(byte[] val)
      The genesis hash of the blockchain where the channel is to be opened
      void set_channel_flags​(byte val)
      The channel flags to be used
      void set_channel_reserve_satoshis​(long val)
      The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
      void set_channel_type​(ChannelTypeFeatures val)
      The channel type that this channel will represent If this is `None`, we derive the channel type from the intersection of our feature bits with our counterparty's feature bits from the [`Init`] message.
      void set_delayed_payment_basepoint​(byte[] val)
      Used to derive a payment key to sender for transactions broadcast by sender
      void set_dust_limit_satoshis​(long val)
      The threshold below which outputs on transactions broadcast by sender will be omitted
      void set_feerate_per_kw​(int val)
      The feerate per 1000-weight of sender generated transactions, until updated by [`UpdateFee`]
      void set_first_per_commitment_point​(byte[] val)
      The first to-be-broadcast-by-sender transaction's per commitment point
      void set_funding_pubkey​(byte[] val)
      The sender's key controlling the funding transaction
      void set_funding_satoshis​(long val)
      The channel value
      void set_htlc_basepoint​(byte[] val)
      Used to derive an HTLC payment key to sender
      void set_htlc_minimum_msat​(long val)
      The minimum HTLC size incoming to sender, in milli-satoshi
      void set_max_accepted_htlcs​(short val)
      The maximum number of inbound HTLCs towards sender
      void set_max_htlc_value_in_flight_msat​(long val)
      The maximum inbound HTLC value in flight towards sender, in milli-satoshi
      void set_payment_point​(byte[] val)
      A payment key to sender for transactions broadcast by counterparty
      void set_push_msat​(long val)
      The amount to push to the counterparty as part of the open, in milli-satoshi
      void set_revocation_basepoint​(byte[] val)
      Used to derive a revocation key for transactions broadcast by counterparty
      void set_shutdown_scriptpubkey​(Option_CVec_u8ZZ val)
      A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
      void set_temporary_channel_id​(byte[] val)
      A temporary channel ID, until the funding outpoint is announced
      void set_to_self_delay​(short val)
      The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
      byte[] write()
      Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
    • Method Detail

      • get_chain_hash

        public byte[] get_chain_hash()
        The genesis hash of the blockchain where the channel is to be opened
      • set_chain_hash

        public void set_chain_hash​(byte[] val)
        The genesis hash of the blockchain where the channel is to be opened
      • get_temporary_channel_id

        public byte[] get_temporary_channel_id()
        A temporary channel ID, until the funding outpoint is announced
      • set_temporary_channel_id

        public void set_temporary_channel_id​(byte[] val)
        A temporary channel ID, until the funding outpoint is announced
      • get_funding_satoshis

        public long get_funding_satoshis()
        The channel value
      • set_funding_satoshis

        public void set_funding_satoshis​(long val)
        The channel value
      • get_push_msat

        public long get_push_msat()
        The amount to push to the counterparty as part of the open, in milli-satoshi
      • set_push_msat

        public void set_push_msat​(long val)
        The amount to push to the counterparty as part of the open, in milli-satoshi
      • get_dust_limit_satoshis

        public long get_dust_limit_satoshis()
        The threshold below which outputs on transactions broadcast by sender will be omitted
      • set_dust_limit_satoshis

        public void set_dust_limit_satoshis​(long val)
        The threshold below which outputs on transactions broadcast by sender will be omitted
      • get_max_htlc_value_in_flight_msat

        public long get_max_htlc_value_in_flight_msat()
        The maximum inbound HTLC value in flight towards sender, in milli-satoshi
      • set_max_htlc_value_in_flight_msat

        public void set_max_htlc_value_in_flight_msat​(long val)
        The maximum inbound HTLC value in flight towards sender, in milli-satoshi
      • get_channel_reserve_satoshis

        public long get_channel_reserve_satoshis()
        The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
      • set_channel_reserve_satoshis

        public void set_channel_reserve_satoshis​(long val)
        The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
      • get_htlc_minimum_msat

        public long get_htlc_minimum_msat()
        The minimum HTLC size incoming to sender, in milli-satoshi
      • set_htlc_minimum_msat

        public void set_htlc_minimum_msat​(long val)
        The minimum HTLC size incoming to sender, in milli-satoshi
      • get_feerate_per_kw

        public int get_feerate_per_kw()
        The feerate per 1000-weight of sender generated transactions, until updated by [`UpdateFee`]
      • set_feerate_per_kw

        public void set_feerate_per_kw​(int val)
        The feerate per 1000-weight of sender generated transactions, until updated by [`UpdateFee`]
      • get_to_self_delay

        public short get_to_self_delay()
        The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
      • set_to_self_delay

        public void set_to_self_delay​(short val)
        The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
      • get_max_accepted_htlcs

        public short get_max_accepted_htlcs()
        The maximum number of inbound HTLCs towards sender
      • set_max_accepted_htlcs

        public void set_max_accepted_htlcs​(short val)
        The maximum number of inbound HTLCs towards sender
      • get_funding_pubkey

        public byte[] get_funding_pubkey()
        The sender's key controlling the funding transaction
      • set_funding_pubkey

        public void set_funding_pubkey​(byte[] val)
        The sender's key controlling the funding transaction
      • get_revocation_basepoint

        public byte[] get_revocation_basepoint()
        Used to derive a revocation key for transactions broadcast by counterparty
      • set_revocation_basepoint

        public void set_revocation_basepoint​(byte[] val)
        Used to derive a revocation key for transactions broadcast by counterparty
      • get_payment_point

        public byte[] get_payment_point()
        A payment key to sender for transactions broadcast by counterparty
      • set_payment_point

        public void set_payment_point​(byte[] val)
        A payment key to sender for transactions broadcast by counterparty
      • get_delayed_payment_basepoint

        public byte[] get_delayed_payment_basepoint()
        Used to derive a payment key to sender for transactions broadcast by sender
      • set_delayed_payment_basepoint

        public void set_delayed_payment_basepoint​(byte[] val)
        Used to derive a payment key to sender for transactions broadcast by sender
      • get_htlc_basepoint

        public byte[] get_htlc_basepoint()
        Used to derive an HTLC payment key to sender
      • set_htlc_basepoint

        public void set_htlc_basepoint​(byte[] val)
        Used to derive an HTLC payment key to sender
      • get_first_per_commitment_point

        public byte[] get_first_per_commitment_point()
        The first to-be-broadcast-by-sender transaction's per commitment point
      • set_first_per_commitment_point

        public void set_first_per_commitment_point​(byte[] val)
        The first to-be-broadcast-by-sender transaction's per commitment point
      • get_channel_flags

        public byte get_channel_flags()
        The channel flags to be used
      • set_channel_flags

        public void set_channel_flags​(byte val)
        The channel flags to be used
      • get_shutdown_scriptpubkey

        public Option_CVec_u8ZZ get_shutdown_scriptpubkey()
        A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
      • set_shutdown_scriptpubkey

        public void set_shutdown_scriptpubkey​(Option_CVec_u8ZZ val)
        A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
      • get_channel_type

        @Nullable
        public ChannelTypeFeatures get_channel_type()
        The channel type that this channel will represent If this is `None`, we derive the channel type from the intersection of our feature bits with our counterparty's feature bits from the [`Init`] message. Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
      • set_channel_type

        public void set_channel_type​(@Nullable
                                     ChannelTypeFeatures val)
        The channel type that this channel will represent If this is `None`, we derive the channel type from the intersection of our feature bits with our counterparty's feature bits from the [`Init`] message. Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
      • of

        public static OpenChannel of​(byte[] chain_hash_arg,
                                     byte[] temporary_channel_id_arg,
                                     long funding_satoshis_arg,
                                     long push_msat_arg,
                                     long dust_limit_satoshis_arg,
                                     long max_htlc_value_in_flight_msat_arg,
                                     long channel_reserve_satoshis_arg,
                                     long htlc_minimum_msat_arg,
                                     int feerate_per_kw_arg,
                                     short to_self_delay_arg,
                                     short max_accepted_htlcs_arg,
                                     byte[] funding_pubkey_arg,
                                     byte[] revocation_basepoint_arg,
                                     byte[] payment_point_arg,
                                     byte[] delayed_payment_basepoint_arg,
                                     byte[] htlc_basepoint_arg,
                                     byte[] first_per_commitment_point_arg,
                                     byte channel_flags_arg,
                                     Option_CVec_u8ZZ shutdown_scriptpubkey_arg,
                                     @Nullable
                                     ChannelTypeFeatures channel_type_arg)
        Constructs a new OpenChannel given each field Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
      • eq

        public boolean eq​(OpenChannel b)
        Checks if two OpenChannels contain equal inner contents. This ignores pointers and is_owned flags and looks at the values in fields. Two objects with NULL inner values will be considered "equal" here.
      • write

        public byte[] write()
        Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read