This commit is contained in:
jl777
2017-02-06 10:16:12 +02:00
parent 0c053c9ed5
commit 7a90b9dd6b
6 changed files with 14 additions and 2 deletions

View File

@@ -36,7 +36,8 @@ struct knotaries_entry *Pubkeys;
struct komodo_state KOMODO_STATES[34];
int COINBASE_MATURITY = 100;
#define _COINBASE_MATURITY 64
int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET;
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES;

View File

@@ -1860,6 +1860,8 @@ bool ContextualCheckInputs(const CTransaction& tx, CValidationState &state, cons
// If prev is coinbase, check that it's matured
if (coins->IsCoinBase()) {
if ( ASSETCHAINS_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) {
fprintf(stderr,"ContextualCheckInputs failure.1 i.%d of %d\n",i,(int32_t)tx.vin.size());

View File

@@ -264,6 +264,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
if (wtx.IsCoinBase())
{
extern char ASSETCHAINS_SYMBOL[];
if ( ASSETCHAINS_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
quint32 numBlocksToMaturity = COINBASE_MATURITY + 1;
strHTML += "<br>" + tr("Generated coins must mature %1 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to \"not accepted\" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.").arg(QString::number(numBlocksToMaturity)) + "<br>";
}

View File

@@ -166,6 +166,9 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& rem
void CTxMemPool::removeCoinbaseSpends(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight)
{
// Remove transactions spending a coinbase which are now immature
extern char ASSETCHAINS_SYMBOL[];
if ( ASSETCHAINS_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
LOCK(cs);
list<CTransaction> transactionsToRemove;
for (std::map<uint256, CTxMemPoolEntry>::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {

View File

@@ -3593,6 +3593,9 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
int CMerkleTx::GetBlocksToMaturity() const
{
extern char ASSETCHAINS_SYMBOL[];
if ( ASSETCHAINS_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
if (!IsCoinBase())
return 0;
return max(0, (COINBASE_MATURITY+1) - GetDepthInMainChain());

View File

@@ -58,7 +58,7 @@ static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
//! Size of witness cache
// Should be large enough that we can expect not to reorg beyond our cache
// unless there is some exceptional network disruption.
static const unsigned int WITNESS_CACHE_SIZE = COINBASE_MATURITY+1;
static const unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+1;
class CAccountingEntry;
class CBlockIndex;