diff --git a/src/cc/faucet.cpp b/src/cc/faucet.cpp index 0dba256ae..a2549b7e2 100644 --- a/src/cc/faucet.cpp +++ b/src/cc/faucet.cpp @@ -14,6 +14,7 @@ ******************************************************************************/ #include "CCfaucet.h" +#include "../txmempool.h" /* This file implements a simple CC faucet as an example of how to make a new CC contract. It wont have any fancy sybil protection but will serve the purpose of a fully automated faucet. @@ -65,14 +66,15 @@ bool FaucetExactAmounts(Eval* eval,const CTransaction &tx,int32_t minage,uint64_ fprintf(stderr,"vini.%d\n",i); if ( IsFaucetInput(tx.vin[i].scriptSig) != 0 ) { - fprintf(stderr,"vini.%d get Tx\n",i); - if ( eval->GetTxUnconfirmed(tx.vin[i].prevout.hash,vinTx,hashBlock) == 0 ) - return eval->Invalid("always should find vin, but didnt"); + fprintf(stderr,"vini.%d check mempool\n",i); + if ( mempool.lookup(hash, vinTx) != 0 ) + //if ( eval->GetTxUnconfirmed(tx.vin[i].prevout.hash,vinTx,hashBlock) == 0 ) + return eval->Invalid("cant faucet mempool tx"); else { fprintf(stderr,"vini.%d check hash and vout\n",i); - if ( hashBlock == zerohash ) - return eval->Invalid("cant faucet from mempool"); + //if ( hashBlock == zerohash ) + // return eval->Invalid("cant faucet from mempool"); if ( (assetoshis= IsFaucetvout(vinTx,tx.vin[i].prevout.n)) != 0 ) inputs += assetoshis; } diff --git a/src/main.cpp b/src/main.cpp index 76f20cbb0..96f384b27 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1607,7 +1607,6 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo { // need a GetTransaction without lock so the validation code for assets can run without deadlock { - LOCK(mempool.cs); fprintf(stderr,"check mempool\n"); if (mempool.lookup(hash, txOut)) { @@ -1634,9 +1633,11 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo hashBlock = header.GetHash(); if (txOut.GetHash() != hash) return error("%s: txid mismatch", __func__); + fprintf(stderr,"found on disk\n"); return true; } } + fprintf(stderr,"not found\n"); return false; } @@ -4116,9 +4117,10 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C REJECT_INVALID, "bad-cb-multiple"); // Check transactions - if ( 0 && ASSETCHAINS_CC != 0 ) // CC contracts might refer to transactions in the current block, from a CC spend within the same block and out of order + if ( ASSETCHAINS_CC != 0 ) // CC contracts might refer to transactions in the current block, from a CC spend within the same block and out of order { CValidationState stateDummy; + fprintf(stderr,"put block's tx into mempool\n"); for (int i = 0; i < block.vtx.size(); i++) { const CTransaction &tx = block.vtx[i]; @@ -4128,6 +4130,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C continue; AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL); } + fprintf(stderr,"done putting block's tx into mempool\n"); } BOOST_FOREACH(const CTransaction& tx, block.vtx) {