mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
Merge pull request #4271 from PastaPastaPasta/backports-0.18-pr8
Backports 0.18 pr8
This commit is contained in:
commit
8e19b6b398
@ -6,4 +6,4 @@
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
travis_retry pip install flake8
|
||||
travis_retry pip install flake8==3.5.0
|
||||
|
@ -291,4 +291,4 @@ clean-docs:
|
||||
|
||||
clean-local: clean-docs
|
||||
rm -rf coverage_percent.txt test_dash.coverage/ total.coverage/ test/tmp/ cache/ $(OSX_APP)
|
||||
rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache
|
||||
rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache share/rpcauth/__pycache__
|
||||
|
@ -15,7 +15,7 @@ RUN apt-get update && apt-get install $APT_ARGS python3-pip python3-setuptools &
|
||||
# Python stuff
|
||||
RUN pip3 install pyzmq # really needed?
|
||||
RUN pip3 install jinja2
|
||||
RUN pip3 install flake8
|
||||
RUN pip3 install flake8==3.5.0
|
||||
|
||||
# dash_hash
|
||||
RUN git clone https://github.com/dashpay/dash_hash
|
||||
|
@ -1,13 +1,13 @@
|
||||
build_darwin_CC: = $(shell xcrun -f clang)
|
||||
build_darwin_CXX: = $(shell xcrun -f clang++)
|
||||
build_darwin_AR: = $(shell xcrun -f ar)
|
||||
build_darwin_RANLIB: = $(shell xcrun -f ranlib)
|
||||
build_darwin_STRIP: = $(shell xcrun -f strip)
|
||||
build_darwin_OTOOL: = $(shell xcrun -f otool)
|
||||
build_darwin_NM: = $(shell xcrun -f nm)
|
||||
build_darwin_CC:=$(shell xcrun -f clang)
|
||||
build_darwin_CXX:=$(shell xcrun -f clang++)
|
||||
build_darwin_AR:=$(shell xcrun -f ar)
|
||||
build_darwin_RANLIB:=$(shell xcrun -f ranlib)
|
||||
build_darwin_STRIP:=$(shell xcrun -f strip)
|
||||
build_darwin_OTOOL:=$(shell xcrun -f otool)
|
||||
build_darwin_NM:=$(shell xcrun -f nm)
|
||||
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
|
||||
build_darwin_SHA256SUM = shasum -a 256
|
||||
build_darwin_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) -o
|
||||
build_darwin_SHA256SUM=shasum -a 256
|
||||
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) -o
|
||||
|
||||
#darwin host on darwin builder. overrides darwin host preferences.
|
||||
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(shell xcrun --show-sdk-path)
|
||||
|
@ -174,7 +174,7 @@ nodist_test_test_dash_SOURCES = $(GENERATED_TEST_FILES)
|
||||
|
||||
$(BITCOIN_TESTS): $(GENERATED_TEST_FILES)
|
||||
|
||||
CLEAN_BITCOIN_TEST = test/*.gcda test/*.gcno $(GENERATED_TEST_FILES)
|
||||
CLEAN_BITCOIN_TEST = test/*.gcda test/*.gcno $(GENERATED_TEST_FILES) $(BITCOIN_TESTS:=.log)
|
||||
|
||||
CLEANFILES += $(CLEAN_BITCOIN_TEST)
|
||||
|
||||
|
@ -192,39 +192,39 @@ static const int64_t ADDRMAN_TEST_WINDOW = 40*60; // 40 minutes
|
||||
*/
|
||||
class CAddrMan
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
friend class CAddrManTest;
|
||||
|
||||
protected:
|
||||
//! critical section to protect the inner data structures
|
||||
mutable CCriticalSection cs;
|
||||
|
||||
private:
|
||||
//! last used nId
|
||||
int nIdCount;
|
||||
int nIdCount GUARDED_BY(cs);
|
||||
|
||||
//! table with information about all nIds
|
||||
std::map<int, CAddrInfo> mapInfo;
|
||||
std::map<int, CAddrInfo> mapInfo GUARDED_BY(cs);
|
||||
|
||||
//! find an nId based on its network address
|
||||
std::map<CService, int> mapAddr;
|
||||
std::map<CService, int> mapAddr GUARDED_BY(cs);
|
||||
|
||||
//! randomly-ordered vector of all nIds
|
||||
std::vector<int> vRandom;
|
||||
std::vector<int> vRandom GUARDED_BY(cs);
|
||||
|
||||
// number of "tried" entries
|
||||
int nTried;
|
||||
int nTried GUARDED_BY(cs);
|
||||
|
||||
//! list of "tried" buckets
|
||||
int vvTried[ADDRMAN_TRIED_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE];
|
||||
int vvTried[ADDRMAN_TRIED_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
|
||||
|
||||
//! number of (unique) "new" entries
|
||||
int nNew;
|
||||
int nNew GUARDED_BY(cs);
|
||||
|
||||
//! list of "new" buckets
|
||||
int vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE];
|
||||
int vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
|
||||
|
||||
//! last time Good was called (memory only)
|
||||
int64_t nLastGood;
|
||||
int64_t nLastGood GUARDED_BY(cs);
|
||||
|
||||
// discriminate entries based on port. Should be false on mainnet/testnet and can be true on devnet/regtest
|
||||
bool discriminatePorts;
|
||||
@ -240,58 +240,58 @@ protected:
|
||||
FastRandomContext insecure_rand;
|
||||
|
||||
//! Find an entry.
|
||||
CAddrInfo* Find(const CService& addr, int *pnId = nullptr);
|
||||
CAddrInfo* Find(const CService& addr, int *pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! find an entry, creating it if necessary.
|
||||
//! nTime and nServices of the found node are updated, if necessary.
|
||||
CAddrInfo* Create(const CAddress &addr, const CNetAddr &addrSource, int *pnId = nullptr);
|
||||
CAddrInfo* Create(const CAddress &addr, const CNetAddr &addrSource, int *pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Swap two elements in vRandom.
|
||||
void SwapRandom(unsigned int nRandomPos1, unsigned int nRandomPos2);
|
||||
void SwapRandom(unsigned int nRandomPos1, unsigned int nRandomPos2) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Move an entry from the "new" table(s) to the "tried" table
|
||||
void MakeTried(CAddrInfo& info, int nId);
|
||||
void MakeTried(CAddrInfo& info, int nId) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Delete an entry. It must not be in tried, and have refcount 0.
|
||||
void Delete(int nId);
|
||||
void Delete(int nId) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Clear a position in a "new" table. This is the only place where entries are actually deleted.
|
||||
void ClearNew(int nUBucket, int nUBucketPos);
|
||||
void ClearNew(int nUBucket, int nUBucketPos) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Mark an entry "good", possibly moving it from "new" to "tried".
|
||||
void Good_(const CService &addr, bool test_before_evict, int64_t time);
|
||||
void Good_(const CService &addr, bool test_before_evict, int64_t time) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Add an entry to the "new" table.
|
||||
bool Add_(const CAddress &addr, const CNetAddr& source, int64_t nTimePenalty);
|
||||
bool Add_(const CAddress &addr, const CNetAddr& source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Mark an entry as attempted to connect.
|
||||
void Attempt_(const CService &addr, bool fCountFailure, int64_t nTime);
|
||||
void Attempt_(const CService &addr, bool fCountFailure, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Select an address to connect to, if newOnly is set to true, only the new table is selected from.
|
||||
CAddrInfo Select_(bool newOnly);
|
||||
CAddrInfo Select_(bool newOnly) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! See if any to-be-evicted tried table entries have been tested and if so resolve the collisions.
|
||||
void ResolveCollisions_();
|
||||
void ResolveCollisions_() EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Return a random to-be-evicted tried table address.
|
||||
CAddrInfo SelectTriedCollision_();
|
||||
CAddrInfo SelectTriedCollision_() EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Wraps GetRandInt to allow tests to override RandomInt and make it determinismistic.
|
||||
virtual int RandomInt(int nMax);
|
||||
|
||||
#ifdef DEBUG_ADDRMAN
|
||||
//! Perform consistency check. Returns an error code or zero.
|
||||
int Check_();
|
||||
int Check_() EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
#endif
|
||||
|
||||
//! Select several addresses at once.
|
||||
void GetAddr_(std::vector<CAddress> &vAddr);
|
||||
void GetAddr_(std::vector<CAddress> &vAddr) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Mark an entry as currently-connected-to.
|
||||
void Connected_(const CService &addr, int64_t nTime);
|
||||
void Connected_(const CService &addr, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Update an entry's service bits.
|
||||
void SetServices_(const CService &addr, ServiceFlags nServices);
|
||||
void SetServices_(const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Get address info for address
|
||||
CAddrInfo GetAddressInfo_(const CService& addr);
|
||||
|
@ -68,7 +68,7 @@ bool BaseIndex::Init()
|
||||
return true;
|
||||
}
|
||||
|
||||
static const CBlockIndex* NextSyncBlock(const CBlockIndex* pindex_prev)
|
||||
static const CBlockIndex* NextSyncBlock(const CBlockIndex* pindex_prev) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
|
||||
|
@ -120,7 +120,7 @@ static WalletTxStatus MakeWalletTxStatus(const CWalletTx& wtx) EXCLUSIVE_LOCKS_R
|
||||
}
|
||||
|
||||
//! Construct wallet TxOut struct.
|
||||
static WalletTxOut MakeWalletTxOut(CWallet& wallet, const CWalletTx& wtx, int n, int depth) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||
static WalletTxOut MakeWalletTxOut(CWallet& wallet, const CWalletTx& wtx, int n, int depth) EXCLUSIVE_LOCKS_REQUIRED(cs_main, wallet.cs_wallet)
|
||||
{
|
||||
WalletTxOut result;
|
||||
result.txout = wtx.tx->vout[n];
|
||||
|
@ -104,7 +104,11 @@ TransactionView::TransactionView(QWidget* parent) :
|
||||
amountWidget = new QLineEdit(this);
|
||||
amountWidget->setPlaceholderText(tr("Min amount"));
|
||||
amountWidget->setFixedWidth(125);
|
||||
amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
|
||||
QDoubleValidator *amountValidator = new QDoubleValidator(0, 1e20, 8, this);
|
||||
QLocale amountLocale(QLocale::C);
|
||||
amountLocale.setNumberOptions(QLocale::RejectGroupSeparator);
|
||||
amountValidator->setLocale(amountLocale);
|
||||
amountWidget->setValidator(amountValidator);
|
||||
amountWidget->setObjectName("amountWidget");
|
||||
hlayout->addWidget(amountWidget);
|
||||
|
||||
|
@ -47,16 +47,19 @@ public:
|
||||
|
||||
CAddrInfo* Find(const CService& addr, int* pnId = nullptr)
|
||||
{
|
||||
LOCK(cs);
|
||||
return CAddrMan::Find(addr, pnId);
|
||||
}
|
||||
|
||||
CAddrInfo* Create(const CAddress& addr, const CNetAddr& addrSource, int* pnId = nullptr)
|
||||
{
|
||||
LOCK(cs);
|
||||
return CAddrMan::Create(addr, addrSource, pnId);
|
||||
}
|
||||
|
||||
void Delete(int nId)
|
||||
{
|
||||
LOCK(cs);
|
||||
CAddrMan::Delete(nId);
|
||||
}
|
||||
|
||||
@ -78,6 +81,7 @@ public:
|
||||
// Simulates connection failure so that we can test eviction of offline nodes
|
||||
void SimConnFail(CService& addr)
|
||||
{
|
||||
LOCK(cs);
|
||||
int64_t nLastSuccess = 1;
|
||||
Good_(addr, true, nLastSuccess); // Set last good connection in the deep past.
|
||||
|
||||
|
@ -274,7 +274,7 @@ bool LoadGenesisBlock(const CChainParams& chainparams);
|
||||
* initializing state if we're running with -reindex. */
|
||||
bool LoadBlockIndex(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
/** Update the chain tip based on database information. */
|
||||
bool LoadChainTip(const CChainParams& chainparams);
|
||||
bool LoadChainTip(const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
/** Unload database information */
|
||||
void UnloadBlockIndex();
|
||||
/** Run instances of script checking worker threads */
|
||||
@ -450,7 +450,7 @@ inline CBlockIndex* LookupBlockIndex(const uint256& hash)
|
||||
}
|
||||
|
||||
/** Find the last common block between the parameter chain and a locator. */
|
||||
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator);
|
||||
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
/** Mark a block as precious and reorganize.
|
||||
*
|
||||
|
@ -1449,7 +1449,7 @@ struct tallyitem
|
||||
}
|
||||
};
|
||||
|
||||
static UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bool by_label) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||
static UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bool by_label) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pwallet->cs_wallet)
|
||||
{
|
||||
// Minimum confirmations
|
||||
int nMinDepth = 1;
|
||||
|
@ -17,6 +17,8 @@ BOOST_FIXTURE_TEST_SUITE(psbt_wallet_tests, WalletTestingSetup)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(psbt_updater_test)
|
||||
{
|
||||
LOCK(m_wallet.cs_wallet);
|
||||
|
||||
// Create prevtxs and add to wallet
|
||||
CDataStream s_prev_tx1(ParseHex("0200000000010158e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd7501000000171600145f275f436b09a8cc9a2eb2a2f528485c68a56323feffffff02d8231f1b0100000017a914aed962d6654f9a2b36608eb9d64d2b260db4f1118700c2eb0b0000000017a914b7f5faf40e3d40a5a459b1db3535f2b72fa921e88702483045022100a22edcc6e5bc511af4cc4ae0de0fcd75c7e04d8c1c3a8aa9d820ed4b967384ec02200642963597b9b1bc22c75e9f3e117284a962188bf5e8a74c895089046a20ad770121035509a48eb623e10aace8bfd0212fdb8a8e5af3c94b0b133b95e114cab89e4f7965000000"), SER_NETWORK, PROTOCOL_VERSION);
|
||||
CTransactionRef prev_tx1;
|
||||
|
@ -5196,7 +5196,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const WalletLocation& loc
|
||||
// Try to top up keypool. No-op if the wallet is locked.
|
||||
walletInstance->TopUpKeyPool();
|
||||
|
||||
LOCK(cs_main);
|
||||
LOCK2(cs_main, walletInstance->cs_wallet);
|
||||
|
||||
CBlockIndex *pindexRescan = chainActive.Genesis();
|
||||
if (!gArgs.GetBoolArg("-rescan", false))
|
||||
@ -5283,7 +5283,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const WalletLocation& loc
|
||||
walletInstance->SetBroadcastTransactions(gArgs.GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
|
||||
|
||||
{
|
||||
LOCK(walletInstance->cs_wallet);
|
||||
walletInstance->WalletLogPrintf("setExternalKeyPool.size() = %u\n", walletInstance->KeypoolCountExternalKeys());
|
||||
walletInstance->WalletLogPrintf("setInternalKeyPool.size() = %u\n", walletInstance->KeypoolCountInternalKeys());
|
||||
walletInstance->WalletLogPrintf("mapWallet.size() = %u\n", walletInstance->mapWallet.size());
|
||||
|
@ -483,7 +483,11 @@ public:
|
||||
CAmount GetDebit(const isminefilter& filter) const;
|
||||
CAmount GetCredit(const isminefilter& filter) const EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
CAmount GetImmatureCredit(bool fUseCache=true) const EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
CAmount GetAvailableCredit(bool fUseCache=true, const isminefilter& filter=ISMINE_SPENDABLE) const EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
// TODO: Remove "NO_THREAD_SAFETY_ANALYSIS" and replace it with the correct
|
||||
// annotation "EXCLUSIVE_LOCKS_REQUIRED(cs_main, pwallet->cs_wallet)". The
|
||||
// annotation "NO_THREAD_SAFETY_ANALYSIS" was temporarily added to avoid
|
||||
// having to resolve the issue of member access into incomplete type CWallet.
|
||||
CAmount GetAvailableCredit(bool fUseCache=true, const isminefilter& filter=ISMINE_SPENDABLE) const NO_THREAD_SAFETY_ANALYSIS;
|
||||
CAmount GetImmatureWatchOnlyCredit(const bool fUseCache=true) const EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
CAmount GetChange() const;
|
||||
|
||||
@ -518,7 +522,13 @@ public:
|
||||
/** Pass this transaction to the mempool. Fails if absolute fee exceeds absurd fee. */
|
||||
bool AcceptToMemoryPool(const CAmount& nAbsurdFee, CValidationState& state) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
std::set<uint256> GetConflicts() const;
|
||||
// TODO: Remove "NO_THREAD_SAFETY_ANALYSIS" and replace it with the correct
|
||||
// annotation "EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)". The annotation
|
||||
// "NO_THREAD_SAFETY_ANALYSIS" was temporarily added to avoid having to
|
||||
// resolve the issue of member access into incomplete type CWallet. Note
|
||||
// that we still have the runtime check "AssertLockHeld(pwallet->cs_wallet)"
|
||||
// in place.
|
||||
std::set<uint256> GetConflicts() const NO_THREAD_SAFETY_ANALYSIS;
|
||||
};
|
||||
|
||||
struct WalletTxHasher
|
||||
@ -715,13 +725,13 @@ private:
|
||||
std::atomic<double> m_scanning_progress{0};
|
||||
friend class WalletRescanReserver;
|
||||
|
||||
WalletBatch *encrypted_batch = nullptr;
|
||||
WalletBatch *encrypted_batch GUARDED_BY(cs_wallet) = nullptr;
|
||||
|
||||
//! the current wallet version: clients below this version are not able to load the wallet
|
||||
int nWalletVersion = FEATURE_BASE;
|
||||
|
||||
//! the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded
|
||||
int nWalletMaxVersion = FEATURE_BASE;
|
||||
int nWalletMaxVersion GUARDED_BY(cs_wallet) = FEATURE_BASE;
|
||||
|
||||
int64_t nNextResend = 0;
|
||||
int64_t nLastResend = 0;
|
||||
@ -738,9 +748,9 @@ private:
|
||||
* mutated transactions where the mutant gets mined).
|
||||
*/
|
||||
typedef std::multimap<COutPoint, uint256> TxSpends;
|
||||
TxSpends mapTxSpends;
|
||||
void AddToSpends(const COutPoint& outpoint, const uint256& wtxid);
|
||||
void AddToSpends(const uint256& wtxid);
|
||||
TxSpends mapTxSpends GUARDED_BY(cs_wallet);
|
||||
void AddToSpends(const COutPoint& outpoint, const uint256& wtxid) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
void AddToSpends(const uint256& wtxid) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
std::set<COutPoint> setWalletUTXO;
|
||||
mutable std::map<COutPoint, int> mapOutpointRoundsCache;
|
||||
@ -764,9 +774,9 @@ private:
|
||||
void MarkConflicted(const uint256& hashBlock, const uint256& hashTx);
|
||||
|
||||
/* Mark a transaction's inputs dirty, thus forcing the outputs to be recomputed */
|
||||
void MarkInputsDirty(const CTransactionRef& tx);
|
||||
void MarkInputsDirty(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>);
|
||||
void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
/* Used by TransactionAddedToMemorypool/BlockConnected/Disconnected/ScanForWalletTransactions.
|
||||
* Should be called with pindexBlock and posInBlock if this is for a transaction that is included in a block. */
|
||||
@ -776,12 +786,12 @@ private:
|
||||
void DeriveNewChildKey(WalletBatch &batch, const CKeyMetadata& metadata, CKey& secretRet, uint32_t nAccountIndex, bool fInternal /*= false*/) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
std::set<int64_t> setInternalKeyPool;
|
||||
std::set<int64_t> setExternalKeyPool;
|
||||
int64_t m_max_keypool_index = 0;
|
||||
std::set<int64_t> setExternalKeyPool GUARDED_BY(cs_wallet);
|
||||
int64_t m_max_keypool_index GUARDED_BY(cs_wallet) = 0;
|
||||
std::map<CKeyID, int64_t> m_pool_key_to_index;
|
||||
std::atomic<uint64_t> m_wallet_flags{0};
|
||||
|
||||
int64_t nTimeFirstKey = 0;
|
||||
int64_t nTimeFirstKey GUARDED_BY(cs_wallet) = 0;
|
||||
|
||||
/**
|
||||
* Private version of AddWatchOnly method which does not accept a
|
||||
@ -851,7 +861,7 @@ public:
|
||||
* if they are not ours
|
||||
*/
|
||||
bool SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAmount& nTargetValue, std::set<CInputCoin>& setCoinsRet, CAmount& nValueRet,
|
||||
const CCoinControl& coin_control, CoinSelectionParams& coin_selection_params, bool& bnb_used) const;
|
||||
const CCoinControl& coin_control, CoinSelectionParams& coin_selection_params, bool& bnb_used) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
const WalletLocation& GetLocation() const { return m_location; }
|
||||
|
||||
@ -862,10 +872,10 @@ public:
|
||||
void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
// Map from Key ID to key metadata.
|
||||
std::map<CKeyID, CKeyMetadata> mapKeyMetadata;
|
||||
std::map<CKeyID, CKeyMetadata> mapKeyMetadata GUARDED_BY(cs_wallet);
|
||||
|
||||
// Map from Script ID to key metadata (for watch-only keys).
|
||||
std::map<CScriptID, CKeyMetadata> m_script_metadata;
|
||||
std::map<CScriptID, CKeyMetadata> m_script_metadata GUARDED_BY(cs_wallet);
|
||||
|
||||
// Map from governance object hash to governance object, they are added by gobject_prepare.
|
||||
std::map<uint256, CGovernanceObject> m_gobjects;
|
||||
@ -885,19 +895,19 @@ public:
|
||||
encrypted_batch = nullptr;
|
||||
}
|
||||
|
||||
std::map<uint256, CWalletTx> mapWallet;
|
||||
std::map<uint256, CWalletTx> mapWallet GUARDED_BY(cs_wallet);
|
||||
std::list<CAccountingEntry> laccentries;
|
||||
|
||||
typedef std::pair<CWalletTx*, CAccountingEntry*> TxPair;
|
||||
typedef std::multimap<int64_t, TxPair > TxItems;
|
||||
TxItems wtxOrdered;
|
||||
|
||||
int64_t nOrderPosNext = 0;
|
||||
int64_t nOrderPosNext GUARDED_BY(cs_wallet) = 0;
|
||||
uint64_t nAccountingEntryNumber = 0;
|
||||
|
||||
std::map<CTxDestination, CAddressBookData> mapAddressBook;
|
||||
|
||||
std::set<COutPoint> setLockedCoins;
|
||||
std::set<COutPoint> setLockedCoins GUARDED_BY(cs_wallet);
|
||||
|
||||
int64_t nKeysLeftSinceAutoBackup;
|
||||
|
||||
@ -921,7 +931,7 @@ public:
|
||||
/**
|
||||
* Find non-change parent output.
|
||||
*/
|
||||
const CTxOut& FindNonChangeParentOutput(const CTransaction& tx, int output) const;
|
||||
const CTxOut& FindNonChangeParentOutput(const CTransaction& tx, int output) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
/**
|
||||
* Shuffle and select coins until nTargetValue is reached while avoiding
|
||||
@ -948,7 +958,7 @@ public:
|
||||
bool IsDenominated(const COutPoint& outpoint) const;
|
||||
bool IsFullyMixed(const COutPoint& outpoint) const;
|
||||
|
||||
bool IsSpent(const uint256& hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
bool IsSpent(const uint256& hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_main, cs_wallet);
|
||||
std::vector<OutputGroup> GroupOutputs(const std::vector<COutput>& outputs, bool single_coin) const;
|
||||
|
||||
bool IsLockedCoin(uint256 hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
@ -1041,7 +1051,7 @@ public:
|
||||
|
||||
void MarkDirty();
|
||||
bool AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose=true);
|
||||
void LoadToWallet(const CWalletTx& wtxIn);
|
||||
void LoadToWallet(const CWalletTx& wtxIn) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
void TransactionAddedToMempool(const CTransactionRef& tx, int64_t nAcceptTime) override;
|
||||
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex *pindex, const std::vector<CTransactionRef>& vtxConflicted) override;
|
||||
void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected) override;
|
||||
@ -1424,6 +1434,6 @@ public:
|
||||
// Use DummySignatureCreator, which inserts 71 byte signatures everywhere.
|
||||
// NOTE: this requires that all inputs must be in mapWallet (eg the tx should
|
||||
// be IsAllFromMe).
|
||||
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig = false);
|
||||
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig = false) EXCLUSIVE_LOCKS_REQUIRED(wallet->cs_wallet);
|
||||
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts, bool use_max_sig = false);
|
||||
#endif // BITCOIN_WALLET_WALLET_H
|
||||
|
@ -3,17 +3,18 @@ utilities in their entirety. It does not contain unit tests, which
|
||||
can be found in [/src/test](/src/test), [/src/wallet/test](/src/wallet/test),
|
||||
etc.
|
||||
|
||||
There are currently two sets of tests in this directory:
|
||||
This directory contains the following sets of tests:
|
||||
|
||||
- [functional](/test/functional) which test the functionality of
|
||||
dashd and dash-qt by interacting with them through the RPC and P2P
|
||||
interfaces.
|
||||
- [util](/test/util) which tests the dash utilities, currently only
|
||||
dash-tx.
|
||||
- [lint](/test/lint/) which perform various static analysis checks.
|
||||
|
||||
The util tests are run as part of `make check` target. The functional
|
||||
tests are run by the travis continuous build process whenever a pull
|
||||
request is opened. Both sets of tests can also be run locally.
|
||||
tests and lint scripts are run by the travis continuous build process whenever a pull
|
||||
request is opened. All sets of tests can also be run locally.
|
||||
|
||||
# Running tests locally
|
||||
|
||||
@ -36,7 +37,7 @@ The ZMQ functional test requires a python ZMQ library. To install it:
|
||||
|
||||
#### Running the tests
|
||||
|
||||
Individual tests can be run by directly calling the test script, eg:
|
||||
Individual tests can be run by directly calling the test script, e.g.:
|
||||
|
||||
```
|
||||
test/functional/wallet_hd.py
|
||||
@ -210,6 +211,26 @@ See this link for considerations: https://www.kernel.org/doc/Documentation/secur
|
||||
Util tests can be run locally by running `test/util/bitcoin-util-test.py`.
|
||||
Use the `-v` option for verbose output.
|
||||
|
||||
### Lint tests
|
||||
|
||||
#### Dependencies
|
||||
|
||||
The lint tests require codespell and flake8. To install: `pip3 install codespell flake8`.
|
||||
|
||||
#### Running the tests
|
||||
|
||||
Individual tests can be run by directly calling the test script, e.g.:
|
||||
|
||||
```
|
||||
test/lint/lint-filenames.sh
|
||||
```
|
||||
|
||||
You can run all the shell-based lint tests by running:
|
||||
|
||||
```
|
||||
test/lint/lint-all.sh
|
||||
```
|
||||
|
||||
# Writing functional tests
|
||||
|
||||
You are encouraged to write functional tests for new or existing features.
|
||||
|
@ -18,7 +18,7 @@ class TestBitcoinCli(BitcoinTestFramework):
|
||||
cli_response = self.nodes[0].cli("-version").send_cli()
|
||||
assert("Dash Core RPC client version" in cli_response)
|
||||
|
||||
self.log.info("Compare responses from gewalletinfo RPC and `dash-cli getwalletinfo`")
|
||||
self.log.info("Compare responses from getwalletinfo RPC and `dash-cli getwalletinfo`")
|
||||
cli_response = self.nodes[0].cli.getwalletinfo()
|
||||
rpc_response = self.nodes[0].getwalletinfo()
|
||||
assert_equal(cli_response, rpc_response)
|
||||
|
Loading…
Reference in New Issue
Block a user