Skip to content

Commit eed85dc

Browse files
committed
getblockchaininfo: add trim_headers field
1 parent 4171939 commit eed85dc

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/rpc/blockchain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,7 @@ RPCHelpMan getblockchaininfo()
17411741
}
17421742
obj.pushKV("size_on_disk", chainman.m_blockman.CalculateCurrentUsage());
17431743
obj.pushKV("pruned", node::fPruneMode);
1744+
obj.pushKV("trim_headers", node::fTrimHeaders); // ELEMENTS
17441745
if (g_signed_blocks) {
17451746
if (!DeploymentActiveAfter(tip, chainparams.GetConsensus(), Consensus::DEPLOYMENT_DYNA_FED)) {
17461747
CScript sign_block_script = chainparams.GetConsensus().signblockscript;

test/functional/feature_trim_headers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ def run_test(self):
187187
self.mine_blocks(101, False)
188188
self.sync_all()
189189
self.check_height(expected_height, all=True)
190+
# check the new field in getblockchaininfo
191+
assert not self.nodes[0].getblockchaininfo()["trim_headers"]
192+
assert self.nodes[1].getblockchaininfo()["trim_headers"]
193+
assert self.nodes[2].getblockchaininfo()["trim_headers"]
190194

191195
self.log.info("Shut down trimmed nodes")
192196
self.stop_node(1)
@@ -201,7 +205,6 @@ def run_test(self):
201205
tip = self.nodes[0].getblockhash(self.nodes[0].getblockcount())
202206
header = self.nodes[0].getblockheader(tip)
203207
block = self.nodes[0].getblock(tip)
204-
info = self.nodes[0].getblockchaininfo()
205208

206209
assert 'signblock_witness_asm' in header
207210
assert 'signblock_witness_hex' in header

test/functional/rpc_blockchain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def _test_getblockchaininfo(self):
123123
'pruned',
124124
'size_on_disk',
125125
'time',
126+
'trim_headers',
126127
'verificationprogress',
127128
'warnings',
128129
]

0 commit comments

Comments
 (0)