@@ -2694,6 +2694,7 @@ bool ContextualCheckInputs(
|
|||||||
|
|
||||||
if (tx.IsCoinImport())
|
if (tx.IsCoinImport())
|
||||||
{
|
{
|
||||||
|
LOCK(cs_main);
|
||||||
ServerTransactionSignatureChecker checker(&tx, 0, 0, false, txdata);
|
ServerTransactionSignatureChecker checker(&tx, 0, 0, false, txdata);
|
||||||
return VerifyCoinImport(tx.vin[0].scriptSig, checker, state);
|
return VerifyCoinImport(tx.vin[0].scriptSig, checker, state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,15 +214,13 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
boost::optional<CTransaction> cheatSpend;
|
boost::optional<CTransaction> cheatSpend;
|
||||||
uint256 cbHash;
|
uint256 cbHash;
|
||||||
|
|
||||||
SaplingMerkleTree sapling_tree; uint64_t commission;
|
CBlockIndex* pindexPrev = 0;
|
||||||
int nHeight = 0;
|
|
||||||
const Consensus::Params &consensusParams = chainparams.GetConsensus();
|
|
||||||
|
|
||||||
CBlockIndex* pindexPrev = chainActive.LastTip();;
|
|
||||||
{
|
{
|
||||||
{ // contain lock to block generation and not staking loops.
|
ENTER_CRITICAL_SECTION(cs_main);
|
||||||
LOCK2(cs_main, mempool.cs);
|
ENTER_CRITICAL_SECTION(mempool.cs);
|
||||||
nHeight = pindexPrev->GetHeight() + 1;
|
pindexPrev = chainActive.LastTip();
|
||||||
|
const int nHeight = pindexPrev->GetHeight() + 1;
|
||||||
|
const Consensus::Params &consensusParams = chainparams.GetConsensus();
|
||||||
uint32_t consensusBranchId = CurrentEpochBranchId(nHeight, consensusParams);
|
uint32_t consensusBranchId = CurrentEpochBranchId(nHeight, consensusParams);
|
||||||
bool sapling = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING);
|
bool sapling = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING);
|
||||||
|
|
||||||
@@ -242,8 +240,9 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
pblock->nTime = GetAdjustedTime();
|
pblock->nTime = GetAdjustedTime();
|
||||||
|
|
||||||
CCoinsViewCache view(pcoinsTip);
|
CCoinsViewCache view(pcoinsTip);
|
||||||
uint32_t expired;
|
uint32_t expired; uint64_t commission;
|
||||||
|
|
||||||
|
SaplingMerkleTree sapling_tree;
|
||||||
assert(view.GetSaplingAnchorAt(view.GetBestAnchor(SAPLING), sapling_tree));
|
assert(view.GetSaplingAnchorAt(view.GetBestAnchor(SAPLING), sapling_tree));
|
||||||
|
|
||||||
// Priority order to process transactions
|
// Priority order to process transactions
|
||||||
@@ -473,13 +472,13 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
//pblock->nTime = blocktime + 1;
|
//pblock->nTime = blocktime + 1;
|
||||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||||
|
|
||||||
} // contain lock to block generation only!
|
|
||||||
|
|
||||||
int32_t stakeHeight = chainActive.Height() + 1;
|
int32_t stakeHeight = chainActive.Height() + 1;
|
||||||
|
|
||||||
//LogPrintf("CreateNewBlock(): total size %u blocktime.%u nBits.%08x\n", nBlockSize,blocktime,pblock->nBits);
|
//LogPrintf("CreateNewBlock(): total size %u blocktime.%u nBits.%08x\n", nBlockSize,blocktime,pblock->nBits);
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 && isStake )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 && isStake )
|
||||||
{
|
{
|
||||||
|
LEAVE_CRITICAL_SECTION(cs_main);
|
||||||
|
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||||
uint64_t txfees,utxovalue; uint32_t txtime; uint256 utxotxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr;
|
uint64_t txfees,utxovalue; uint32_t txtime; uint256 utxotxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr;
|
||||||
CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(Params().GetConsensus(), stakeHeight);
|
CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(Params().GetConsensus(), stakeHeight);
|
||||||
|
|
||||||
@@ -548,6 +547,11 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
if (scriptPubKeyIn.IsPayToScriptHash() || scriptPubKeyIn.IsPayToCryptoCondition())
|
if (scriptPubKeyIn.IsPayToScriptHash() || scriptPubKeyIn.IsPayToCryptoCondition())
|
||||||
{
|
{
|
||||||
fprintf(stderr,"CreateNewBlock: attempt to add timelock to pay2sh or pay2cc\n");
|
fprintf(stderr,"CreateNewBlock: attempt to add timelock to pay2sh or pay2cc\n");
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] == 0 || (ASSETCHAINS_SYMBOL[0] != 0 && !isStake) )
|
||||||
|
{
|
||||||
|
LEAVE_CRITICAL_SECTION(cs_main);
|
||||||
|
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,6 +644,11 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr,"error adding notaryvin, need to create 0.0001 utxos\n");
|
fprintf(stderr,"error adding notaryvin, need to create 0.0001 utxos\n");
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] == 0 || (ASSETCHAINS_SYMBOL[0] != 0 && !isStake) )
|
||||||
|
{
|
||||||
|
LEAVE_CRITICAL_SECTION(cs_main);
|
||||||
|
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||||
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -654,6 +663,11 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
//fprintf(stderr,"valid\n");
|
//fprintf(stderr,"valid\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] == 0 || (ASSETCHAINS_SYMBOL[0] != 0 && !isStake) )
|
||||||
|
{
|
||||||
|
LEAVE_CRITICAL_SECTION(cs_main);
|
||||||
|
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||||
|
}
|
||||||
//fprintf(stderr,"done new block\n");
|
//fprintf(stderr,"done new block\n");
|
||||||
return pblocktemplate.release();
|
return pblocktemplate.release();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user