lnd+channeldb: pre-allocate cache size

To avoid the channel map needing to be re-grown while we fill the cache
initially, we might as well pre-allocate it with a somewhat sane value
to decrease the number of grow events.
This commit is contained in:
Oliver Gugger committed 2021-09-29 17:00:05 +02:00
1 parent bf27d05aa8
commit a95a3728b5
8 files changed
+58 -16

No files matched your search

+1 -1
View File
@@ -171,7 +171,7 @@ func makeTestGraph() (*channeldb.ChannelGraph, kvdb.Backend, func(), error) {
opts := channeldb.DefaultOptions()
graph, err := channeldb.NewChannelGraph(
backend, opts.RejectCacheSize, opts.ChannelCacheSize,
opts.BatchCommitInterval,
opts.BatchCommitInterval, opts.PreAllocCacheNumNodes,
)
if err != nil {
cleanUp()