Skip to content

Commit

Permalink
Fix CI warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yanmaani committed May 27, 2021
1 parent 5b93a6d commit 6e31c72
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ BlockAssembler::TxAllowedForNamecoin (const CTransaction& tx) const
if (nameOutFound && nameOpOut.getNameOp () == OP_NAME_FIRSTUPDATE)
{
bool nameNewFound = false;
LOCK (cs_main);
const auto& coinsTip = ::ChainstateActive ().CoinsTip ();
for (const auto& txIn : tx.vin)
{
Expand Down
5 changes: 3 additions & 2 deletions src/names/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <names/common.h>
#include <primitives/transaction.h>
#include <serialize.h>
#include <sync.h>

#include <set>

Expand Down Expand Up @@ -105,7 +106,7 @@ void ApplyNameTransaction (const CTransaction& tx, unsigned nHeight,
/**
* Expire all names at the given height. This removes their coins
* from the UTXO set.
* @param height The new block height.
* @param nHeight The new block height.
* @param view The coins view to update.
* @param undo The block undo object to record undo information.
* @param names List all expired names here.
Expand All @@ -132,6 +133,6 @@ bool UnexpireNames (unsigned nHeight, CBlockUndo& undo,
* this throws an assertion failure.
* @param disconnect Whether we are disconnecting blocks.
*/
void CheckNameDB (ChainstateManager& chainman, bool disconnect);
void CheckNameDB (ChainstateManager& chainman, bool disconnect) EXCLUSIVE_LOCKS_REQUIRED (cs_main);

#endif // H_BITCOIN_NAMES_MAIN
16 changes: 8 additions & 8 deletions src/names/mempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace
* there is any. The txid must be for an entry in the mempool.
*/
COutPoint
getNameOutput (const CTxMemPool& pool, const uint256& txid)
getNameOutput (const CTxMemPool& pool, const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED (pool.cs)
{
AssertLockHeld (pool.cs);

Expand Down Expand Up @@ -102,7 +102,7 @@ CNameMemPool::lastNameOutput (const valtype& name) const
}

void
CNameMemPool::addUnchecked (const CTxMemPoolEntry& entry)
CNameMemPool::addUnchecked (const CTxMemPoolEntry& entry) EXCLUSIVE_LOCKS_REQUIRED (pool.cs)
{
AssertLockHeld (pool.cs);

Expand Down Expand Up @@ -137,7 +137,7 @@ CNameMemPool::addUnchecked (const CTxMemPoolEntry& entry)
}

void
CNameMemPool::remove (const CTxMemPoolEntry& entry)
CNameMemPool::remove (const CTxMemPoolEntry& entry) EXCLUSIVE_LOCKS_REQUIRED (pool.cs)
{
AssertLockHeld (pool.cs);

Expand All @@ -162,7 +162,7 @@ CNameMemPool::remove (const CTxMemPoolEntry& entry)
}

void
CNameMemPool::removeConflicts (const CTransaction& tx)
CNameMemPool::removeConflicts (const CTransaction& tx) EXCLUSIVE_LOCKS_REQUIRED (pool.cs)
{
AssertLockHeld (pool.cs);

Expand All @@ -188,7 +188,7 @@ CNameMemPool::removeConflicts (const CTransaction& tx)
}

void
CNameMemPool::removeUnexpireConflicts (const std::set<valtype>& unexpired)
CNameMemPool::removeUnexpireConflicts (const std::set<valtype>& unexpired) EXCLUSIVE_LOCKS_REQUIRED (pool.cs)
{
AssertLockHeld (pool.cs);

Expand All @@ -209,7 +209,7 @@ CNameMemPool::removeUnexpireConflicts (const std::set<valtype>& unexpired)
}

void
CNameMemPool::removeExpireConflicts (const std::set<valtype>& expired)
CNameMemPool::removeExpireConflicts (const std::set<valtype>& expired) EXCLUSIVE_LOCKS_REQUIRED (pool.cs)
{
AssertLockHeld (pool.cs);

Expand Down Expand Up @@ -238,7 +238,7 @@ CNameMemPool::removeExpireConflicts (const std::set<valtype>& expired)
}

void
CNameMemPool::check (ChainstateManager& chainman, CChainState& active_chainstate) const
CNameMemPool::check (ChainstateManager& chainman, CChainState& active_chainstate) const EXCLUSIVE_LOCKS_REQUIRED (pool.cs)
{
AssertLockHeld (pool.cs);

Expand Down Expand Up @@ -309,7 +309,7 @@ CNameMemPool::check (ChainstateManager& chainman, CChainState& active_chainstate
}

bool
CNameMemPool::checkTx (const CTransaction& tx) const
CNameMemPool::checkTx (const CTransaction& tx) const EXCLUSIVE_LOCKS_REQUIRED (pool.cs)
{
AssertLockHeld (pool.cs);

Expand Down
1 change: 1 addition & 0 deletions src/names/mempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class CNameMemPool
*/
void removeConflicts (const CTransaction& tx);


/**
* Removes conflicts in the mempool due to unexpired names. This removes
* conflicting name registrations that are no longer possible.
Expand Down
1 change: 1 addition & 0 deletions src/rest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ static bool rest_name(const std::any& context, HTTPRequest* req, const std::stri
return RESTERR(req, HTTP_BAD_REQUEST,
"Invalid encoded name: " + encodedName);

LOCK (cs_main);
CNameData data;
if (!::ChainstateActive ().CoinsTip ().GetName(plainName, data))
return RESTERR(req, HTTP_NOT_FOUND,
Expand Down
2 changes: 1 addition & 1 deletion src/txdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CCoinsViewDB final : public CCoinsView
CNameIterator* IterateNames() const override;
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock, const CNameCache &names) override;
CCoinsViewCursor *Cursor() const override;
bool ValidateNameDB(ChainstateManager& chainman, const std::function<void()>& interruption_point) const override;
bool ValidateNameDB(ChainstateManager& chainman, const std::function<void()>& interruption_point) const override EXCLUSIVE_LOCKS_REQUIRED(cs_main);

//! Attempt to update from an older database format. Returns whether an error occurred.
bool Upgrade();
Expand Down

0 comments on commit 6e31c72

Please sign in to comment.