HUSH NSPV

This commit is contained in:
Duke Leto
2020-12-09 19:22:51 -05:00
parent 86bd499818
commit 31fc4099df
24 changed files with 121 additions and 121 deletions

View File

@@ -2143,7 +2143,7 @@ bool myAddtomempool(CTransaction &tx, CValidationState *pstate, bool fSkipExpiry
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock)
{
memset(&hashBlock,0,sizeof(hashBlock));
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
int64_t rewardsum = 0; int32_t i,retval,txheight,currentheight,height=0,vout = 0;
for (i=0; i<NSPV_U.U.numutxos; i++)
@@ -2197,7 +2197,7 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
bool NSPV_myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, int32_t &txheight, int32_t &currentheight)
{
memset(&hashBlock,0,sizeof(hashBlock));
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
int64_t rewardsum = 0; int32_t i,retval,height=0,vout = 0;
for (i=0; i<NSPV_U.U.numutxos; i++)
@@ -3226,7 +3226,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
{
CDiskBlockPos blockPos;
const CChainParams& chainparams = Params();
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
return(true);
if ( KOMODO_STOPAT != 0 && pindex->GetHeight() > KOMODO_STOPAT )
return(false);
@@ -3820,7 +3820,7 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
void FlushStateToDisk() {
CValidationState state;
if ( KOMODO_NSPV_FULLNODE )
if ( HUSH_NSPV_FULLNODE )
FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
}
@@ -4065,13 +4065,13 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
mapBlockSource.erase(pindexNew->GetBlockHash());
nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2;
LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001);
if ( KOMODO_NSPV_FULLNODE )
if ( HUSH_NSPV_FULLNODE )
assert(view.Flush());
}
int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3;
LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001);
// Write the chain state to disk, if necessary.
if ( KOMODO_NSPV_FULLNODE )
if ( HUSH_NSPV_FULLNODE )
{
if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED))
return false;
@@ -4111,9 +4111,9 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
komodo_broadcast(pblock,8);
else if ( SMART_CHAIN_SYMBOL[0] != 0 )
komodo_broadcast(pblock,4);*/
if ( KOMODO_NSPV_FULLNODE )
if ( HUSH_NSPV_FULLNODE )
{
//fprintf(stderr,"%s: KOMODO_NSPV_FULLNODE\n", __FUNCTION__);
//fprintf(stderr,"%s: HUSH_NSPV_FULLNODE\n", __FUNCTION__);
if ( ASSETCHAINS_CBOPRET != 0 )
komodo_pricesupdate(pindexNew->GetHeight(),pblock);
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
@@ -6484,7 +6484,7 @@ bool InitBlockIndex() {
if (!ActivateBestChain(true, state, &block))
return error("LoadBlockIndex(): genesis block cannot be activated");
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
if ( KOMODO_NSPV_FULLNODE )
if ( HUSH_NSPV_FULLNODE )
return FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
else return(true);
} catch (const std::runtime_error& e) {
@@ -7044,7 +7044,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{
const CChainParams& chainparams = Params();
LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
//if ( KOMODO_NSPV_SUPERLITE )
//if ( HUSH_NSPV_SUPERLITE )
//if ( strCommand != "version" && strCommand != "verack" )
// fprintf(stderr, "recv: %s (%u bytes) peer=%d\n", SanitizeString(strCommand).c_str(), (int32_t)vRecv.size(), (int32_t)pfrom->GetId());
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
@@ -7216,7 +7216,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{
pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
if ( (pfrom->nServices & NODE_NSPV) == 0 )
{
@@ -7416,7 +7416,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
else if (strCommand == "getnSPV")
{
if ( KOMODO_NSPV == 0 )//&& HUSH_INSYNC != 0 )
if ( HUSH_NSPV == 0 )//&& HUSH_INSYNC != 0 )
{
std::vector<uint8_t> payload;
vRecv >> payload;
@@ -7426,7 +7426,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
else if (strCommand == "nSPV")
{
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
std::vector<uint8_t> payload;
vRecv >> payload;
@@ -7434,7 +7434,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
return(true);
}
else if ( KOMODO_NSPV_SUPERLITE )
else if ( HUSH_NSPV_SUPERLITE )
return(true);
else if (strCommand == "inv")
{
@@ -8222,7 +8222,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
}
state.fShouldBan = false;
}
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
komodo_nSPV(pto);
return(true);
@@ -8412,7 +8412,7 @@ extern "C" const char* getDataDir()
CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight)
{
CMutableTransaction mtx;
if ( KOMODO_NSPV_SUPERLITE )
if ( HUSH_NSPV_SUPERLITE )
{
mtx.fOverwintered = true;
mtx.nExpiryHeight = 0;