Skip to content

Commit eca3a10

Browse files
committed
lnwallet: reorder PaymentDescriptor attributes to reduce padding
1 parent 9ff4a7a commit eca3a10

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

lnwallet/channel.go

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type updateType uint8
9999

100100
const (
101101
// Add is an update type that adds a new HTLC entry into the log.
102-
// Either side can add a new penidng HTLC by adding a new Add entry
102+
// Either side can add a new pending HTLC by adding a new Add entry
103103
// into their update log.
104104
Add updateType = iota
105105

@@ -150,15 +150,6 @@ type PaymentDescriptor struct {
150150
// settles or times out.
151151
ParentIndex uint64
152152

153-
// Payload is an opaque blob which is used to complete multi-hop
154-
// routing.
155-
Payload []byte
156-
157-
// EntryType denotes the exact type of the PaymentDescriptor. In the
158-
// case of a Timeout, or Settle type, then the Parent field will point
159-
// into the log to the HTLC being modified.
160-
EntryType updateType
161-
162153
// addCommitHeight[Remote|Local] encodes the height of the commitment
163154
// which included this HTLC on either the remote or local commitment
164155
// chain. This value is used to determine when an HTLC is fully
@@ -174,24 +165,36 @@ type PaymentDescriptor struct {
174165
removeCommitHeightRemote uint64
175166
removeCommitHeightLocal uint64
176167

177-
// isForwarded denotes if an incoming HTLC has been forwarded to any
178-
// possible upstream peers in the route.
179-
isForwarded bool
168+
// Payload is an opaque blob which is used to complete multi-hop
169+
// routing.
170+
Payload []byte
171+
172+
// [our|their|]PkScript are the raw public key scripts that encodes the
173+
// redemption rules for this particular HTLC. These fields will only be
174+
// populated iff the EntryType of this PaymentDescriptor is Add.
175+
// ourPkScript is the ourPkScript from the context of our local
176+
// commitment chain. theirPkScript is the latest pkScript from the
177+
// context of the remote commitment chain.
178+
//
179+
// NOTE: These values may change within the logs themselves, however,
180+
// they'll stay consistent within the commitment chain entries
181+
// themselves.
182+
ourPkScript []byte
183+
theirPkScript []byte
180184

181-
// [our|their|theirPrev]PkScript are the raw public key scripts that
182-
// encodes the redemption rules for this particular HTLC. These fields
183-
// will only be populated iff the EntryType of this PaymentDescriptor
184-
// is Add. ourPkScript is the ourPkScript from the context of our local
185-
// commitment chain. [their|theirPrev]PkScript are the two latest
186-
// pkScripts from the context of the remote commitment chain.
187-
ourPkScript []byte
188-
theirPkScript []byte
189-
theirPrevPkScript []byte
185+
// EntryType denotes the exact type of the PaymentDescriptor. In the
186+
// case of a Timeout, or Settle type, then the Parent field will point
187+
// into the log to the HTLC being modified.
188+
EntryType updateType
190189

191190
// isDust[Local|Remote] denotes if this HTLC is below the dust limit in
192191
// locally or remotely.
193192
isDustLocal bool
194193
isDustRemote bool
194+
195+
// isForwarded denotes if an incoming HTLC has been forwarded to any
196+
// possible upstream peers in the route.
197+
isForwarded bool
195198
}
196199

197200
// commitment represents a commitment to a new state within an active channel.

0 commit comments

Comments
 (0)