Merge pull request #7445 from yyforyongyu/fix-heap

discovery: fix heap escape on `cachedMsgs`
This commit is contained in:
Olaoluwa Osuntokun 2023-02-23 16:24:22 -08:00 committed by GitHub
commit 9f1daf31c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1905,9 +1905,10 @@ func (d *AuthenticatedGossiper) isPremature(chanID lnwire.ShortChannelID,
pMsg := &processedNetworkMsg{msg: copied}
// Add the network message.
cachedMsgs.msgs = append(cachedMsgs.msgs, pMsg)
msgs := cachedMsgs.msgs
msgs = append(msgs, pMsg)
_, err = d.futureMsgs.Put(msgHeight, &cachedNetworkMsg{
msgs: cachedMsgs.msgs,
msgs: msgs,
})
if err != nil {
log.Errorf("Adding future message got error: %v", err)