mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2026-02-23 15:34:22 +01:00
discovery/gossiper: copy bolt key to prevent panic
Corrects an instance that holds a reference to a boltdb byte slice after returning from the transaction. This can cause panics under certain conditions, which is avoided by creating a copy of the key.
This commit is contained in:
@@ -796,7 +796,13 @@ func (d *AuthenticatedGossiper) resendAnnounceSignatures() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t := msgTuple{peer, msg, k}
|
||||
|
||||
// Make a copy of the database key corresponding to
|
||||
// these AnnounceSignatures.
|
||||
dbKey := make([]byte, len(k))
|
||||
copy(dbKey, k)
|
||||
|
||||
t := msgTuple{peer, msg, dbKey}
|
||||
|
||||
// Add the message to the slice, such that we can
|
||||
// resend it after the database transaction is over.
|
||||
|
||||
Reference in New Issue
Block a user