lnwallet/channel: add restoration sanity check
To avoid more bugs slipping through where the logIndex is not set, we panic to catch this. This was earlier done for Adds and the htlcCounter, which did lead us to find the resulting retoration bug.
This commit is contained in:
parent
9a0f87fd8e
commit
47918bd6ce
@ -1816,6 +1816,14 @@ func (lc *LightningChannel) restoreStateLogs(
|
||||
"using %v", payDesc.LogIndex)
|
||||
}
|
||||
|
||||
// At this point the restored update's logIndex must be equal
|
||||
// to the update log, otherwise somthing is horribly wrong.
|
||||
if payDesc.LogIndex != lc.localUpdateLog.logIndex {
|
||||
panic(fmt.Sprintf("log index mismatch: "+
|
||||
"%v vs %v", payDesc.LogIndex,
|
||||
lc.localUpdateLog.logIndex))
|
||||
}
|
||||
|
||||
switch payDesc.EntryType {
|
||||
case Add:
|
||||
// The HtlcIndex of the added HTLC _must_ be equal to
|
||||
|
Loading…
Reference in New Issue
Block a user