lnwallet: fix invalid value use in restoreUpdate
Updates were always restored with the same log index. This could cause a crash when the logs were compacted and possibly other problems elsewhere. Extended unit test to cover the crash scenario.
This commit is contained in:
2 files changed
+16
-2
No files matched your search
+1
-1
@@ -1064,7 +1064,7 @@ func (u *updateLog) appendUpdate(pd *PaymentDescriptor) {
|
||||
// also added to index accordingly. This function differs from appendUpdate in
|
||||
// that it won't increment the log index counter.
|
||||
func (u *updateLog) restoreUpdate(pd *PaymentDescriptor) {
|
||||
u.updateIndex[u.logIndex] = u.PushBack(pd)
|
||||
u.updateIndex[pd.LogIndex] = u.PushBack(pd)
|
||||
}
|
||||
|
||||
// appendHtlc appends a new HTLC offer to the tip of the update log. The entry
|
||||
|
||||
Reference in new issue
Block a user