From cb5763f0096a84ae26c759772f7d361ff5cf0052 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 19 Aug 2018 06:53:50 -1100 Subject: [PATCH] Test --- src/cc/CCutils.cpp | 2 +- src/main.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index bdeb93481..61bebab40 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -256,9 +256,9 @@ CPubKey GetUnspendable(struct CCcontract_info *cp,uint8_t *unspendablepriv) bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector paramsNull,const CTransaction &ctx, unsigned int nIn) { CTransaction createTx; uint256 assetid,assetid2,hashBlock; uint8_t funcid; int32_t i,n; int64_t amount; std::vector origpubkey; + fprintf(stderr,"KOMODO_CONNECTING.%d\n",KOMODO_CONNECTING); if ( KOMODO_CONNECTING < 0 ) // always comes back with > 0 for final confirmation return(true); - fprintf(stderr,"KOMODO_CONNECTING.%d\n",KOMODO_CONNECTING); // there is a chance CC tx is valid in mempool, but invalid when in block, so we cant filter duplicate requests. if any of the vins are spent, for example //txid = ctx.GetHash(); //if ( txid == cp->prevtxid ) diff --git a/src/main.cpp b/src/main.cpp index 74037b65b..299906a9a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1283,26 +1283,17 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa //fprintf(stderr,"AcceptToMemoryPool komodo_validate_interest failure\n"); return error("AcceptToMemoryPool: komodo_validate_interest failed"); } - if ( KOMODO_CONNECTING <= 0 && chainActive.LastTip() != 0 ) - { - flag = 1; - KOMODO_CONNECTING = 100000000 + (int32_t)chainActive.LastTip()->nHeight + 1; - } if (!CheckTransaction(tx, state, verifier)) { - if ( flag != 0 ) - KOMODO_CONNECTING = -1; return error("AcceptToMemoryPool: CheckTransaction failed"); } - if ( flag != 0 ) - KOMODO_CONNECTING = -1; // DoS level set to 10 to be more forgiving. // Check transaction contextually against the set of consensus rules which apply in the next block to be mined. if (!ContextualCheckTransaction(tx, state, nextBlockHeight, 10)) { return error("AcceptToMemoryPool: ContextualCheckTransaction failed"); } - + // Coinbase is only valid in a block, not as a loose transaction if (tx.IsCoinBase()) { @@ -1535,12 +1526,21 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // invalid blocks, however allowing such transactions into the mempool // can be exploited as a DoS attack. // XXX: is this neccesary for CryptoConditions? + if ( KOMODO_CONNECTING <= 0 && chainActive.LastTip() != 0 ) + { + flag = 1; + KOMODO_CONNECTING = 100000000 + (int32_t)chainActive.LastTip()->nHeight + 1; + } if (!ContextualCheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true, txdata, Params().GetConsensus(), consensusBranchId)) { + if ( flag != 0 ) + KOMODO_CONNECTING = -1; fprintf(stderr,"accept failure.10\n"); return error("AcceptToMemoryPool: BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s", hash.ToString()); } - + if ( flag != 0 ) + KOMODO_CONNECTING = -1; + // Store transaction in memory if ( komodo_is_notarytx(tx) == 0 ) KOMODO_ON_DEMAND++;