Browse Source

the commission is the mission

dev
Duke Leto 4 years ago
parent
commit
9f319c1cc9
  1. 4
      src/komodo_bitcoind.h
  2. 2
      src/main.cpp
  3. 4
      src/miner.cpp
  4. 6
      src/rpc/mining.cpp

4
src/komodo_bitcoind.h

@ -1348,7 +1348,7 @@ uint64_t hush_commission(int height)
return commission;
}
uint64_t komodo_commission(const CBlock *pblock,int32_t height)
uint64_t the_commission(const CBlock *pblock,int32_t height)
{
//fprintf(stderr,"%s at height=%d\n",__func__,height);
static bool didinit = false, ishush3 = false;
@ -2064,7 +2064,7 @@ int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
int64_t checktoshis=0; uint8_t *script,scripthex[8192]; int32_t scriptlen,matched = 0; static bool didinit = false;
if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 )
{
checktoshis = komodo_commission(pblock,height);
checktoshis = the_commission(pblock,height);
if ( checktoshis >= 10000 && pblock->vtx[0].vout.size() < 2 )
{
fprintf(stderr,"ERROR: komodo_checkcommission vsize.%d height.%d commission %.8f has checktoshis=%lu <10000 or less than 2 vouts (vouts=%lu)\n",(int32_t)pblock->vtx[0].vout.size(),height,(double)checktoshis/COIN, checktoshis, pblock->vtx[0].vout.size() );

2
src/main.cpp

@ -3671,7 +3671,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 ) //ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 &&
{
uint64_t checktoshis;
if ( (checktoshis= komodo_commission((CBlock *)&block,(int32_t)pindex->GetHeight())) != 0 )
if ( (checktoshis= the_commission((CBlock *)&block,(int32_t)pindex->GetHeight())) != 0 )
{
if ( block.vtx[0].vout.size() >= 2 && block.vtx[0].vout[1].nValue == checktoshis )
blockReward += checktoshis;

4
src/miner.cpp

@ -147,7 +147,7 @@ int32_t komodo_baseid(char *origbase);
int32_t hush_longestchain();
int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag);
int64_t komodo_block_unlocktime(uint32_t nHeight);
uint64_t komodo_commission(const CBlock *block,int32_t height);
uint64_t the_commission(const CBlock *block,int32_t height);
int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *ptr);
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
int32_t komodo_is_notarytx(const CTransaction& tx);
@ -630,7 +630,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
txNew.vout[0].nValue += 5000;
pblock->vtx[0] = txNew;
if ( nHeight > 1 && SMART_CHAIN_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 )
if ( nHeight > 1 && SMART_CHAIN_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0) && (commission= the_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 )
{
int32_t i; uint8_t *ptr;
txNew.vout.resize(2);

6
src/rpc/mining.cpp

@ -52,7 +52,7 @@ using namespace std;
#include "hush_defs.h"
extern int32_t ASSETCHAINS_FOUNDERS;
uint64_t komodo_commission(const CBlock *pblock,int32_t height);
uint64_t the_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);
@ -1048,13 +1048,13 @@ UniValue getblocksubsidy(const UniValue& params, bool fHelp, const CPubKey& mypk
CBlockIndex* pblockIndex = chainActive[nHeight];
CBlock block;
if ( komodo_blockload(block, pblockIndex) == 0 )
nFoundersReward = komodo_commission(&block, nHeight);
nFoundersReward = the_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);
nFoundersReward = the_commission(0, nHeight);
}
result.push_back(Pair("ac_pubkey", ValueFromAmount(nFoundersReward)));
}

Loading…
Cancel
Save