Object

fr.acinq.eclair.channel.Helpers

Closing

Related Doc: package Helpers

Permalink

object Closing

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Closing
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait ClosingType extends AnyRef

    Permalink
  2. sealed trait RemoteClose extends ClosingType

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object CurrentRemoteClose extends RemoteClose with Product with Serializable

    Permalink
  5. object LocalClose extends ClosingType with Product with Serializable

    Permalink
  6. object MutualClose extends ClosingType with Product with Serializable

    Permalink
  7. object NextRemoteClose extends RemoteClose with Product with Serializable

    Permalink
  8. object RecoveryClose extends ClosingType with Product with Serializable

    Permalink
  9. object RevokedClose extends ClosingType with Product with Serializable

    Permalink
  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. def checkClosingSignature(keyManager: KeyManager, commitments: Commitments, localScriptPubkey: ByteVector, remoteScriptPubkey: ByteVector, remoteClosingFee: Satoshi, remoteClosingSig: ByteVector64)(implicit log: LoggingAdapter): Try[Transaction]

    Permalink
  12. def claimCurrentLocalCommitTxOutputs(keyManager: KeyManager, commitments: Commitments, tx: Transaction, feeEstimator: FeeEstimator, feeTargets: FeeTargets)(implicit log: LoggingAdapter): LocalCommitPublished

    Permalink

    Claim all the HTLCs that we've received from our current commit tx.

    Claim all the HTLCs that we've received from our current commit tx. This will be done using 2nd stage HTLC transactions

    commitments

    our commitment data, which include payment preimages

    returns

    a list of transactions (one per HTLC that we can claim)

  13. def claimRemoteCommitMainOutput(keyManager: KeyManager, commitments: Commitments, remotePerCommitmentPoint: PublicKey, tx: Transaction, feeEstimator: FeeEstimator, feeTargets: FeeTargets)(implicit log: LoggingAdapter): RemoteCommitPublished

    Permalink

    Claim our Main output only

    Claim our Main output only

    commitments

    either our current commitment data in case of usual remote uncooperative closing or our outdated commitment data in case of data loss protection procedure; in any case it is used only to get some constant parameters, not commitment data

    remotePerCommitmentPoint

    the remote perCommitmentPoint corresponding to this commitment

    tx

    the remote commitment transaction that has just been published

    returns

    a list of transactions (one per HTLC that we can claim)

  14. def claimRemoteCommitTxOutputs(keyManager: KeyManager, commitments: Commitments, remoteCommit: RemoteCommit, tx: Transaction, feeEstimator: FeeEstimator, feeTargets: FeeTargets)(implicit log: LoggingAdapter): RemoteCommitPublished

    Permalink

    Claim all the HTLCs that we've received from their current commit tx

    Claim all the HTLCs that we've received from their current commit tx

    commitments

    our commitment data, which include payment preimages

    remoteCommit

    the remote commitment data to use to claim outputs (it can be their current or next commitment)

    tx

    the remote commitment transaction that has just been published

    returns

    a list of transactions (one per HTLC that we can claim)

  15. def claimRevokedHtlcTxOutputs(keyManager: KeyManager, commitments: Commitments, revokedCommitPublished: RevokedCommitPublished, htlcTx: Transaction, feeEstimator: FeeEstimator)(implicit log: LoggingAdapter): (RevokedCommitPublished, Option[Transaction])

    Permalink

    Claims the output of an HtlcSuccessTx or HtlcTimeoutTx transaction using a revocation key.

    Claims the output of an HtlcSuccessTx or HtlcTimeoutTx transaction using a revocation key.

    In case a revoked commitment with pending HTLCs is published, there are two ways the HTLC outputs can be taken as punishment: - by spending the corresponding output of the commitment tx, using HtlcPenaltyTx that we generate as soon as we detect that a revoked commit as been spent; note that those transactions will compete with HtlcSuccessTx and HtlcTimeoutTx published by the counterparty. - by spending the delayed output of HtlcSuccessTx and HtlcTimeoutTx if those get confirmed; because the output of these txes is protected by an OP_CSV delay, we will have time to spend them with a revocation key. In that case, we generate the spending transactions "on demand", this is the purpose of this method.

  16. def claimRevokedRemoteCommitTxOutputs(keyManager: KeyManager, commitments: Commitments, tx: Transaction, db: ChannelsDb, feeEstimator: FeeEstimator, feeTargets: FeeTargets)(implicit log: LoggingAdapter): Option[RevokedCommitPublished]

    Permalink

    When an unexpected transaction spending the funding tx is detected: 1) we find out if the published transaction is one of remote's revoked txs 2) and then: a) if it is a revoked tx we build a set of transactions that will punish them by stealing all their funds b) otherwise there is nothing we can do

    When an unexpected transaction spending the funding tx is detected: 1) we find out if the published transaction is one of remote's revoked txs 2) and then: a) if it is a revoked tx we build a set of transactions that will punish them by stealing all their funds b) otherwise there is nothing we can do

    returns

    a RevokedCommitPublished object containing penalty transactions if the tx is a revoked commitment

  17. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. lazy val dummyPublicKey: PublicKey

    Permalink
  19. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  21. def extractPreimages(localCommit: LocalCommit, tx: Transaction)(implicit log: LoggingAdapter): Set[(UpdateAddHtlc, UpdateFulfillHtlc)]

    Permalink

    In CLOSING state, any time we see a new transaction, we try to extract a preimage from it in order to fulfill the corresponding incoming htlc in an upstream channel.

    In CLOSING state, any time we see a new transaction, we try to extract a preimage from it in order to fulfill the corresponding incoming htlc in an upstream channel.

    Not doing that would result in us losing money, because the downstream node would pull money from one side, and the upstream node would get refunded after a timeout.

    returns

    a set of pairs (add, fulfills) if extraction was successful:

    • add is the htlc in the downstream channel from which we extracted the preimage
    • fulfill needs to be sent to the upstream channel
  22. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def firstClosingFee(commitments: Commitments, localScriptPubkey: ByteVector, remoteScriptPubkey: ByteVector, feeEstimator: FeeEstimator, feeTargets: FeeTargets)(implicit log: LoggingAdapter): Satoshi

    Permalink
  24. def firstClosingFee(commitments: Commitments, localScriptPubkey: ByteVector, remoteScriptPubkey: ByteVector, feeratePerKw: Long)(implicit log: LoggingAdapter): Satoshi

    Permalink
  25. def generateTx(desc: String)(attempt: Try[TransactionWithInputInfo])(implicit log: LoggingAdapter): Option[TransactionWithInputInfo]

    Permalink
  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  28. def inputsAlreadySpent(tx: Transaction, irrevocablySpent: Map[OutPoint, ByteVector32]): Boolean

    Permalink

    This helper function tells if the utxo consumed by the given transaction has already been irrevocably spent (possibly by this very transaction)

    This helper function tells if the utxo consumed by the given transaction has already been irrevocably spent (possibly by this very transaction)

    It can be useful to:

    • not attempt to publish this tx when we know this will fail
    • not watch for confirmations if we know the tx is already confirmed
    • not watch the corresponding utxo when we already know the final spending tx
    tx

    a tx with only one input

    irrevocablySpent

    a map of known spent outpoints

    returns

    true if we know for sure that the utxos consumed by the tx have already irrevocably been spent, false otherwise

  29. def isClosed(data: HasCommitments, additionalConfirmedTx_opt: Option[Transaction]): Option[ClosingType]

    Permalink

    Checks if a channel is closed (i.e.

    Checks if a channel is closed (i.e. its closing tx has been confirmed)

    data

    channel state data

    additionalConfirmedTx_opt

    additional confirmed transaction; we need this for the mutual close scenario because we don't store the closing tx in the channel state

    returns

    the channel closing type, if applicable

  30. def isClosingTypeAlreadyKnown(closing: DATA_CLOSING): Option[ClosingType]

    Permalink

    As soon as a tx spending the funding tx has reached min_depth, we know what the closing type will be, before the whole closing process finishes(e.g.

    As soon as a tx spending the funding tx has reached min_depth, we know what the closing type will be, before the whole closing process finishes(e.g. there may still be delayed or unconfirmed child transactions). It can save us from attempting to publish some transactions.

    Note that we can't tell for mutual close before it is already final, because only one tx needs to be confirmed.

    closing

    channel state data

    returns

    the channel closing type, if applicable

  31. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  32. def isLocalCommitDone(localCommitPublished: LocalCommitPublished): Boolean

    Permalink

    A local commit is considered done when: - all commitment tx outputs that we can spend have been spent and confirmed (even if the spending tx was not ours) - all 3rd stage txes (txes spending htlc txes) have been confirmed

  33. def isRemoteCommitDone(remoteCommitPublished: RemoteCommitPublished): Boolean

    Permalink

    A remote commit is considered done when all commitment tx outputs that we can spend have been spent and confirmed (even if the spending tx was not ours).

  34. def isRevokedCommitDone(revokedCommitPublished: RevokedCommitPublished): Boolean

    Permalink

    A remote commit is considered done when all commitment tx outputs that we can spend have been spent and confirmed (even if the spending tx was not ours).

  35. def isValidFinalScriptPubkey(scriptPubKey: ByteVector): Boolean

    Permalink
  36. def makeClosingTx(keyManager: KeyManager, commitments: Commitments, localScriptPubkey: ByteVector, remoteScriptPubkey: ByteVector, closingFee: Satoshi)(implicit log: LoggingAdapter): (ClosingTx, ClosingSigned)

    Permalink
  37. def makeFirstClosingTx(keyManager: KeyManager, commitments: Commitments, localScriptPubkey: ByteVector, remoteScriptPubkey: ByteVector, feeEstimator: FeeEstimator, feeTargets: FeeTargets)(implicit log: LoggingAdapter): (ClosingTx, ClosingSigned)

    Permalink
  38. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  39. def networkFeePaid(tx: Transaction, d: DATA_CLOSING): Option[(Satoshi, String)]

    Permalink

    This helper function returns the fee paid by the given transaction.

    This helper function returns the fee paid by the given transaction.

    It relies on the current channel data to find the parent tx and compute the fee, and also provides a description.

    tx

    a tx for which we want to compute the fee

    d

    current channel data

    returns

    if the parent tx is found, a tuple (fee, description)

  40. def nextClosingFee(localClosingFee: Satoshi, remoteClosingFee: Satoshi): Satoshi

    Permalink
  41. def nothingAtStake(data: HasCommitments): Boolean

    Permalink

    Indicates whether local has anything at stake in this channel

    Indicates whether local has anything at stake in this channel

    returns

    true if channel was never open, or got closed immediately, had never any htlcs and local never had a positive balance

  42. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  43. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  44. def onchainOutgoingHtlcs(localCommit: LocalCommit, remoteCommit: RemoteCommit, nextRemoteCommit_opt: Option[RemoteCommit], tx: Transaction): Set[UpdateAddHtlc]

    Permalink

    As soon as a local or remote commitment reaches min_depth, we know which htlcs will be settled on-chain (whether or not they actually have an output in the commitment tx).

    As soon as a local or remote commitment reaches min_depth, we know which htlcs will be settled on-chain (whether or not they actually have an output in the commitment tx).

    tx

    a transaction that is sufficiently buried in the blockchain

  45. def overriddenOutgoingHtlcs(localCommit: LocalCommit, remoteCommit: RemoteCommit, nextRemoteCommit_opt: Option[RemoteCommit], tx: Transaction)(implicit log: LoggingAdapter): Set[UpdateAddHtlc]

    Permalink

    If a local commitment tx reaches min_depth, we need to fail the outgoing htlcs that only us had signed, because they will never reach the blockchain.

    If a local commitment tx reaches min_depth, we need to fail the outgoing htlcs that only us had signed, because they will never reach the blockchain.

    Those are only present in the remote's commitment.

  46. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  47. def timedoutHtlcs(remoteCommit: RemoteCommit, remoteDustLimit: Satoshi, tx: Transaction)(implicit log: LoggingAdapter): Set[UpdateAddHtlc]

    Permalink

    In CLOSING state, when we are notified that a transaction has been confirmed, we analyze it to find out if one or more htlcs have timed out and need to be failed in an upstream channel.

    In CLOSING state, when we are notified that a transaction has been confirmed, we analyze it to find out if one or more htlcs have timed out and need to be failed in an upstream channel.

    tx

    a tx that has reached mindepth

    returns

    a set of htlcs that need to be failed upstream

  48. def timedoutHtlcs(localCommit: LocalCommit, localDustLimit: Satoshi, tx: Transaction)(implicit log: LoggingAdapter): Set[UpdateAddHtlc]

    Permalink

    In CLOSING state, when we are notified that a transaction has been confirmed, we analyze it to find out if one or more htlcs have timed out and need to be failed in an upstream channel.

    In CLOSING state, when we are notified that a transaction has been confirmed, we analyze it to find out if one or more htlcs have timed out and need to be failed in an upstream channel.

    tx

    a tx that has reached mindepth

    returns

    a set of htlcs that need to be failed upstream

  49. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  50. def updateLocalCommitPublished(localCommitPublished: LocalCommitPublished, tx: Transaction): LocalCommitPublished

    Permalink

    In CLOSING state, when we are notified that a transaction has been confirmed, we check if this tx belongs in the local commit scenario and keep track of it.

    In CLOSING state, when we are notified that a transaction has been confirmed, we check if this tx belongs in the local commit scenario and keep track of it.

    We need to keep track of all transactions spending the outputs of the commitment tx, because some outputs can be spent both by us and our counterparty. Because of that, some of our transactions may never confirm and we don't want to wait forever before declaring that the channel is CLOSED.

    tx

    a transaction that has been irrevocably confirmed

  51. def updateRemoteCommitPublished(remoteCommitPublished: RemoteCommitPublished, tx: Transaction): RemoteCommitPublished

    Permalink

    In CLOSING state, when we are notified that a transaction has been confirmed, we check if this tx belongs in the remote commit scenario and keep track of it.

    In CLOSING state, when we are notified that a transaction has been confirmed, we check if this tx belongs in the remote commit scenario and keep track of it.

    We need to keep track of all transactions spending the outputs of the commitment tx, because some outputs can be spent both by us and our counterparty. Because of that, some of our transactions may never confirm and we don't want to wait forever before declaring that the channel is CLOSED.

    tx

    a transaction that has been irrevocably confirmed

  52. def updateRevokedCommitPublished(revokedCommitPublished: RevokedCommitPublished, tx: Transaction): RevokedCommitPublished

    Permalink

    In CLOSING state, when we are notified that a transaction has been confirmed, we check if this tx belongs in the revoked commit scenario and keep track of it.

    In CLOSING state, when we are notified that a transaction has been confirmed, we check if this tx belongs in the revoked commit scenario and keep track of it.

    We need to keep track of all transactions spending the outputs of the commitment tx, because some outputs can be spent both by us and our counterparty. Because of that, some of our transactions may never confirm and we don't want to wait forever before declaring that the channel is CLOSED.

    tx

    a transaction that has been irrevocably confirmed

  53. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped