refactor: replace instances of typedef with using in dash code (#4488)

This commit is contained in:
PastaPastaPasta 2021-10-05 17:26:29 -04:00 committed by GitHub
parent b4d001a602
commit 8d5c586477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 88 additions and 90 deletions

View File

@ -434,22 +434,22 @@ public:
return hash;
}
};
typedef CBLSLazyWrapper<CBLSSignature> CBLSLazySignature;
typedef CBLSLazyWrapper<CBLSPublicKey> CBLSLazyPublicKey;
typedef CBLSLazyWrapper<CBLSSecretKey> CBLSLazySecretKey;
using CBLSLazySignature = CBLSLazyWrapper<CBLSSignature>;
using CBLSLazyPublicKey = CBLSLazyWrapper<CBLSPublicKey>;
using CBLSLazySecretKey = CBLSLazyWrapper<CBLSSecretKey>;
#endif
typedef std::vector<CBLSId> BLSIdVector;
typedef std::vector<CBLSPublicKey> BLSVerificationVector;
typedef std::vector<CBLSPublicKey> BLSPublicKeyVector;
typedef std::vector<CBLSSecretKey> BLSSecretKeyVector;
typedef std::vector<CBLSSignature> BLSSignatureVector;
using BLSIdVector = std::vector<CBLSId>;
using BLSVerificationVector = std::vector<CBLSPublicKey>;
using BLSPublicKeyVector = std::vector<CBLSPublicKey>;
using BLSSecretKeyVector = std::vector<CBLSSecretKey>;
using BLSSignatureVector = std::vector<CBLSSignature>;
typedef std::shared_ptr<BLSIdVector> BLSIdVectorPtr;
typedef std::shared_ptr<BLSVerificationVector> BLSVerificationVectorPtr;
typedef std::shared_ptr<BLSPublicKeyVector> BLSPublicKeyVectorPtr;
typedef std::shared_ptr<BLSSecretKeyVector> BLSSecretKeyVectorPtr;
typedef std::shared_ptr<BLSSignatureVector> BLSSignatureVectorPtr;
using BLSIdVectorPtr = std::shared_ptr<BLSIdVector>;
using BLSVerificationVectorPtr = std::shared_ptr<BLSVerificationVector>;
using BLSPublicKeyVectorPtr = std::shared_ptr<BLSPublicKeyVector>;
using BLSSecretKeyVectorPtr = std::shared_ptr<BLSSecretKeyVector>;
using BLSSignatureVectorPtr = std::shared_ptr<BLSSignatureVector>;
bool BLSInit();

View File

@ -21,9 +21,9 @@ private:
CBLSPublicKey pubKey;
};
typedef std::map<MessageId, Message> MessageMap;
typedef typename MessageMap::iterator MessageMapIterator;
typedef std::map<SourceId, std::vector<MessageMapIterator>> MessagesBySourceMap;
using MessageMap = std::map<MessageId, Message>;
using MessageMapIterator = typename MessageMap::iterator;
using MessagesBySourceMap = std::map<SourceId, std::vector<MessageMapIterator>>;
bool secureVerification;
bool perMessageFallback;

View File

