From 2e3246aafe93b78e990b3b07c2dc713832696f3b Mon Sep 17 00:00:00 2001 From: eugene Date: Tue, 17 May 2022 11:14:40 -0400 Subject: [PATCH 1/2] channeldb: copy value from boltdb's Get instead of using it directly This can cause an intermittent panic otherwise if bbolt remaps itself via munmap and mmap. From bbolt's documentation: * Byte slices returned from Bolt are only valid during a transaction. Once the transaction has been committed or rolled back then the memory they point to can be reused by a new page or can be unmapped from virtual memory and you'll see an unexpected fault address panic when accessing it. --- channeldb/db.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/channeldb/db.go b/channeldb/db.go index b1e202c73..a1979b7d0 100644 --- a/channeldb/db.go +++ b/channeldb/db.go @@ -1254,11 +1254,13 @@ func (c *ChannelStateDB) GetChannelOpeningState(outPoint []byte) ([]byte, error) return ErrChannelNotFound } - serializedState = bucket.Get(outPoint) - if serializedState == nil { + stateBytes := bucket.Get(outPoint) + if stateBytes == nil { return ErrChannelNotFound } + serializedState = append(serializedState, stateBytes...) + return nil }, func() { serializedState = nil From 759d74ee1545b390eb12b7d2c733167435f654b6 Mon Sep 17 00:00:00 2001 From: eugene Date: Tue, 17 May 2022 11:27:11 -0400 Subject: [PATCH 2/2] release-notes: update for 0.15.0 --- docs/release-notes/release-notes-0.15.0.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release-notes/release-notes-0.15.0.md b/docs/release-notes/release-notes-0.15.0.md index e626901f5..adb068db5 100644 --- a/docs/release-notes/release-notes-0.15.0.md +++ b/docs/release-notes/release-notes-0.15.0.md @@ -169,6 +169,9 @@ from occurring that would result in an erroneous force close.](https://github.co * [Taproot wallet inputs can also be used to fund channels](https://github.com/lightningnetwork/lnd/pull/6521) +* [Fixed an intermittent panic that would occur due to a violated assumption with our + underlying database.](https://github.com/lightningnetwork/lnd/pull/6547) + ## Routing * [Add a new `time_pref` parameter to the QueryRoutes and SendPayment APIs](https://github.com/lightningnetwork/lnd/pull/6024) that