5
1
I want to call chainActive.Tip()->nHeight in core.cpp. It is not possible, I am interested in every idea.
https://github.com/LIMXTEC/BitSend/blob/DEV-joshafest/src/core.cpp
Here is an example :
bool GetH()
{
int nBlockHeight = chainActive.Tip()->nHeight;
if(nBlockHeight < FORKX17_Main_Net )
return true;
else
return false;
}
}
uint256 CBlockHeader::GetHash() const
{
if (GetH())
{
return HashX11(BEGIN(nVersion), END(nNonce));
}
else
{
return HashX17(BEGIN(nVersion), END(nNonce));
}
}
Also that is not possible:
CBlockIndex* pindexPrev = chainActive.Tip();
if (pindexPrev->nHeight <= FORKX17_Main_Net)

1Looks like you need to
#include "main.h"? – Nate Eldredge – 2016-06-26T03:18:30.8131Yes I use main.h.
include "core.h"
include "util.h"
include "main.h"
include "uint256.h"< – cgminer-0 – 2016-06-26T06:53:20.953
This is due to missing the object of the class which has 'chainActive()' method. So including which ever the file that has the method. In case if it gives further different undefined reference errors; find the file that contains the method; include it; until it compiles ;) – SajithP – 2017-12-25T11:57:33.363
@SajithP chainActive is a variable not a method :) More likely, it's something to do with the makefile, perhaps main.h cannot be included when building -cli instead of the Daemon? Unsure – MeshCollider – 2017-12-25T21:40:17.053
Got it! Then modify the make file to include the object of the class which has the chainActive as a member. e.g 'x.o' where chainActive is a member of class 'x' – SajithP – 2017-12-26T02:40:22.560