|
|
@ -233,7 +233,7 @@ namespace { |
|
|
|
int nPeersWithValidatedDownloads = 0; |
|
|
|
int nPeersWithValidatedDownloads = 0; |
|
|
|
|
|
|
|
|
|
|
|
/** Relay map, protected by cs_main. */ |
|
|
|
/** Relay map, protected by cs_main. */ |
|
|
|
typedef std::map<uint256, std::shared_ptr<const CTransaction>> MapRelay; |
|
|
|
typedef std::map<uint256, CTransactionRef> MapRelay; |
|
|
|
MapRelay mapRelay; |
|
|
|
MapRelay mapRelay; |
|
|
|
/** Expiration-time ordered list of (expire time, relay map entry) pairs, protected by cs_main). */ |
|
|
|
/** Expiration-time ordered list of (expire time, relay map entry) pairs, protected by cs_main). */ |
|
|
|
std::deque<std::pair<int64_t, MapRelay::iterator>> vRelayExpiration; |
|
|
|
std::deque<std::pair<int64_t, MapRelay::iterator>> vRelayExpiration; |
|
|
@ -1639,7 +1639,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, const Consensus::P |
|
|
|
|
|
|
|
|
|
|
|
LOCK(cs_main); |
|
|
|
LOCK(cs_main); |
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<const CTransaction> ptx = mempool.get(hash); |
|
|
|
CTransactionRef ptx = mempool.get(hash); |
|
|
|
if (ptx) |
|
|
|
if (ptx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
txOut = *ptx; |
|
|
|
txOut = *ptx; |
|
|
@ -2845,7 +2845,7 @@ static int64_t nTimePostConnect = 0; |
|
|
|
* Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock |
|
|
|
* Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock |
|
|
|
* corresponding to pindexNew, to bypass loading it again from disk. |
|
|
|
* corresponding to pindexNew, to bypass loading it again from disk. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock, std::vector<std::shared_ptr<const CTransaction>> &txConflicted, std::vector<std::tuple<std::shared_ptr<const CTransaction>,CBlockIndex*,int>> &txChanged) |
|
|
|
bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock, std::vector<CTransactionRef> &txConflicted, std::vector<std::tuple<CTransactionRef,CBlockIndex*,int>> &txChanged) |
|
|
|
{ |
|
|
|
{ |
|
|
|
assert(pindexNew->pprev == chainActive.Tip()); |
|
|
|
assert(pindexNew->pprev == chainActive.Tip()); |
|
|
|
// Read block from disk.
|
|
|
|
// Read block from disk.
|
|
|
@ -2968,7 +2968,7 @@ static void PruneBlockIndexCandidates() { |
|
|
|
* Try to make some progress towards making pindexMostWork the active block. |
|
|
|
* Try to make some progress towards making pindexMostWork the active block. |
|
|
|
* pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork. |
|
|
|
* pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static bool ActivateBestChainStep(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const CBlock* pblock, bool& fInvalidFound, std::vector<std::shared_ptr<const CTransaction>>& txConflicted, std::vector<std::tuple<std::shared_ptr<const CTransaction>,CBlockIndex*,int>>& txChanged) |
|
|
|
static bool ActivateBestChainStep(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const CBlock* pblock, bool& fInvalidFound, std::vector<CTransactionRef>& txConflicted, std::vector<std::tuple<CTransactionRef,CBlockIndex*,int>>& txChanged) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertLockHeld(cs_main); |
|
|
|
AssertLockHeld(cs_main); |
|
|
|
const CBlockIndex *pindexOldTip = chainActive.Tip(); |
|
|
|
const CBlockIndex *pindexOldTip = chainActive.Tip(); |
|
|
@ -3069,7 +3069,7 @@ static void NotifyHeaderTip() { |
|
|
|
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, const CBlock *pblock) { |
|
|
|
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, const CBlock *pblock) { |
|
|
|
CBlockIndex *pindexMostWork = NULL; |
|
|
|
CBlockIndex *pindexMostWork = NULL; |
|
|
|
CBlockIndex *pindexNewTip = NULL; |
|
|
|
CBlockIndex *pindexNewTip = NULL; |
|
|
|
std::vector<std::tuple<std::shared_ptr<const CTransaction>,CBlockIndex*,int>> txChanged; |
|
|
|
std::vector<std::tuple<CTransactionRef,CBlockIndex*,int>> txChanged; |
|
|
|
if (pblock) |
|
|
|
if (pblock) |
|
|
|
txChanged.reserve(pblock->vtx.size()); |
|
|
|
txChanged.reserve(pblock->vtx.size()); |
|
|
|
do { |
|
|
|
do { |
|
|
@ -3079,7 +3079,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
const CBlockIndex *pindexFork; |
|
|
|
const CBlockIndex *pindexFork; |
|
|
|
std::vector<std::shared_ptr<const CTransaction>> txConflicted; |
|
|
|
std::vector<CTransactionRef> txConflicted; |
|
|
|
bool fInitialDownload; |
|
|
|
bool fInitialDownload; |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_main); |
|
|
|
LOCK(cs_main); |
|
|
@ -3523,7 +3523,7 @@ void UpdateUncommittedBlockStructures(CBlock& block, const CBlockIndex* pindexPr |
|
|
|
tx.wit.vtxinwit.resize(1); |
|
|
|
tx.wit.vtxinwit.resize(1); |
|
|
|
tx.wit.vtxinwit[0].scriptWitness.stack.resize(1); |
|
|
|
tx.wit.vtxinwit[0].scriptWitness.stack.resize(1); |
|
|
|
tx.wit.vtxinwit[0].scriptWitness.stack[0] = nonce; |
|
|
|
tx.wit.vtxinwit[0].scriptWitness.stack[0] = nonce; |
|
|
|
block.vtx[0] = std::make_shared<const CTransaction>(std::move(tx)); |
|
|
|
block.vtx[0] = MakeTransactionRef(std::move(tx)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|