mirror of
https://github.com/dashpay/dash.git
synced 2024-12-30 14:25:53 +01:00
Bugfix: actually use CCoinsViewMemPool
This commit is contained in:
parent
c2ed184f98
commit
4afc0b5411
16
src/main.cpp
16
src/main.cpp
@ -691,7 +691,13 @@ bool CTxMemPool::accept(CTransaction &tx, bool fCheckInputs,
|
|||||||
|
|
||||||
if (fCheckInputs)
|
if (fCheckInputs)
|
||||||
{
|
{
|
||||||
CCoinsViewCache &view = *pcoinsTip;
|
CCoinsView dummy;
|
||||||
|
CCoinsViewCache view(dummy);
|
||||||
|
|
||||||
|
{
|
||||||
|
LOCK(cs);
|
||||||
|
CCoinsViewMemPool viewMemPool(*pcoinsTip, *this);
|
||||||
|
view.SetBackend(viewMemPool);
|
||||||
|
|
||||||
// do we already have it?
|
// do we already have it?
|
||||||
if (view.HaveCoins(hash))
|
if (view.HaveCoins(hash))
|
||||||
@ -712,6 +718,13 @@ bool CTxMemPool::accept(CTransaction &tx, bool fCheckInputs,
|
|||||||
if (!tx.HaveInputs(view))
|
if (!tx.HaveInputs(view))
|
||||||
return error("CTxMemPool::accept() : inputs already spent");
|
return error("CTxMemPool::accept() : inputs already spent");
|
||||||
|
|
||||||
|
// Bring the best block into scope
|
||||||
|
view.GetBestBlock();
|
||||||
|
|
||||||
|
// we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool
|
||||||
|
view.SetBackend(dummy);
|
||||||
|
}
|
||||||
|
|
||||||
// Check for non-standard pay-to-script-hash in inputs
|
// Check for non-standard pay-to-script-hash in inputs
|
||||||
if (!tx.AreInputsStandard(view) && !fTestNet)
|
if (!tx.AreInputsStandard(view) && !fTestNet)
|
||||||
return error("CTxMemPool::accept() : nonstandard transaction input");
|
return error("CTxMemPool::accept() : nonstandard transaction input");
|
||||||
@ -741,7 +754,6 @@ bool CTxMemPool::accept(CTransaction &tx, bool fCheckInputs,
|
|||||||
int64 nNow = GetTime();
|
int64 nNow = GetTime();
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(cs);
|
|
||||||
// Use an exponentially decaying ~10-minute window:
|
// Use an exponentially decaying ~10-minute window:
|
||||||
dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime));
|
dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime));
|
||||||
nLastTime = nNow;
|
nLastTime = nNow;
|
||||||
|
Loading…
Reference in New Issue
Block a user