MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / AlreadyHave

Function AlreadyHave

src/main.cpp:4524–4551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4522
4523
4524bool static AlreadyHave(const CInv& inv)
4525{
4526 switch (inv.type)
4527 {
4528 case MSG_TX:
4529 {
4530 assert(recentRejects);
4531 if (chainActive.Tip()->GetBlockHash() != hashRecentRejectsChainTip)
4532 {
4533 // If the chain tip has changed previously rejected transactions
4534 // might be now valid, e.g. due to a nLockTime'd tx becoming valid,
4535 // or a double-spend. Reset the rejects filter and give those
4536 // txs a second chance.
4537 hashRecentRejectsChainTip = chainActive.Tip()->GetBlockHash();
4538 recentRejects->reset();
4539 }
4540
4541 return recentRejects->contains(inv.hash) ||
4542 mempool.exists(inv.hash) ||
4543 mapOrphanTransactions.count(inv.hash) ||
4544 pcoinsTip->HaveCoins(inv.hash);
4545 }
4546 case MSG_BLOCK:
4547 return mapBlockIndex.count(inv.hash);
4548 }
4549 // Don't know what it is, just say we already got one
4550 return true;
4551}
4552
4553// Activate thin blocks only if we're not doing bulk downloads (it's faster to use ordinary block messages when
4554// catching up with the block chain).

Callers 2

ProcessMessageFunction · 0.85
SendMessagesFunction · 0.85

Calls 7

resetMethod · 0.80
countMethod · 0.80
GetBlockHashMethod · 0.45
TipMethod · 0.45
containsMethod · 0.45
existsMethod · 0.45
HaveCoinsMethod · 0.45

Tested by

no test coverage detected