revert changes to import priority. Re-try flat transaction fee. Change miner lock to something safer. Add lock cs_main to import validation when accepting to mempool.
This commit is contained in:
@@ -1603,7 +1603,7 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
|||||||
CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree)
|
CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
LOCK2(cs_main, mempool.cs);
|
LOCK(mempool.cs);
|
||||||
uint256 hash = tx.GetHash();
|
uint256 hash = tx.GetHash();
|
||||||
double dPriorityDelta = 0;
|
double dPriorityDelta = 0;
|
||||||
CAmount nFeeDelta = 0;
|
CAmount nFeeDelta = 0;
|
||||||
@@ -1872,7 +1872,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
nLastTime = nNow;
|
nLastTime = nNow;
|
||||||
// -limitfreerelay unit is thousand-bytes-per-minute
|
// -limitfreerelay unit is thousand-bytes-per-minute
|
||||||
// At default rate it would take over a month to fill 1GB
|
// At default rate it would take over a month to fill 1GB
|
||||||
if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*50000)
|
if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"accept failure.7\n");
|
fprintf(stderr,"accept failure.7\n");
|
||||||
return state.DoS(0, error("AcceptToMemoryPool: free transaction rejected by rate limiter"), REJECT_INSUFFICIENTFEE, "rate limited free transaction");
|
return state.DoS(0, error("AcceptToMemoryPool: free transaction rejected by rate limiter"), REJECT_INSUFFICIENTFEE, "rate limited free transaction");
|
||||||
@@ -2709,6 +2709,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,15 +215,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);
|
||||||
|
|
||||||
@@ -243,8 +241,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
|
||||||
@@ -286,9 +285,8 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
if (tx.IsCoinImport())
|
if (tx.IsCoinImport())
|
||||||
{
|
{
|
||||||
CAmount nValueIn = GetCoinImportValue(tx); // burn amount
|
CAmount nValueIn = GetCoinImportValue(tx); // burn amount
|
||||||
//tx.vout[1].nValue import amount
|
nTotalIn += nValueIn;
|
||||||
//nTotalIn += nValueIn;
|
dPriority += (double)nValueIn * 1000; // flat multiplier... max = 1e16.
|
||||||
dPriority += 1e16; //(double)nValueIn * 1000; // flat multiplier
|
|
||||||
} else {
|
} else {
|
||||||
int numNotaryVins = 0; bool fToCryptoAddress = false;
|
int numNotaryVins = 0; bool fToCryptoAddress = false;
|
||||||
if ( komodo_is_notarytx(tx) == 1 )
|
if ( komodo_is_notarytx(tx) == 1 )
|
||||||
@@ -363,7 +361,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
|
|
||||||
if (fNotarisation) {
|
if (fNotarisation) {
|
||||||
dPriority = 1e16;
|
dPriority = 1e16;
|
||||||
fprintf(stderr, "Notarisation.%s set to maximum priority.\n",hash.ToString().c_str());
|
//fprintf(stderr, "Notarisation.%s set to maximum priority.\n",hash.ToString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (porphan)
|
if (porphan)
|
||||||
@@ -497,8 +495,6 @@ 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);
|
||||||
@@ -524,7 +520,11 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
blocktime = GetAdjustedTime();
|
blocktime = GetAdjustedTime();
|
||||||
//if ( blocktime > pindexPrev->GetMedianTimePast()+60 )
|
//if ( blocktime > pindexPrev->GetMedianTimePast()+60 )
|
||||||
// blocktime = pindexPrev->GetMedianTimePast() + 60;
|
// blocktime = pindexPrev->GetMedianTimePast() + 60;
|
||||||
|
LEAVE_CRITICAL_SECTION(cs_main);
|
||||||
|
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||||
siglen = komodo_staked(txStaked, pblock->nBits, &blocktime, &txtime, &utxotxid, &utxovout, &utxovalue, utxosig);
|
siglen = komodo_staked(txStaked, pblock->nBits, &blocktime, &txtime, &utxotxid, &utxovout, &utxovalue, utxosig);
|
||||||
|
ENTER_CRITICAL_SECTION(cs_main);
|
||||||
|
ENTER_CRITICAL_SECTION(mempool.cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( siglen > 0 )
|
if ( siglen > 0 )
|
||||||
@@ -678,6 +678,8 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
//fprintf(stderr,"valid\n");
|
//fprintf(stderr,"valid\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ UniValue calc_MoM(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
UniValue migrate_converttoexport(const UniValue& params, bool fHelp)
|
UniValue migrate_converttoexport(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> rawproof; uint8_t *ptr; uint8_t i; uint32_t ccid = ASSETCHAINS_CC;
|
std::vector<uint8_t> rawproof; uint8_t *ptr; uint8_t i; uint32_t ccid = ASSETCHAINS_CC; uint64_t txfee = 10000;
|
||||||
if (fHelp || params.size() != 2)
|
if (fHelp || params.size() != 2)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"migrate_converttoexport rawTx dest_symbol\n"
|
"migrate_converttoexport rawTx dest_symbol\n"
|
||||||
@@ -205,7 +205,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp)
|
|||||||
ptr = rawproof.data();
|
ptr = rawproof.data();
|
||||||
for (i=0; i<rawproof.size(); i++)
|
for (i=0; i<rawproof.size(); i++)
|
||||||
ptr[i] = ASSETCHAINS_SYMBOL[i];
|
ptr[i] = ASSETCHAINS_SYMBOL[i];
|
||||||
CTxOut burnOut = MakeBurnOutput(burnAmount, ccid, targetSymbol, tx.vout,rawproof);
|
CTxOut burnOut = MakeBurnOutput(burnAmount+txfee, ccid, targetSymbol, tx.vout,rawproof);
|
||||||
UniValue ret(UniValue::VOBJ);
|
UniValue ret(UniValue::VOBJ);
|
||||||
ret.push_back(Pair("payouts", HexStr(E_MARSHAL(ss << tx.vout))));
|
ret.push_back(Pair("payouts", HexStr(E_MARSHAL(ss << tx.vout))));
|
||||||
tx.vout.clear();
|
tx.vout.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user