@@ -542,7 +542,7 @@ int64_t AddCClibtxfee(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe
|
||||
char coinaddr[64]; int64_t nValue,txfee = 10000; uint256 txid,hashBlock; CTransaction vintx; int32_t vout;
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||
GetCCaddress(cp,coinaddr,pk);
|
||||
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||
SetCCunspents(unspentOutputs,coinaddr,false);
|
||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
|
||||
13
src/init.cpp
13
src/init.cpp
@@ -1911,11 +1911,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
PruneAndFlush();
|
||||
}
|
||||
}
|
||||
if ( GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX) != 0 )
|
||||
nLocalServices |= NODE_ADDRINDEX;
|
||||
if ( GetBoolArg("-spentindex", DEFAULT_SPENTINDEX) != 0 )
|
||||
nLocalServices |= NODE_SPENTINDEX;
|
||||
fprintf(stderr,"nLocalServices %llx %d, %d\n",(long long)nLocalServices,GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX),GetBoolArg("-spentindex", DEFAULT_SPENTINDEX));
|
||||
if ( KOMODO_NSPV > 0 )
|
||||
{
|
||||
if ( GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX) != 0 )
|
||||
nLocalServices |= NODE_ADDRINDEX;
|
||||
if ( GetBoolArg("-spentindex", DEFAULT_SPENTINDEX) != 0 )
|
||||
nLocalServices |= NODE_SPENTINDEX;
|
||||
fprintf(stderr,"nLocalServices %llx %d, %d\n",(long long)nLocalServices,GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX),GetBoolArg("-spentindex", DEFAULT_SPENTINDEX));
|
||||
}
|
||||
// ********************************************************* Step 10: import blocks
|
||||
|
||||
if (mapArgs.count("-blocknotify"))
|
||||
|
||||
@@ -5299,9 +5299,9 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( block.GetBlockTime() <= pindexPrev->GetMedianTimePast() + 2*ASSETCHAINS_ADAPTIVEPOW*ASSETCHAINS_BLOCKTIME )
|
||||
if ( block.GetBlockTime() <= pindexPrev->nTime )
|
||||
{
|
||||
fprintf(stderr,"ht.%d too early2 %u vs %u\n",(int32_t)nHeight,(uint32_t)block.GetBlockTime(),(uint32_t)pindexPrev->GetMedianTimePast());
|
||||
fprintf(stderr,"ht.%d too early2 %u vs %u\n",(int32_t)nHeight,(uint32_t)block.GetBlockTime(),(uint32_t)pindexPrev->nTime);
|
||||
return state.Invalid(error("%s: block's timestamp is too early2", __func__),
|
||||
REJECT_INVALID, "time-too-old");
|
||||
}
|
||||
|
||||
@@ -123,7 +123,9 @@ public:
|
||||
|
||||
void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
|
||||
{
|
||||
pblock->nTime = std::max(pindexPrev->GetMedianTimePast()+1 + 2*ASSETCHAINS_ADAPTIVEPOW*ASSETCHAINS_BLOCKTIME, GetAdjustedTime());
|
||||
if ( ASSETCHAINS_ADAPTIVEPOW == 0 )
|
||||
pblock->nTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
else pblock->nTime = std::max((int64_t)(pindexPrev->nTime+1), GetAdjustedTime());
|
||||
|
||||
// Updating time can change work required on testnet:
|
||||
if (consensusParams.nPowAllowMinDifficultyBlocksAfterHeight != boost::none) {
|
||||
@@ -567,7 +569,9 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
|
||||
nLastBlockTx = nBlockTx;
|
||||
nLastBlockSize = nBlockSize;
|
||||
blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1+ 2*ASSETCHAINS_ADAPTIVEPOW*ASSETCHAINS_BLOCKTIME, GetAdjustedTime());
|
||||
if ( ASSETCHAINS_ADAPTIVEPOW == 0 )
|
||||
blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
else blocktime = 1 + std::max((int64_t)(pindexPrev->nTime+1), GetAdjustedTime());
|
||||
//pblock->nTime = blocktime + 1;
|
||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||
|
||||
@@ -640,7 +644,10 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams) + nFees;
|
||||
//fprintf(stderr,"mine ht.%d with %.8f\n",nHeight,(double)txNew.vout[0].nValue/COIN);
|
||||
txNew.nExpiryHeight = 0;
|
||||
txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1+ 2*ASSETCHAINS_ADAPTIVEPOW*ASSETCHAINS_BLOCKTIME, GetAdjustedTime());
|
||||
if ( ASSETCHAINS_ADAPTIVEPOW == 0 )
|
||||
txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
else txNew.nLockTime = std::max((int64_t)(pindexPrev->nTime+1), GetAdjustedTime());
|
||||
|
||||
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_KOMODO_NOTARY != 0 && My_notaryid >= 0 )
|
||||
txNew.vout[0].nValue += 5000;
|
||||
|
||||
Reference in New Issue
Block a user