mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 14:40:30 +01:00
lnwallet: expand attributes in ResolutionReq
In this commit, we add some additional attributes to the ResolutionReq struct. These will be used to make sure that we can properly handle all the HTLC variants, on chain. The `AuxSigDesc` will be used to communicate if an HTLC needs to go to the second level or not. It contains the second-level sig information needed to finalize a broadcast to the second level.
This commit is contained in:
parent
31ace742a5
commit
a5beb340e4
1 changed files with 37 additions and 1 deletions
|
@ -3,6 +3,7 @@ package lnwallet
|
||||||
import (
|
import (
|
||||||
"github.com/btcsuite/btcd/btcutil"
|
"github.com/btcsuite/btcd/btcutil"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/fn"
|
"github.com/lightningnetwork/lnd/fn"
|
||||||
"github.com/lightningnetwork/lnd/input"
|
"github.com/lightningnetwork/lnd/input"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
@ -24,6 +25,19 @@ const (
|
||||||
Breach
|
Breach
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// AuxSigDesc stores optional information related to 2nd level HTLCs for aux
|
||||||
|
// channels.
|
||||||
|
type AuxSigDesc struct {
|
||||||
|
// AuxSig is the second-level signature for the HTLC that we are trying
|
||||||
|
// to resolve. This is only present if this is a resolution request for
|
||||||
|
// an HTLC on our commitment transaction.
|
||||||
|
AuxSig []byte
|
||||||
|
|
||||||
|
// SignDetails is the sign details for the second-level HTLC. This may
|
||||||
|
// be used to generate the second signature needed for broadcast.
|
||||||
|
SignDetails input.SignDetails
|
||||||
|
}
|
||||||
|
|
||||||
// ResolutionReq is used to ask an outside sub-system for additional
|
// ResolutionReq is used to ask an outside sub-system for additional
|
||||||
// information needed to resolve a contract.
|
// information needed to resolve a contract.
|
||||||
type ResolutionReq struct {
|
type ResolutionReq struct {
|
||||||
|
@ -31,6 +45,9 @@ type ResolutionReq struct {
|
||||||
// resolve.
|
// resolve.
|
||||||
ChanPoint wire.OutPoint
|
ChanPoint wire.OutPoint
|
||||||
|
|
||||||
|
// ChanType is the type of the channel that we are trying to resolve.
|
||||||
|
ChanType channeldb.ChannelType
|
||||||
|
|
||||||
// ShortChanID is the short channel ID of the channel that we are
|
// ShortChanID is the short channel ID of the channel that we are
|
||||||
// trying to resolve.
|
// trying to resolve.
|
||||||
ShortChanID lnwire.ShortChannelID
|
ShortChanID lnwire.ShortChannelID
|
||||||
|
@ -44,6 +61,13 @@ type ResolutionReq struct {
|
||||||
// FundingBlob is an optional funding blob for the channel.
|
// FundingBlob is an optional funding blob for the channel.
|
||||||
FundingBlob fn.Option[tlv.Blob]
|
FundingBlob fn.Option[tlv.Blob]
|
||||||
|
|
||||||
|
// HtlcID is the ID of the HTLC that we are trying to resolve. This is
|
||||||
|
// only set if this is a resolution request for an HTLC.
|
||||||
|
HtlcID fn.Option[input.HtlcIndex]
|
||||||
|
|
||||||
|
// HtlcAmt is the amount of the HTLC that we are trying to resolve.
|
||||||
|
HtlcAmt btcutil.Amount
|
||||||
|
|
||||||
// Type is the type of the witness that we are trying to resolve.
|
// Type is the type of the witness that we are trying to resolve.
|
||||||
Type input.WitnessType
|
Type input.WitnessType
|
||||||
|
|
||||||
|
@ -69,14 +93,26 @@ type ResolutionReq struct {
|
||||||
// CsvDelay is the CSV delay for the local output for this commitment.
|
// CsvDelay is the CSV delay for the local output for this commitment.
|
||||||
CsvDelay uint32
|
CsvDelay uint32
|
||||||
|
|
||||||
|
// CommitCsvDelay is the CSV delay for the remote output for this
|
||||||
|
// commitment.
|
||||||
|
CommitCsvDelay uint32
|
||||||
|
|
||||||
// BreachCsvDelay is the CSV delay for the remote output. This is only
|
// BreachCsvDelay is the CSV delay for the remote output. This is only
|
||||||
// set when the CloseType is Breach. This indicates the CSV delay to
|
// set when the CloseType is Breach. This indicates the CSV delay to
|
||||||
// use for the remote party's to_local delayed output, that is now
|
// use for the remote party's to_local delayed output, that is now
|
||||||
// rightfully ours in a breach situation.
|
// rightfully ours in a breach situation.
|
||||||
BreachCsvDelay fn.Option[uint32]
|
BreachCsvDelay fn.Option[uint32]
|
||||||
|
|
||||||
// CltvDelay is the CLTV delay for the outpoint.
|
// CltvDelay is the CLTV delay for the outpoint/transaction.
|
||||||
CltvDelay fn.Option[uint32]
|
CltvDelay fn.Option[uint32]
|
||||||
|
|
||||||
|
// PayHash is the payment hash for the HTLC that we are trying to
|
||||||
|
// resolve. This is optional as it only applies HTLC outputs.
|
||||||
|
PayHash fn.Option[[32]byte]
|
||||||
|
|
||||||
|
// AuxSigDesc is an optional field that contains additional information
|
||||||
|
// needed to sweep second level HTLCs.
|
||||||
|
AuxSigDesc fn.Option[AuxSigDesc]
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuxContractResolver is an interface that is used to resolve contracts that
|
// AuxContractResolver is an interface that is used to resolve contracts that
|
||||||
|
|
Loading…
Add table
Reference in a new issue