lnd/blockcache
yyforyongyu 4ee862e3be
blockcache: fix heap escape in GetBlock
This commit fixes a heap escape found in `GetBlock`. This happens
because the `msgBlock` is a pointer returned from `getBlockImpl`, and
the whole `getBlockImpl` escapes to the heap because it's referenced in
two places,
- in the `Cache`, it's used as a reference type to create the new block.
- this pointer is also returned and now needs to stay on the heap.

The fix is simple, we now make a copy of the block and use the copy
instead, freeing `getBlockImpl` from the heap.
2024-01-23 17:08:57 +08:00
..
blockcache_test.go multi: bump neutrino+btcwallet versions, use new generic lru cache 2023-02-21 17:28:48 -08:00
blockcache.go blockcache: fix heap escape in GetBlock 2024-01-23 17:08:57 +08:00