Skip to content

Commit

Permalink
Merge bitcoin#21567: docs: fix various misleading comments
Browse files Browse the repository at this point in the history
4eca20d [doc] correct comment about ATMPW (glozow)
8fa74ae [doc] correct comment in chainparams (glozow)
2f8272c [doc] GetBestBlock() doesn't do nothing (gzhao408)

Pull request description:

  Came across a few misleading comments, wanted to fix them

ACKs for top commit:
  jnewbery:
    ACK 4eca20d
  MarcoFalke:
    ACK 4eca20d
  laanwj:
    Code review ACK 4eca20d

Tree-SHA512: 5bef1f1e7703f304128cf0eb8945e139e031580c99062bbbe15bf4db8443c2ba5a8c65844833132e6646c8980c678fc1d2ab0c63e17105585d583570ee350fd0
  • Loading branch information
laanwj committed Apr 1, 2021
2 parents 086226d + 4eca20d commit 66daf4c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
9 changes: 5 additions & 4 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits
}

/**
* Main network
* Main network on which people trade goods and services.
*/
class CMainParams : public CChainParams {
public:
Expand Down Expand Up @@ -173,7 +173,7 @@ class CMainParams : public CChainParams {
};

/**
* Testnet (v3)
* Testnet (v3): public test network which is reset from time to time.
*/
class CTestNetParams : public CChainParams {
public:
Expand Down Expand Up @@ -266,7 +266,7 @@ class CTestNetParams : public CChainParams {
};

/**
* Signet
* Signet: test network with an additional consensus parameter (see BIP325).
*/
class SigNetParams : public CChainParams {
public:
Expand Down Expand Up @@ -373,7 +373,8 @@ class SigNetParams : public CChainParams {
};

/**
* Regression test
* Regression test: intended for private networks only. Has minimal difficulty to ensure that
* blocks can be found instantly.
*/
class CRegTestParams : public CChainParams {
public:
Expand Down
5 changes: 1 addition & 4 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ struct ChainTxData {

/**
* CChainParams defines various tweakable parameters of a given instance of the
* Bitcoin system. There are three: the main network on which people trade goods
* and services, the public test network which gets reset from time to time and
* a regression test mode which is intended for private networks only. It has
* minimal difficulty to ensure that blocks can be found instantly.
* Bitcoin system.
*/
class CChainParams
{
Expand Down
9 changes: 5 additions & 4 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,8 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
}
}

// Bring the best block into scope
// This is const, but calls into the back end CoinsViews. The CCoinsViewDB at the bottom of the
// hierarchy brings the best block into scope. See CCoinsViewDB::GetBestBlock().
m_view.GetBestBlock();

// we have all inputs cached now, so switch back to dummy (to protect
Expand Down Expand Up @@ -1099,9 +1100,9 @@ static MempoolAcceptResult AcceptToMemoryPoolWithTime(const CChainParams& chainp
assert(std::addressof(::ChainstateActive()) == std::addressof(active_chainstate));
const MempoolAcceptResult result = MemPoolAccept(pool, active_chainstate).AcceptSingleTransaction(tx, args);
if (result.m_result_type != MempoolAcceptResult::ResultType::VALID) {
// Remove coins that were not present in the coins cache before calling ATMPW;
// this is to prevent memory DoS in case we receive a large number of
// invalid transactions that attempt to overrun the in-memory coins cache
// Remove coins that were not present in the coins cache before calling
// AcceptSingleTransaction(); this is to prevent memory DoS in case we receive a large
// number of invalid transactions that attempt to overrun the in-memory coins cache
// (`CCoinsViewCache::cacheCoins`).

for (const COutPoint& hashTx : coins_to_uncache)
Expand Down

0 comments on commit 66daf4c

Please sign in to comment.