core,eth: add debug_setTrieFlushInterval to change trie flush frequency (#24785)

This PR makes it possible to modify the flush interval time via RPC. On one extreme, `0s`, it would act as an archive node. If set to `1h`, means that after one hour of effective block processing time, the trie would be flushed. If one block takes 200ms, this means that a flush would occur every `5*3600=18000`  blocks -- however, if the memory size of the cached states grows too large, it will flush sooner. 

Essentially, this makes it possible to configure the node to be more or less "archive:ish", and without restarting the node while reconfiguring it.
This commit is contained in:
Sina Mahmoodi
2022-12-09 07:40:17 -05:00
committed by GitHub
parent 890e2efca2
commit 711afbc7fd
3 changed files with 77 additions and 51 deletions
+5
View File
@@ -490,6 +490,11 @@ web3._extend({
call: 'debug_dbAncients',
params: 0
}),
new web3._extend.Method({
name: 'setTrieFlushInterval',
call: 'debug_setTrieFlushInterval',
params: 1
}),
],
properties: []
});