Merge pull request #691 from jl777/jl777

reduce notary mining initial delay from 65 to 60 seconds
This commit is contained in:
jl777
2018-06-08 05:18:55 -11:00
committed by GitHub
2 changed files with 23 additions and 21 deletions

View File

@@ -475,8 +475,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 )
{ {
CMutableTransaction txNotary = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1); CMutableTransaction txNotary = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1);
if ( pblock->nTime < pindexPrev->nTime+65 ) if ( pblock->nTime < pindexPrev->nTime+60 )
pblock->nTime = pindexPrev->nTime + 65; pblock->nTime = pindexPrev->nTime + 60;
if ( gpucount < 33 ) if ( gpucount < 33 )
pblock->nTime += (rand() % (33 - gpucount)*(33 - gpucount)); pblock->nTime += (rand() % (33 - gpucount)*(33 - gpucount));
if ( komodo_notaryvin(txNotary,NOTARY_PUBKEY33) > 0 ) if ( komodo_notaryvin(txNotary,NOTARY_PUBKEY33) > 0 )

View File

@@ -2697,32 +2697,34 @@ UniValue listunspent(const UniValue& params, bool fHelp)
uint64_t komodo_interestsum() uint64_t komodo_interestsum()
{ {
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
uint64_t interest,sum = 0; int32_t txheight; uint32_t locktime; if ( GetBoolArg("-disablewallet", false) == 0 )
vector<COutput> vecOutputs;
assert(pwalletMain != NULL);
LOCK2(cs_main, pwalletMain->cs_wallet);
pwalletMain->AvailableCoins(vecOutputs, false, NULL, true);
BOOST_FOREACH(const COutput& out,vecOutputs)
{ {
CAmount nValue = out.tx->vout[out.i].nValue; uint64_t interest,sum = 0; int32_t txheight; uint32_t locktime;
if ( out.tx->nLockTime != 0 && out.fSpendable != 0 ) vector<COutput> vecOutputs;
assert(pwalletMain != NULL);
LOCK2(cs_main, pwalletMain->cs_wallet);
pwalletMain->AvailableCoins(vecOutputs, false, NULL, true);
BOOST_FOREACH(const COutput& out,vecOutputs)
{ {
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); CAmount nValue = out.tx->vout[out.i].nValue;
CBlockIndex *tipindex,*pindex = it->second; if ( out.tx->nLockTime != 0 && out.fSpendable != 0 )
if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 )
{ {
interest = komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->nHeight); BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
//interest = komodo_interest(pindex->nHeight,nValue,out.tx->nLockTime,tipindex->nTime); CBlockIndex *tipindex,*pindex = it->second;
sum += interest; if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 )
{
interest = komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->nHeight);
//interest = komodo_interest(pindex->nHeight,nValue,out.tx->nLockTime,tipindex->nTime);
sum += interest;
}
} }
} }
KOMODO_INTERESTSUM = sum;
KOMODO_WALLETBALANCE = pwalletMain->GetBalance();
return(sum);
} }
KOMODO_INTERESTSUM = sum;
KOMODO_WALLETBALANCE = pwalletMain->GetBalance();
return(sum);
#else
return(0);
#endif #endif
return(0);
} }
UniValue fundrawtransaction(const UniValue& params, bool fHelp) UniValue fundrawtransaction(const UniValue& params, bool fHelp)