@ -69,8 +69,8 @@ public:
class CBLSIESMultiRecipientBlobs
{
public:
typedef std::vector<unsigned char> Blob;
typedef std::vector<Blob> BlobVector;
using Blob = std::vector<unsigned char>;
using BlobVector = std::vector<Blob>;
CBLSPublicKey ephemeralPubKey;
uint256 ivSeed;
@ -96,7 +96,7 @@ template <typename Object>
class CBLSIESMultiRecipientObjects : public CBLSIESMultiRecipientBlobs
{
public:
typedef std::vector<Object> ObjectVector;
using ObjectVector = std::vector<Object>;
bool Encrypt(const std::vector<CBLSPublicKey>& recipients, const ObjectVector& _objects, int nVersion)
{

View File

@ -129,8 +129,6 @@ bool CBLSWorker::GenerateContributions(int quorumThreshold, const BLSIdVector& i
// input vector is stored. This means that the input vector must stay alive for the whole lifetime of the Aggregator
template <typename T>
struct Aggregator : public std::enable_shared_from_this<Aggregator<T>> {
typedef T ElementType;
size_t batchSize{16};
std::shared_ptr<std::vector<const T*> > inputVec;
@ -146,7 +144,7 @@ struct Aggregator : public std::enable_shared_from_this<Aggregator<T>> {
// keeps track of currently queued/in-progress batches. If it reaches 0, we are done
std::atomic<size_t> waitCount{0};
typedef std::function<void(const T& agg)> DoneCallback;
using DoneCallback = std::function<void(const T& agg)>;
DoneCallback doneCallback;
// TP can either be a pointer or a reference
@ -331,11 +329,11 @@ struct Aggregator : public std::enable_shared_from_this<Aggregator<T>> {
// Same rules for the input vectors apply to the VectorAggregator as for the Aggregator (they must stay alive)
template <typename T>
struct VectorAggregator : public std::enable_shared_from_this<VectorAggregator<T>> {
typedef Aggregator<T> AggregatorType;
typedef std::vector<T> VectorType;
typedef std::shared_ptr<VectorType> VectorPtrType;
typedef std::vector<VectorPtrType> VectorVectorType;
typedef std::function<void(const VectorPtrType& agg)> DoneCallback;
using AggregatorType = Aggregator<T>;
using VectorType = std::vector<T>;
using VectorPtrType = std::shared_ptr<VectorType>;
using VectorVectorType = std::vector<VectorPtrType>;
using DoneCallback = std::function<void(const VectorPtrType& agg)>;
DoneCallback doneCallback;
const VectorVectorType& vecs;

View File

@ -20,9 +20,9 @@
class CBLSWorker
{
public:
typedef std::function<void(const CBLSSignature&)> SignDoneCallback;
typedef std::function<void(bool)> SigVerifyDoneCallback;
typedef std::function<bool()> CancelCond;
using SignDoneCallback = std::function<void(const CBLSSignature&)>;
using SigVerifyDoneCallback = std::function<void(bool)>;
using CancelCond = std::function<bool()>;
private:
ctpl::thread_pool workerPool;

View File

@ -42,21 +42,21 @@ template<typename K, typename V, typename Size = uint32_t>
class CacheMap
{
public:
typedef Size size_type;
using size_type = Size;
typedef CacheItem<K,V> item_t;
using item_t = CacheItem<K,V>;
typedef std::list<item_t> list_t;
using list_t = std::list<item_t>;
typedef typename list_t::iterator list_it;
using list_it = typename list_t::iterator;
typedef typename list_t::const_iterator list_cit;
using list_cit = typename list_t::const_iterator;
typedef std::map<K, list_it> map_t;
using map_t = std::map<K, list_it>;
typedef typename map_t::iterator map_it;
using map_it = typename map_t::iterator;
typedef typename map_t::const_iterator map_cit;
using map_cit = typename map_t::const_iterator;
private:
size_type nMaxSize;

View File

@ -21,27 +21,27 @@ template<typename K, typename V, typename Size = uint32_t>
class CacheMultiMap
{
public:
typedef Size size_type;
using size_type = Size;
typedef CacheItem<K,V> item_t;
using item_t = CacheItem<K,V>;
typedef std::list<item_t> list_t;
using list_t = std::list<item_t>;
typedef typename list_t::iterator list_it;
using list_it = typename list_t::iterator;
typedef typename list_t::const_iterator list_cit;
using list_cit = typename list_t::const_iterator;
typedef std::map<V,list_it> it_map_t;
using it_map_t = std::map<V,list_it>;
typedef typename it_map_t::iterator it_map_it;
using it_map_it = typename it_map_t::iterator;
typedef typename it_map_t::const_iterator it_map_cit;
using it_map_cit = typename it_map_t::const_iterator;
typedef std::map<K, it_map_t> map_t;
using map_t = std::map<K, it_map_t>;
typedef typename map_t::iterator map_it;
using map_it = typename map_t::iterator;
typedef typename map_t::const_iterator map_cit;
using map_cit = typename map_t::const_iterator;
private:
size_type nMaxSize;

View File

@ -11,7 +11,7 @@
#include <utility>
class CDeterministicMN;
typedef std::shared_ptr<const CDeterministicMN> CDeterministicMNCPtr;
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
class CCoinJoinClientManager;
class CCoinJoinClientQueueManager;

View File

@ -131,8 +131,8 @@ public:
std::string ToString() const;
void ToJson(UniValue& obj) const;
};
typedef std::shared_ptr<CDeterministicMNState> CDeterministicMNStatePtr;
typedef std::shared_ptr<const CDeterministicMNState> CDeterministicMNStateCPtr;
using CDeterministicMNStatePtr = std::shared_ptr<CDeterministicMNState>;
using CDeterministicMNStateCPtr = std::shared_ptr<const CDeterministicMNState>;
class CDeterministicMNStateDiff
{
@ -259,7 +259,7 @@ public:
std::string ToString() const;
void ToJson(UniValue& obj) const;
};
typedef std::shared_ptr<const CDeterministicMN> CDeterministicMNCPtr;
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
class CDeterministicMNListDiff;
@ -301,9 +301,9 @@ inline void SerReadWrite(Stream& s, immer::map<K, T, Hash, Equal>& obj, CSerActi
class CDeterministicMNList
{
public:
typedef immer::map<uint256, CDeterministicMNCPtr> MnMap;
typedef immer::map<uint64_t, uint256> MnInternalIdMap;
typedef immer::map<uint256, std::pair<uint256, uint32_t> > MnUniquePropertyMap;
using MnMap = immer::map<uint256, CDeterministicMNCPtr>;
using MnInternalIdMap = immer::map<uint64_t, uint256>;
using MnUniquePropertyMap = immer::map<uint256, std::pair<uint256, uint32_t> >;
private:
uint256 blockHash;

View File

@ -36,8 +36,8 @@ public:
private:
CDBWrapper db;
typedef CDBTransaction<CDBWrapper, CDBBatch> RootTransaction;
typedef CDBTransaction<RootTransaction, RootTransaction> CurTransaction;
using RootTransaction = CDBTransaction<CDBWrapper, CDBBatch>;
using CurTransaction = CDBTransaction<RootTransaction, RootTransaction>;
CDBBatch rootBatch;
RootTransaction rootDBTransaction;

View File

@ -17,7 +17,7 @@ class CSuperblock;
class CGovernanceTriggerManager;
class CSuperblockManager;
typedef std::shared_ptr<CSuperblock> CSuperblock_sptr;
using CSuperblock_sptr = std::shared_ptr<CSuperblock>;
// DECLARE GLOBAL VARIABLES FOR GOVERNANCE CLASSES
extern CGovernanceTriggerManager triggerman;

View File

@ -23,7 +23,7 @@ extern CGovernanceManager governance;
static const int RATE_BUFFER_SIZE = 5;
class CDeterministicMNList;
typedef std::shared_ptr<CDeterministicMNList> CDeterministicMNListPtr;
using CDeterministicMNListPtr = std::shared_ptr<CDeterministicMNList>;
class CRateCheckBuffer
{
@ -145,13 +145,13 @@ public: // Types
};
typedef CacheMap<uint256, CGovernanceObject*> object_ref_cm_t;
using object_ref_cm_t = CacheMap<uint256, CGovernanceObject*>;
typedef CacheMultiMap<uint256, vote_time_pair_t> vote_cmm_t;
using vote_cmm_t = CacheMultiMap<uint256, vote_time_pair_t>;
typedef std::map<COutPoint, last_object_rec> txout_m_t;
using txout_m_t = std::map<COutPoint, last_object_rec>;
typedef std::set<uint256> hash_s_t;
using hash_s_t = std::set<uint256>;
private:
static const int MAX_CACHE_SIZE = 1000000;

View File

@ -44,7 +44,7 @@ static const int SEEN_OBJECT_ERROR_INVALID = 1;
static const int SEEN_OBJECT_EXECUTED = 3; //used for triggers
static const int SEEN_OBJECT_UNKNOWN = 4; // the default
typedef std::pair<CGovernanceVote, int64_t> vote_time_pair_t;
using vote_time_pair_t = std::pair<CGovernanceVote, int64_t>;
inline bool operator<(const vote_time_pair_t& p1, const vote_time_pair_t& p2)
{
@ -72,7 +72,7 @@ struct vote_instance_t {
}
};
typedef std::map<int, vote_instance_t> vote_instance_m_t;
using vote_instance_m_t = std::map<int, vote_instance_t>;
struct vote_rec_t {
vote_instance_m_t mapInstances;
@ -91,7 +91,7 @@ struct vote_rec_t {
class CGovernanceObject
{
public: // Types
typedef std::map<COutPoint, vote_rec_t> vote_m_t;
using vote_m_t = std::map<COutPoint, vote_rec_t>;
private:
/// critical section to protect the inner data structures

View File

@ -24,9 +24,9 @@
class CGovernanceObjectVoteFile
{
public: // Types
typedef std::list<CGovernanceVote> vote_l_t;
using vote_l_t = std::list<CGovernanceVote>;
typedef std::map<uint256, vote_l_t::iterator> vote_m_t;
using vote_m_t = std::map<uint256, vote_l_t::iterator>;
private:
int nMemoryVotes;

View File

@ -21,7 +21,7 @@ class CNode;
class CBlockIndex;
class CDeterministicMN;
typedef std::shared_ptr<const CDeterministicMN> CDeterministicMNCPtr;
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
namespace llmq
@ -140,11 +140,11 @@ public:
*/
class CQuorum;
typedef std::shared_ptr<CQuorum> CQuorumPtr;
typedef std::shared_ptr<const CQuorum> CQuorumCPtr;
using CQuorumPtr = std::shared_ptr<CQuorum>;
using CQuorumCPtr = std::shared_ptr<const CQuorum>;
class CFinalCommitment;
typedef std::shared_ptr<CFinalCommitment> CFinalCommitmentPtr;
using CFinalCommitmentPtr = std::shared_ptr<CFinalCommitment>;
class CQuorum

View File

@ -27,7 +27,7 @@ namespace llmq
{
class CFinalCommitment;
typedef std::shared_ptr<CFinalCommitment> CFinalCommitmentPtr;
using CFinalCommitmentPtr = std::shared_ptr<CFinalCommitment>;
class CQuorumBlockProcessor
{

View File

@ -70,7 +70,7 @@ private:
uint256 lastSignedMsgHash GUARDED_BY(cs);
// We keep track of txids from recently received blocks so that we can check if all TXs got islocked
typedef std::unordered_map<uint256, std::shared_ptr<std::unordered_set<uint256, StaticSaltedHasher>>> BlockTxs;
using BlockTxs = std::unordered_map<uint256, std::shared_ptr<std::unordered_set<uint256, StaticSaltedHasher>>>;
BlockTxs blockTxs GUARDED_BY(cs);
std::unordered_map<uint256, int64_t> txFirstSeenTime GUARDED_BY(cs);

View File

@ -101,7 +101,7 @@ public:
obj.pushKV("membersSig", membersSig.ToString());
}
};
typedef std::shared_ptr<CFinalCommitment> CFinalCommitmentPtr;
using CFinalCommitmentPtr = std::shared_ptr<CFinalCommitment>;
class CFinalCommitmentTxPayload
{

View File

@ -1198,7 +1198,7 @@ std::vector<CFinalCommitment> CDKGSession::FinalizeCommitments()
CDKGLogger logger(*this, __func__);
typedef std::vector<bool> Key;
using Key = std::vector<bool>;
std::map<Key, std::vector<CDKGPrematureCommitment>> commitmentsMap;
{

View File

@ -40,7 +40,7 @@ enum QuorumPhase {
class CDKGPendingMessages
{
public:
typedef std::pair<NodeId, std::shared_ptr<CDataStream>> BinaryMessage;
using BinaryMessage = std::pair<NodeId, std::shared_ptr<CDataStream>>;
private:
mutable CCriticalSection cs;
@ -138,8 +138,8 @@ private:
std::pair<QuorumPhase, uint256> GetPhaseAndQuorumHash() const;
typedef std::function<void()> StartPhaseFunc;
typedef std::function<bool()> WhileWaitFunc;
using StartPhaseFunc = std::function<void()>;
using WhileWaitFunc = std::function<bool()>;
void WaitForNextPhase(QuorumPhase curPhase, QuorumPhase nextPhase, const uint256& expectedQuorumHash, const WhileWaitFunc& runWhileWaiting) const;
void WaitForNewQuorum(const uint256& oldQuorumHash) const;
void SleepBeforePhase(QuorumPhase curPhase, const uint256& expectedQuorumHash, double randomSleepFactor, const WhileWaitFunc& runWhileWaiting) const;

View File

@ -53,7 +53,7 @@ struct CInstantSendLock
bool IsDeterministic() const { return nVersion != islock_version; }
};
typedef std::shared_ptr<CInstantSendLock> CInstantSendLockPtr;
using CInstantSendLockPtr = std::shared_ptr<CInstantSendLock>;
class CInstantSendDb
{

View File

@ -17,7 +17,7 @@
#include <unordered_map>
typedef int64_t NodeId;
using NodeId = int64_t;
class CInv;
class CNode;
@ -25,7 +25,7 @@ namespace llmq
{
class CQuorum;
typedef std::shared_ptr<const CQuorum> CQuorumCPtr;
using CQuorumCPtr = std::shared_ptr<const CQuorum>;
// Keep recovered signatures for a week. This is a "-maxrecsigsage" option default.
static const int64_t DEFAULT_MAX_RECOVERED_SIGS_AGE = 60 * 60 * 24 * 7;

View File

@ -22,7 +22,7 @@ class CScheduler;
namespace llmq
{
// <signHash, quorumMember>
typedef std::pair<uint256, uint16_t> SigShareKey;
using SigShareKey = std::pair<uint256, uint16_t>;
constexpr uint32_t UNINITIALIZED_SESSION_ID{std::numeric_limits<uint32_t>::max()};

View File

@ -17,7 +17,7 @@
class CBlockIndex;
class CDeterministicMN;
typedef std::shared_ptr<const CDeterministicMN> CDeterministicMNCPtr;
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
class CBLSPublicKey;
namespace llmq

View File

@ -83,7 +83,7 @@ public:
void SetLastOutboundSuccess(int64_t t) { lastOutboundSuccess = t; }
int64_t GetLastOutboundSuccess() const { return lastOutboundSuccess; }
};
typedef std::shared_ptr<CMasternodeMetaInfo> CMasternodeMetaInfoPtr;
using CMasternodeMetaInfoPtr = std::shared_ptr<CMasternodeMetaInfo>;
class CMasternodeMetaMan
{

View File

@ -18,7 +18,7 @@ class MasternodeList;
}
class CDeterministicMN;
typedef std::shared_ptr<const CDeterministicMN> CDeterministicMNCPtr;
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
class ClientModel;
class WalletModel;

View File

@ -11,8 +11,8 @@
#include <array>
typedef std::vector<uint8_t> valtype;
typedef std::vector<valtype> stacktype;
using valtype = std::vector<uint8_t>;
using stacktype = std::vector<valtype>;
BOOST_FIXTURE_TEST_SUITE(dip0020opcodes_tests, BasicTestingSetup)

View File

@ -23,7 +23,7 @@
#include <boost/test/unit_test.hpp>
typedef std::map<COutPoint, std::pair<int, CAmount>> SimpleUTXOMap;
using SimpleUTXOMap = std::map<COutPoint, std::pair<int, CAmount>>;
static SimpleUTXOMap BuildSimpleUtxoMap(const std::vector<CTransactionRef>& txs)
{