From e17d90abfc5da8da099478da3d2fc29f7eece54e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 10 Nov 2018 07:30:59 -1100 Subject: [PATCH] Founders reward just on block subsidy --- src/cc/dice.cpp | 4 ++-- src/komodo_bitcoind.h | 5 +++-- src/main.cpp | 2 +- src/miner.cpp | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 0a7d9eb02..479229b4f 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -776,7 +776,7 @@ int32_t DiceIsWinner(uint256 &entropy,int32_t &entropyvout,uint256 txid,CTransac if ( hentropy != hentropy2 ) { hentropy2 = DiceHashEntropy(entropy,vinTx.vin[0].prevout.hash,vinTx.vin[0].prevout.n,1); - fprintf(stderr,"alt bettxid %s -> vin0 %s/v%d -> %s\n",txid.GetHex().c_str(),vinTx.vin[0].prevout.hash.GetHex().c_str(),entropyvout,entropy.GetHex().c_str()); + //fprintf(stderr,"alt bettxid %s -> vin0 %s/v%d -> %s\n",txid.GetHex().c_str(),vinTx.vin[0].prevout.hash.GetHex().c_str(),entropyvout,entropy.GetHex().c_str()); } if ( hentropy == hentropy2 ) { @@ -1156,7 +1156,7 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit { entropytxid = txid; entropyval = tx.vout[0].nValue; - fprintf(stderr,"funcid.%c first.%d entropytxid.%s val %.8f\n",funcid,first,txid.GetHex().c_str(),(double)entropyval/COIN); + //fprintf(stderr,"funcid.%c first.%d entropytxid.%s val %.8f\n",funcid,first,txid.GetHex().c_str(),(double)entropyval/COIN); first = 1; if (random) { fprintf(stderr, "chosen entropy on loop: %d\n",loops); diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index f1ea95d7c..c2f6ef933 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1106,12 +1106,13 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_ PoS stake must be without txfee and in the last tx in the block at vout[0] */ -uint64_t komodo_commission(const CBlock *pblock) +uint64_t komodo_commission(const CBlock *pblock,int32_t height) { int32_t i,j,n=0,txn_count; uint64_t commission,total = 0; txn_count = pblock->vtx.size(); if ( ASSETCHAINS_FOUNDERS != 0 ) { + return(GetBlockSubsidy(height,chainparams.GetConsensus())); n = pblock->vtx[0].vout.size(); for (j=0; j 10000 && pblock->vtx[0].vout.size() != 2 ) jl777: not sure why this was here return(-1); diff --git a/src/main.cpp b/src/main.cpp index 115920264..aa055068a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3129,7 +3129,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 ) { uint64_t checktoshis; - if ( (checktoshis= komodo_commission((CBlock *)&block)) != 0 ) + if ( (checktoshis= komodo_commission((CBlock *)&block,(int32_t)pindex->nHeight)) != 0 ) { if ( block.vtx[0].vout.size() == 2 && block.vtx[0].vout[1].nValue == checktoshis ) blockReward += checktoshis; diff --git a/src/miner.cpp b/src/miner.cpp index 71a22b7d8..65a00861b 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -119,7 +119,7 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33, int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize); int32_t komodo_baseid(char *origbase); int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag); -uint64_t komodo_commission(const CBlock *block); +uint64_t komodo_commission(const CBlock *block,int32_t height); int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blocktimep,uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig); int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33); @@ -438,7 +438,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; pblock->vtx[0] = txNew; - if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 && (commission= komodo_commission((CBlock*)&pblocktemplate->block)) != 0 ) + if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 && (commission= komodo_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 ) { int32_t i; uint8_t *ptr; txNew.vout.resize(2);