|
|
@ -120,11 +120,11 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *symbol,int32_t |
|
|
|
int32_t komodo_isrealtime(int32_t *kmdheightp); |
|
|
|
int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag); |
|
|
|
uint64_t komodo_commission(const CBlock &block); |
|
|
|
int32_t komodo_staked(uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig); |
|
|
|
int32_t komodo_staked(uint32_t *blocktimep,uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig); |
|
|
|
|
|
|
|
CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) |
|
|
|
{ |
|
|
|
uint64_t deposits; int32_t isrealtime,kmdheight; const CChainParams& chainparams = Params(); |
|
|
|
uint64_t deposits; int32_t isrealtime,kmdheight; uint32_t blocktime; const CChainParams& chainparams = Params(); |
|
|
|
// Create new block
|
|
|
|
std::unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate()); |
|
|
|
if(!pblocktemplate.get()) |
|
|
@ -384,11 +384,12 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) |
|
|
|
|
|
|
|
nLastBlockTx = nBlockTx; |
|
|
|
nLastBlockSize = nBlockSize; |
|
|
|
LogPrintf("CreateNewBlock(): total size %u\n", nBlockSize); |
|
|
|
blocktime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); |
|
|
|
LogPrintf("CreateNewBlock(): total size %u blocktime.%u\n", nBlockSize,blocktime); |
|
|
|
if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_STAKED != 0 && NOTARY_PUBKEY33[0] != 0 ) |
|
|
|
{ |
|
|
|
uint64_t txfees,utxovalue; uint32_t txtime; uint256 utxotxid,revtxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr; |
|
|
|
if ( (siglen= komodo_staked(&txtime,&utxotxid,&utxovout,&utxovalue,utxosig)) > 0 ) |
|
|
|
if ( (siglen= komodo_staked(&blocktime,&txtime,&utxotxid,&utxovout,&utxovalue,utxosig)) > 0 ) |
|
|
|
{ |
|
|
|
CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(chainparams.GetConsensus(), nHeight); |
|
|
|
CAmount txfees = 0; |
|
|
@ -404,14 +405,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) |
|
|
|
ptr[i] = utxosig[i]; |
|
|
|
txStaked.vout[0].scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG; |
|
|
|
txStaked.vout[0].nValue = utxovalue - txfees; |
|
|
|
fprintf(stderr,"utxovout.%d txtime.%u %.8f\n",utxovout,txtime,(double)utxovalue/COIN); |
|
|
|
txStaked.nLockTime = chainActive.Tip()->nTime + 60; |
|
|
|
txStaked.nLockTime = blocktime; |
|
|
|
|
|
|
|
pblock->vtx.push_back(txStaked); |
|
|
|
numsigs = GetLegacySigOpCount(txStaked); |
|
|
|
pblocktemplate->vTxFees.push_back(txfees); |
|
|
|
pblocktemplate->vTxSigOps.push_back(numsigs); |
|
|
|
nFees += txfees; |
|
|
|
pblock->nTime = blocktime; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|