mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge f50fb178c3 into merged_master (Bitcoin PR bitcoin/bitcoin#27235)
This commit is contained in:
commit
7787be135b
2 changed files with 11 additions and 2 deletions
|
|
@ -1772,10 +1772,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
|
||||
// On first startup, warn on low block storage space
|
||||
if (!fReindex && !fReindexChainState && chain_active_height <= 1) {
|
||||
uint64_t assumed_chain_bytes{chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024};
|
||||
uint64_t additional_bytes_needed{
|
||||
chainman.m_blockman.IsPruneMode() ?
|
||||
chainman.m_blockman.GetPruneTarget() :
|
||||
chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024};
|
||||
std::min(chainman.m_blockman.GetPruneTarget(), assumed_chain_bytes) :
|
||||
assumed_chain_bytes};
|
||||
|
||||
if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) {
|
||||
InitWarning(strprintf(_(
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class BlockchainTest(BitcoinTestFramework):
|
|||
|
||||
def run_test(self):
|
||||
self.wallet = MiniWallet(self.nodes[0])
|
||||
self._test_prune_disk_space()
|
||||
self.mine_chain()
|
||||
self._test_max_future_block_time()
|
||||
self.restart_node(
|
||||
|
|
@ -99,6 +100,13 @@ class BlockchainTest(BitcoinTestFramework):
|
|||
self.generate(self.wallet, 1)
|
||||
assert_equal(self.nodes[0].getblockchaininfo()['blocks'], HEIGHT)
|
||||
|
||||
def _test_prune_disk_space(self):
|
||||
self.log.info("Test that a manually pruned node does not run into "
|
||||
"integer overflow on first start up")
|
||||
self.restart_node(0, extra_args=["-prune=1"])
|
||||
self.log.info("Avoid warning when assumed chain size is enough")
|
||||
self.restart_node(0, extra_args=["-prune=123456789"])
|
||||
|
||||
def _test_max_future_block_time(self):
|
||||
self.stop_node(0)
|
||||
self.log.info("A block tip of more than MAX_FUTURE_BLOCK_TIME in the future raises an error")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue