diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 292302a55..34f1b0161 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -686,7 +686,7 @@ uint32_t komodo_stake(arith_uint256 bnTarget,int32_t nHeight,uint256 txid,int32_ hash = pindex->GetBlockHash(); // hash pubkey diff = (blocktime - txtime); coinage = (((value * diff) / supply) * diff); - hashval = arith_uint256(supply) * (UintToArith256(hash) / arith_uint256(coinage+1)); + hashval = arith_uint256(supply * 64) * (UintToArith256(hash) / arith_uint256(coinage+1)); if ( hashval <= bnTarget ) winner = 1; else @@ -695,7 +695,7 @@ uint32_t komodo_stake(arith_uint256 bnTarget,int32_t nHeight,uint256 txid,int32_ { diff = (iter + blocktime - txtime); coinage = (((value * diff) / supply) * diff); - hashval = arith_uint256(supply) * (UintToArith256(hash) / arith_uint256(coinage+1)); + hashval = arith_uint256(supply * 64) * (UintToArith256(hash) / arith_uint256(coinage+1)); if ( hashval <= bnTarget ) { winner = 1; diff --git a/src/miner.cpp b/src/miner.cpp index 2b658d5ee..67e8e9cb3 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -395,26 +395,22 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if ( (siglen= komodo_staked(txStaked,pblock->nBits,&blocktime,&txtime,&utxotxid,&utxovout,&utxovalue,utxosig)) > 0 ) { CAmount txfees = 0; - /*CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(chainparams.GetConsensus(), nHeight); - txStaked.vin.resize(1); - txStaked.vout.resize(1); - for (i=0; i<32; i++) - ((uint8_t *)&revtxid)[i] = ((uint8_t *)&utxotxid)[31 - i]; - txStaked.vin[0].prevout.hash = revtxid; - txStaked.vin[0].prevout.n = utxovout; - txStaked.vin[0].scriptSig.resize(siglen); - ptr = (uint8_t *)txStaked.vin[0].scriptSig.data(); - for (i=0; ivtx.push_back(txStaked); pblocktemplate->vTxFees.push_back(txfees); pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked)); nFees += txfees; pblock->nTime = blocktime; + if ( GetAdjustedTime()+30 < pblock->nTime ) + { + printf("need to wait %d seconds to submit: ",(int32_t)(pblock->nTime - GetAdjustedTime())); + while ( GetAdjustedTime()+30 < pblock->nTime ) + { + sleep(1); + fprintf(stderr,"%d ",pblock->nTime - GetAdjustedTime()); + } + fprintf(stderr,"finished waiting\n"); + } + } else fprintf(stderr,"no utxos eligible for staking\n"); }