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:
Conner Fromknecht 2018-07-30 18:30:19 -07:00
parent 2e6e2a06c1
commit 54c4b09f87
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -796,7 +796,13 @@ func (d *AuthenticatedGossiper) resendAnnounceSignatures() error {
if err != nil { if err != nil {
return err 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 // Add the message to the slice, such that we can
// resend it after the database transaction is over. // resend it after the database transaction is over.