add ac_founders and ac_perc to getblocksubsidy
This commit is contained in:
@@ -1224,7 +1224,6 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
|
|||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0;
|
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0;
|
||||||
txn_count = pblock->vtx.size();
|
|
||||||
if ( ASSETCHAINS_FOUNDERS != 0 )
|
if ( ASSETCHAINS_FOUNDERS != 0 )
|
||||||
{
|
{
|
||||||
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
|
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
|
||||||
@@ -1242,8 +1241,9 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
|
|||||||
else commission = 0;
|
else commission = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if ( pblock != 0 )
|
||||||
{
|
{
|
||||||
|
txn_count = pblock->vtx.size();
|
||||||
for (i=0; i<txn_count; i++)
|
for (i=0; i<txn_count; i++)
|
||||||
{
|
{
|
||||||
n = pblock->vtx[i].vout.size();
|
n = pblock->vtx[i].vout.size();
|
||||||
|
|||||||
@@ -49,8 +49,10 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "komodo_defs.h"
|
#include "komodo_defs.h"
|
||||||
extern int32_t ASSETCHAINS_FOUNDERS;
|
|
||||||
|
|
||||||
|
extern int32_t ASSETCHAINS_FOUNDERS;
|
||||||
|
uint64_t komodo_commission(const CBlock *pblock,int32_t height);
|
||||||
|
int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex);
|
||||||
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
|
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1009,6 +1011,7 @@ UniValue getblocksubsidy(const UniValue& params, bool fHelp)
|
|||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"miner\" : x.xxx (numeric) The mining reward amount in KMD.\n"
|
" \"miner\" : x.xxx (numeric) The mining reward amount in KMD.\n"
|
||||||
|
" \"ac_pubkey\" : x.xxx (numeric) The mining reward amount in KMD.\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
+ HelpExampleCli("getblocksubsidy", "1000")
|
+ HelpExampleCli("getblocksubsidy", "1000")
|
||||||
@@ -1020,10 +1023,31 @@ UniValue getblocksubsidy(const UniValue& params, bool fHelp)
|
|||||||
if (nHeight < 0)
|
if (nHeight < 0)
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
|
||||||
|
|
||||||
|
CAmount nFoundersReward = 0;
|
||||||
CAmount nReward = GetBlockSubsidy(nHeight, Params().GetConsensus());
|
CAmount nReward = GetBlockSubsidy(nHeight, Params().GetConsensus());
|
||||||
UniValue result(UniValue::VOBJ);
|
UniValue result(UniValue::VOBJ);
|
||||||
result.push_back(Pair("miner", ValueFromAmount(nReward)));
|
result.push_back(Pair("miner", ValueFromAmount(nReward)));
|
||||||
//result.push_back(Pair("founders", ValueFromAmount(nFoundersReward)));
|
|
||||||
|
if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 || ASSETCHAINS_SCRIPTPUB.size() > 1 )
|
||||||
|
{
|
||||||
|
if ( ASSETCHAINS_FOUNDERS == 0 && ASSETCHAINS_COMMISSION != 0 )
|
||||||
|
{
|
||||||
|
// ac comission chains need the block to exist to calulate the reward.
|
||||||
|
if ( nHeight <= chainActive.Height() )
|
||||||
|
{
|
||||||
|
CBlockIndex* pblockIndex = chainActive[nHeight];
|
||||||
|
CBlock block;
|
||||||
|
if ( komodo_blockload(block, pblockIndex) == 0 )
|
||||||
|
nFoundersReward = komodo_commission(&block, nHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ASSETCHAINS_FOUNDERS != 0 )
|
||||||
|
{
|
||||||
|
// Assetchains founders chains have a fixed reward so can be calculated at any given height.
|
||||||
|
nFoundersReward = komodo_commission(0, nHeight);
|
||||||
|
}
|
||||||
|
result.push_back(Pair("ac_pubkey", ValueFromAmount(nFoundersReward)));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user