Tweak locks
This commit is contained in:
@@ -62,12 +62,15 @@ bool FaucetExactAmounts(Eval* eval,const CTransaction &tx,int32_t minage,uint64_
|
|||||||
numvouts = tx.vout.size();
|
numvouts = tx.vout.size();
|
||||||
for (i=0; i<numvins; i++)
|
for (i=0; i<numvins; i++)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"vini.%d\n");
|
||||||
if ( IsFaucetInput(tx.vin[i].scriptSig) != 0 )
|
if ( IsFaucetInput(tx.vin[i].scriptSig) != 0 )
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"vini.%d get Tx\n");
|
||||||
if ( eval->GetTxUnconfirmed(tx.vin[i].prevout.hash,vinTx,hashBlock) == 0 )
|
if ( eval->GetTxUnconfirmed(tx.vin[i].prevout.hash,vinTx,hashBlock) == 0 )
|
||||||
return eval->Invalid("always should find vin, but didnt");
|
return eval->Invalid("always should find vin, but didnt");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"vini.%d check hash and vout\n");
|
||||||
if ( hashBlock == zerohash )
|
if ( hashBlock == zerohash )
|
||||||
return eval->Invalid("cant faucet from mempool");
|
return eval->Invalid("cant faucet from mempool");
|
||||||
if ( (assetoshis= IsFaucetvout(vinTx,tx.vin[i].prevout.n)) != 0 )
|
if ( (assetoshis= IsFaucetvout(vinTx,tx.vin[i].prevout.n)) != 0 )
|
||||||
|
|||||||
13
src/main.cpp
13
src/main.cpp
@@ -1606,13 +1606,16 @@ bool GetAddressUnspent(uint160 addressHash, int type,
|
|||||||
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock)
|
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock)
|
||||||
{
|
{
|
||||||
// need a GetTransaction without lock so the validation code for assets can run without deadlock
|
// need a GetTransaction without lock so the validation code for assets can run without deadlock
|
||||||
//fprintf(stderr,"check mempool\n");
|
|
||||||
if (mempool.lookup(hash, txOut))
|
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"found in mempool\n");
|
READLOCK(mempool.cs)
|
||||||
return true;
|
fprintf(stderr,"check mempool\n");
|
||||||
|
if (mempool.lookup(hash, txOut))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"found in mempool\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"check disk\n");
|
fprintf(stderr,"check disk\n");
|
||||||
|
|
||||||
if (fTxIndex) {
|
if (fTxIndex) {
|
||||||
CDiskTxPos postx;
|
CDiskTxPos postx;
|
||||||
|
|||||||
@@ -165,7 +165,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
|
|||||||
CAmount nFees = 0;
|
CAmount nFees = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK2(cs_main, mempool.cs);
|
//LOCK2(cs_main, mempool.cs);
|
||||||
|
LOCK(cs_main);
|
||||||
CBlockIndex* pindexPrev = chainActive.LastTip();
|
CBlockIndex* pindexPrev = chainActive.LastTip();
|
||||||
const int nHeight = pindexPrev->nHeight + 1;
|
const int nHeight = pindexPrev->nHeight + 1;
|
||||||
uint32_t consensusBranchId = CurrentEpochBranchId(nHeight, chainparams.GetConsensus());
|
uint32_t consensusBranchId = CurrentEpochBranchId(nHeight, chainparams.GetConsensus());
|
||||||
@@ -185,6 +186,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
|
|||||||
for (CTxMemPool::indexed_transaction_set::iterator mi = mempool.mapTx.begin();
|
for (CTxMemPool::indexed_transaction_set::iterator mi = mempool.mapTx.begin();
|
||||||
mi != mempool.mapTx.end(); ++mi)
|
mi != mempool.mapTx.end(); ++mi)
|
||||||
{
|
{
|
||||||
|
READLOCK(mempool.cs);
|
||||||
const CTransaction& tx = mi->GetTx();
|
const CTransaction& tx = mi->GetTx();
|
||||||
|
|
||||||
int64_t nLockTimeCutoff = (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST)
|
int64_t nLockTimeCutoff = (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST)
|
||||||
|
|||||||
Reference in New Issue
Block a user