What changed, and why it matters
This commit is a simple code reorganization: it moves a data type called LogUpdate from one internal package (channeldb) to another (chanstate), and creates a type alias so existing code can still use the old name. There is no change to behavior, no bug fix, and no security relevance visible in the diff.
No security action needed. Review as ordinary refactoring if required by project workflow.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The LogUpdate struct is relocated from channeldb/channel.go to chanstate/commitment.go. channeldb now exposes LogUpdate as a type alias to cstate.LogUpdate. The serialization helpers serializeLogUpdate and deserializeLogUpdate remain in channeldb, and the struct fields and comments are unchanged. This is a pure refactor to remove an import dependency for future commitment store interfaces.
Changed components
channeldb/channel.gochanstate/commitment.goInspect captured patch +18 / −14
diff --git a/channeldb/channel.go b/channeldb/channel.go
index 40cb9f0..e4f12ee 100644
--- a/channeldb/channel.go
+++ b/channeldb/channel.go
@@ -234,6 +234,10 @@ type (
// HTLC is the on-disk representation of a hash time-locked contract.
HTLC = cstate.HTLC
+
+ // LogUpdate represents a pending update to the remote commitment
+ // chain.
+ LogUpdate = cstate.LogUpdate
)
// openChannelTlvData houses the new data fields that are stored for each
@@ -2722,20 +2726,6 @@ func DeserializeHtlcs(r io.Reader) ([]HTLC, error) {
return htlcs, nil
}
-// LogUpdate represents a pending update to the remote commitment chain. The
-// log update may be an add, fail, or settle entry. We maintain this data in
-// order to be able to properly retransmit our proposed state if necessary.
-type LogUpdate struct {
- // LogIndex is the log index of this proposed commitment update entry.
- LogIndex uint64
-
- // UpdateMsg is the update message that was included within our
- // local update log. The LogIndex value denotes the log index of this
- // update which will be used when restoring our local update log if
- // we're left with a dangling update on restart.
- UpdateMsg lnwire.Message
-}
-
// serializeLogUpdate writes a log update to the provided io.Writer.
func serializeLogUpdate(w io.Writer, l *LogUpdate) error {
return WriteElements(w, l.LogIndex, l.UpdateMsg)
diff --git a/chanstate/commitment.go b/chanstate/commitment.go
index 3132ddb..6f7bc77 100644
--- a/chanstate/commitment.go
+++ b/chanstate/commitment.go
@@ -215,3 +215,17 @@ func (h *HTLC) Copy() HTLC {
return clone
}
+
+// LogUpdate represents a pending update to the remote commitment chain. The
+// log update may be an add, fail, or settle entry. We maintain this data in
+// order to be able to properly retransmit our proposed state if necessary.
+type LogUpdate struct {
+ // LogIndex is the log index of this proposed commitment update entry.
+ LogIndex uint64
+
+ // UpdateMsg is the update message that was included within our
+ // local update log. The LogIndex value denotes the log index of this
+ // update which will be used when restoring our local update log if
+ // we're left with a dangling update on restart.
+ UpdateMsg lnwire.Message
+}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.