Remove height triggers and add PoWtarget in getblocktemplate

This commit is contained in:
jl777
2018-07-18 05:04:15 -11:00
parent 79f49ac49f
commit 0ce374b7c7
3 changed files with 31 additions and 15 deletions

View File

@@ -438,6 +438,7 @@ static UniValue BIP22ValidationResult(const CValidationState& state)
UniValue getblocktemplate(const UniValue& params, bool fHelp)
{
extern uint64_t ASSETCHAINS_STAKED;
if (fHelp || params.size() > 1)
throw runtime_error(
"getblocktemplate ( \"jsonrequestobject\" )\n"
@@ -727,7 +728,15 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
}
result.push_back(Pair("longpollid", chainActive.LastTip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast)));
result.push_back(Pair("target", hashTarget.GetHex()));
if ( ASSETCHAINS_STAKED != 0 )
{
arith_uint256 POWtarget; int32_t PosPerc;
POWtarget = komodo_PoWtarget(&PoSperc,hashTarget,(int32_t)(pindexPrev->nHeight+1),ASSETCHAINS_STAKED);
result.push_back(Pair("target", POWtarget.GetHex()));
result.push_back(Pair("PoSperc", (int64_t)PoSperc));
result.push_back(Pair("ac_staked", (int64_t)ASSETCHAINS_STAKED));
result.push_back(Pair("origtarget", hashTarget.GetHex()));
} else result.push_back(Pair("target", hashTarget.GetHex()));
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1));
result.push_back(Pair("mutable", aMutable));
result.push_back(Pair("noncerange", "00000000ffffffff"));