Prepare access to untrim headers

This commit is contained in:
Pablo Greco 2023-06-29 12:10:09 -07:00 committed by James Dorfman
parent a4d7ac7bbe
commit 31835f2a86
4 changed files with 13 additions and 0 deletions

View file

@ -5,6 +5,11 @@
#include <chain.h>
#include <util/time.h>
#include <validation.h>
#include <node/context.h>
node::NodeContext *CBlockIndex::m_pcontext;
std::string CBlockFileInfo::ToString() const
{

View file

@ -16,6 +16,9 @@
#include <vector>
namespace node {
struct NodeContext;
}
/**
* Maximum amount of time that a block timestamp is allowed to exceed the
* current network-adjusted time before the block will be accepted.
@ -218,7 +221,10 @@ protected:
friend class CBlockTreeDB;
static node::NodeContext *m_pcontext;
public:
static void SetNodeContext(node::NodeContext *context) {m_pcontext = context;};
// Irrevocably remove blocksigning and dynafed-related stuff from this
// in-memory copy of the block header.

View file

@ -1243,6 +1243,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
const ArgsManager& args = *Assert(node.args);
const CChainParams& chainparams = Params();
CBlockIndex::SetNodeContext(&node);
auto opt_max_upload = ParseByteUnits(args.GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET), ByteUnit::M);
if (!opt_max_upload) {
return InitError(strprintf(_("Unable to parse -maxuploadtarget: '%s'"), args.GetArg("-maxuploadtarget", "")));

View file

@ -76,6 +76,7 @@ class BlockManager
{
friend CChainState;
friend ChainstateManager;
friend CBlockIndex;
private:
void FlushBlockFile(bool fFinalize = false, bool finalize_undo = false);