lnwallet: pack paymentDescriptor add/remove heights into Duals
The purpose of this commit is to begin the process of packing symmetric fields into the newly introduced Dual structure. The reason for this is that the Dual structure has a handy indexing method where we can supply a ChannelParty and get back a value. This will cut down on the amount of branching code in the main lines of the codebase logic, making it easier to follow what is going on.
This commit is contained in:
5 files changed
+301
-224
No files matched your search
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/models"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
@@ -165,16 +166,14 @@ type paymentDescriptor struct {
|
||||
// which included this HTLC on either the remote or local commitment
|
||||
// chain. This value is used to determine when an HTLC is fully
|
||||
// "locked-in".
|
||||
addCommitHeightRemote uint64
|
||||
addCommitHeightLocal uint64
|
||||
addCommitHeights lntypes.Dual[uint64]
|
||||
|
||||
// removeCommitHeight[Remote|Local] encodes the height of the
|
||||
// commitment which removed the parent pointer of this
|
||||
// paymentDescriptor either due to a timeout or a settle. Once both
|
||||
// these heights are below the tail of both chains, the log entries can
|
||||
// safely be removed.
|
||||
removeCommitHeightRemote uint64
|
||||
removeCommitHeightLocal uint64
|
||||
removeCommitHeights lntypes.Dual[uint64]
|
||||
|
||||
// OnionBlob is an opaque blob which is used to complete multi-hop
|
||||
// routing.
|
||||
|
||||
Reference in new issue
Block a user