Skip to content

Commit 7d9dade

Browse files
authored
Merge pull request #1256 from psgreco/master-trim-v2-prep
Small fixes in preparation for trim_headers version 2
2 parents f20016d + 88c3b6f commit 7d9dade

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/chain.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ class CBlockIndex
217217
m_signblock_witness = std::nullopt;
218218
}
219219

220-
bool trimmed() const {
220+
inline bool trimmed() const {
221221
return m_trimmed;
222222
}
223223

224-
void assert_untrimmed() const {
224+
inline void assert_untrimmed() const {
225225
assert(!m_trimmed);
226226
}
227227

@@ -230,7 +230,7 @@ class CBlockIndex
230230
return proof.value();
231231
}
232232

233-
const bool dynafed_block() const {
233+
bool is_dynafed_block() const {
234234
if (m_trimmed) {
235235
return m_trimmed_dynafed_block;
236236
}
@@ -417,12 +417,12 @@ class CDiskBlockIndex : public CBlockIndex
417417
nVersion = ~CBlockHeader::DYNAFED_HF_MASK & nVersion;
418418
return is_dyna;
419419
} else {
420-
return !dynafed_params().IsNull();
420+
return is_dynafed_block();
421421
}
422422
}
423423
bool RemoveDynaFedMaskOnSerialize(bool for_read) const {
424424
assert(!for_read);
425-
return !dynafed_params().IsNull();
425+
return is_dynafed_block();
426426
}
427427

428428
SERIALIZE_METHODS(CDiskBlockIndex, obj)
@@ -445,12 +445,12 @@ class CDiskBlockIndex : public CBlockIndex
445445
READWRITE(obj.nVersion);
446446
} else {
447447
int32_t nVersion = obj.nVersion;
448-
if (!obj.dynafed_params().IsNull()) {
448+
if (obj.is_dynafed_block()) {
449449
nVersion |= CBlockHeader::DYNAFED_HF_MASK;
450450
}
451451
READWRITE(nVersion);
452452
}
453-
bool is_dyna = obj.RemoveDynaFedMaskOnSerialize(ser_action.ForRead());;
453+
bool is_dyna = obj.RemoveDynaFedMaskOnSerialize(ser_action.ForRead());
454454

455455
READWRITE(obj.hashPrev);
456456
READWRITE(obj.hashMerkleRoot);

src/init.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
986986
epoch_length = 20160;
987987
}
988988

989-
if (args.IsArgSet("-trim_headers")) {
989+
if (args.GetBoolArg("-trim_headers", false)) {
990990
LogPrintf("Configured for header-trimming mode. This will reduce memory usage substantially, but we will be unable to serve as a full P2P peer, and certain header fields may be missing from JSON RPC output.\n");
991991
fTrimHeaders = true;
992992
// This calculation is driven by GetValidFedpegScripts in pegins.cpp, which walks the chain

src/rpc/blockchain.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex
248248
result.pushKV("difficulty", GetDifficulty(blockindex));
249249
result.pushKV("chainwork", blockindex->nChainWork.GetHex());
250250
} else {
251-
if (!blockindex->dynafed_block()) {
251+
if (!blockindex->is_dynafed_block()) {
252252
if (blockindex->trimmed()) {
253253
result.pushKV("signblock_witness_asm", "<trimmed>");
254254
result.pushKV("signblock_witness_hex", "<trimmed>");

0 commit comments

Comments
 (0)