Merge branch 'fixgettransactioncrash' of https://github.com/blackjok3rtt/komodo into blackjok3rtt-fixgettransactioncrash

gettransaction fox
This commit is contained in:
blackjok3r
2018-11-02 23:19:20 +08:00
10 changed files with 181 additions and 37 deletions

View File

@@ -1199,6 +1199,23 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
REJECT_INVALID, "bad-txns-txouttotal-toolarge");
}
}
if ( ASSETCHAINS_TXPOW != 0 && tx.vjoinsplit.size() == 0 )
{
// genesis coinbase 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
uint256 txid = tx.GetHash();
if ( ((ASSETCHAINS_TXPOW & 2) != 0 && iscoinbase != 0) || ((ASSETCHAINS_TXPOW & 1) != 0 && iscoinbase == 0) )
{
if ( ((uint8_t *)&txid)[0] != 0 || ((uint8_t *)&txid)[31] != 0 )
{
uint256 genesistxid = uint256S("4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b");
if ( txid != genesistxid )
{
fprintf(stderr,"private chain iscoinbase.%d invalid txpow.%d txid.%s\n",iscoinbase,ASSETCHAINS_TXPOW,txid.GetHex().c_str());
return state.DoS(100, error("CheckTransaction(): this is a txpow chain, must have 0x00 ends"),REJECT_INVALID, "bad-txns-actxpow-chain");
}
}
}
}
// Ensure input values do not exceed MAX_MONEY
// We have not resolved the txin values at this stage,
@@ -2219,7 +2236,7 @@ namespace Consensus {
// Ensure that coinbases are matured
if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) {
return state.Invalid(
error("CheckInputs(): tried to spend coinbase at depth %d", nSpendHeight - coins->nHeight),
error("CheckInputs(): tried to spend coinbase at depth %d/%d", nSpendHeight - coins->nHeight,(int32_t)COINBASE_MATURITY),
REJECT_INVALID, "bad-txns-premature-spend-of-coinbase");
}
@@ -3207,7 +3224,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
if (!pblocktree->UpdateSpentIndex(spentIndex))
return AbortNode(state, "Failed to write transaction index");
if (fTimestampIndex) {
if (fTimestampIndex)
{
unsigned int logicalTS = pindex->nTime;
unsigned int prevLogicalTS = 0;