mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge pull request #4396 from Munkybooty/backports-0.18-pr16
Backports 0.18 pr16
This commit is contained in:
commit
dfea329f69
@ -215,10 +215,11 @@ after_success:
|
||||
BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
|
||||
|
||||
- stage: test
|
||||
name: 'Win64 [GOAL: deploy] [no gui tests]'
|
||||
name: 'Win64 [GOAL: deploy] [no gui or functional tests]'
|
||||
env: >-
|
||||
HOST=x86_64-w64-mingw32
|
||||
PACKAGES="python3 nsis g++-mingw-w64-x86-64 wine-binfmt wine64"
|
||||
RUN_FUNCTIONAL_TESTS=false
|
||||
GOAL="deploy"
|
||||
BITCOIN_CONFIG="--enable-reduce-exports --disable-gui-tests"
|
||||
|
||||
|
@ -5,21 +5,45 @@
|
||||
# See "man systemd.service" for details.
|
||||
|
||||
# Note that almost all daemon options could be specified in
|
||||
# /etc/dash/dash.conf
|
||||
# /etc/dash/dash.conf, except for those explicitly specified as arguments
|
||||
# in ExecStart=
|
||||
|
||||
[Unit]
|
||||
Description=Dash daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/dashd -daemon -conf=/etc/dash/dash.conf -pid=/run/dashd/dashd.pid
|
||||
# Creates /run/dash owned by dashcore
|
||||
RuntimeDirectory=dashd
|
||||
User=dashcore
|
||||
ExecStart=/usr/bin/dashd -daemon \
|
||||
-pid=/run/dashd/dashd.pid \
|
||||
-conf=/etc/dash/dash.conf \
|
||||
-datadir=/var/lib/dashd
|
||||
|
||||
# Process management
|
||||
####################
|
||||
|
||||
Type=forking
|
||||
PIDFile=/run/dashd/dashd.pid
|
||||
Restart=on-failure
|
||||
|
||||
# Directory creation and permissions
|
||||
####################################
|
||||
|
||||
# Run as dash:dash
|
||||
User=dashcore
|
||||
Group=dashcore
|
||||
|
||||
# /run/dashd
|
||||
RuntimeDirectory=dashd
|
||||
RuntimeDirectoryMode=0710
|
||||
|
||||
# /etc/dash
|
||||
ConfigurationDirectory=dash
|
||||
ConfigurationDirectoryMode=0710
|
||||
|
||||
# /var/lib/dashd
|
||||
StateDirectory=dashd
|
||||
StateDirectoryMode=0710
|
||||
|
||||
# Hardening measures
|
||||
####################
|
||||
|
||||
|
@ -31,7 +31,8 @@ Supported API
|
||||
|
||||
Given a transaction hash: returns a transaction in binary, hex-encoded binary, or JSON formats.
|
||||
|
||||
For full TX query capability, one must enable the transaction index via "txindex=1" command line / configuration option.
|
||||
By default, this endpoint will only search the mempool.
|
||||
To query for a confirmed transaction, enable the transaction index via "txindex=1" command line / configuration option.
|
||||
|
||||
#### Blocks
|
||||
`GET /rest/block/<BLOCK-HASH>.<bin|hex|json>`
|
||||
|
18
doc/init.md
18
doc/init.md
@ -56,7 +56,7 @@ All three configurations assume several paths that might need to be adjusted.
|
||||
Binary: `/usr/bin/dashd`
|
||||
Configuration file: `/etc/dashcore/dash.conf`
|
||||
Data directory: `/var/lib/dashd`
|
||||
PID file: `/var/run/dashd/dashd.pid` (OpenRC and Upstart) or `/var/lib/dashd/dashd.pid` (systemd)
|
||||
PID file: `/var/run/dashd/dashd.pid` (OpenRC and Upstart) or `/run/dashd/dashd.pid` (systemd)
|
||||
Lock file: `/var/lock/subsys/dashd` (CentOS)
|
||||
|
||||
The configuration file, PID directory (if applicable) and data directory
|
||||
@ -65,6 +65,22 @@ reasons to make the configuration file and data directory only readable by the
|
||||
dashcore user and group. Access to dash-cli and other dashd rpc clients
|
||||
can then be controlled by group membership.
|
||||
|
||||
NOTE: When using the systemd .service file, the creation of the aforementioned
|
||||
directories and the setting of their permissions is automatically handled by
|
||||
systemd. Directories are given a permission of 710, giving the dashcore user and group
|
||||
access to files under it _if_ the files themselves give permission to the
|
||||
dashcore user and group to do so (e.g. when `-sysperms` is specified). This does not allow
|
||||
for the listing of files under the directory.
|
||||
|
||||
NOTE: It is not currently possible to override `datadir` in
|
||||
`/etc/dash/dash.conf` with the current systemd, OpenRC, and Upstart init
|
||||
files out-of-the-box. This is because the command line options specified in the
|
||||
init files take precedence over the configurations in
|
||||
`/etc/dash/dash.conf`. However, some init systems have their own
|
||||
configuration mechanisms that would allow for overriding the command line
|
||||
options specified in the init files (e.g. setting `BITCOIND_DATADIR` for
|
||||
OpenRC).
|
||||
|
||||
### macOS
|
||||
|
||||
Binary: `/usr/local/bin/dashd`
|
||||
|
17
doc/release-notes/release-notes-pr12255.md
Normal file
17
doc/release-notes/release-notes-pr12255.md
Normal file
@ -0,0 +1,17 @@
|
||||
systemd init file
|
||||
=========
|
||||
|
||||
The systemd init file (`contrib/init/dashd.service`) has been changed to use
|
||||
`/var/lib/dashd` as the data directory instead of `~dash/.dash`. This
|
||||
change makes Dash Core more consistent with other services, and makes the
|
||||
systemd init config more consistent with existing Upstart and OpenRC configs.
|
||||
|
||||
The configuration, PID, and data directories are now completely managed by
|
||||
systemd, which will take care of their creation, permissions, etc. See
|
||||
[`systemd.exec (5)`](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDirectory=)
|
||||
for more details.
|
||||
|
||||
When using the provided init files under `contrib/init`, overriding the
|
||||
`datadir` option in `/etc/dash/dash.conf` will have no effect. This is
|
||||
because the command line arguments specified in the init files take precedence
|
||||
over the options specified in `/etc/dash/dash.conf`.
|
16
src/init.cpp
16
src/init.cpp
@ -1490,6 +1490,22 @@ bool AppInitParameterInteraction()
|
||||
dustRelayFee = CFeeRate(n);
|
||||
}
|
||||
|
||||
// This is required by both the wallet and node
|
||||
if (gArgs.IsArgSet("-maxtxfee"))
|
||||
{
|
||||
CAmount nMaxFee = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee))
|
||||
return InitError(AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", "")));
|
||||
if (nMaxFee > HIGH_MAX_TX_FEE)
|
||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||
maxTxFee = nMaxFee;
|
||||
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
|
||||
{
|
||||
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
|
||||
gArgs.GetArg("-maxtxfee", ""), ::minRelayTxFee.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
|
||||
if (chainparams.RequireStandard() && !fRequireStandard)
|
||||
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));
|
||||
|
@ -264,6 +264,7 @@ public:
|
||||
}
|
||||
std::vector<std::string> getDestValues(const std::string& prefix) override
|
||||
{
|
||||
LOCK(m_wallet.cs_wallet);
|
||||
return m_wallet.GetDestValues(prefix);
|
||||
}
|
||||
void lockCoin(const COutPoint& output) override
|
||||
|
@ -263,8 +263,8 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, int heig
|
||||
clientmodel->cachedBestHeaderHeight = height;
|
||||
clientmodel->cachedBestHeaderTime = blockTime;
|
||||
}
|
||||
// if we are in-sync, update the UI regardless of last update time
|
||||
if (!initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
|
||||
// if we are in-sync or if we notify a header update, update the UI regardless of last update time
|
||||
if (fHeader || !initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
|
||||
//pass an async signal to the UI thread
|
||||
QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection,
|
||||
Q_ARG(int, height),
|
||||
|
@ -85,6 +85,7 @@ void ModalOverlay::setKnownBestHeight(int count, const QDateTime& blockDate)
|
||||
if (count > bestHeaderHeight) {
|
||||
bestHeaderHeight = count;
|
||||
bestHeaderDate = blockDate;
|
||||
UpdateHeaderSyncLabel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,11 +151,16 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
|
||||
if (estimateNumHeadersLeft < HEADER_HEIGHT_DELTA_SYNC && hasBestHeader) {
|
||||
ui->numberOfBlocksLeft->setText(QString::number(bestHeaderHeight - count));
|
||||
} else {
|
||||
ui->numberOfBlocksLeft->setText(tr("Unknown. Syncing Headers (%1)...").arg(bestHeaderHeight));
|
||||
UpdateHeaderSyncLabel();
|
||||
ui->expectedTimeLeft->setText(tr("Unknown..."));
|
||||
}
|
||||
}
|
||||
|
||||
void ModalOverlay::UpdateHeaderSyncLabel() {
|
||||
int est_headers_left = bestHeaderDate.secsTo(QDateTime::currentDateTime()) / Params().GetConsensus().nPowTargetSpacing;
|
||||
ui->numberOfBlocksLeft->setText(tr("Unknown. Syncing Headers (%1, %2%)...").arg(bestHeaderHeight).arg(QString::number(100.0 / (bestHeaderHeight + est_headers_left) * bestHeaderHeight, 'f', 1)));
|
||||
}
|
||||
|
||||
void ModalOverlay::toggleVisibility()
|
||||
{
|
||||
showHide(layerIsVisible, true);
|
||||
|
@ -47,6 +47,7 @@ private:
|
||||
bool layerIsVisible;
|
||||
bool userClosed;
|
||||
bool foreverHidden;
|
||||
void UpdateHeaderSyncLabel();
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_MODALOVERLAY_H
|
||||
|
@ -92,6 +92,7 @@ void TestAddAddressesToSendBook()
|
||||
}
|
||||
|
||||
auto check_addbook_size = [wallet](int expected_size) {
|
||||
LOCK(wallet->cs_wallet);
|
||||
QCOMPARE(static_cast<int>(wallet->mapAddressBook.size()), expected_size);
|
||||
};
|
||||
|
||||
|
@ -40,16 +40,6 @@
|
||||
#include <memory>
|
||||
#include <stdint.h>
|
||||
|
||||
unsigned int ParseConfirmTarget(const UniValue& value)
|
||||
{
|
||||
int target = value.get_int();
|
||||
unsigned int max_target = ::feeEstimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE);
|
||||
if (target < 1 || (unsigned int)target > max_target) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid conf_target, must be between %u - %u", 1, max_target));
|
||||
}
|
||||
return (unsigned int)target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return average network hashes per second based on the last 'lookup' blocks,
|
||||
* or from the last difficulty change if 'lookup' is nonpositive.
|
||||
|
@ -12,7 +12,4 @@
|
||||
/** Generate blocks (mine) */
|
||||
UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript);
|
||||
|
||||
/** Check bounds on a command line confirm target */
|
||||
unsigned int ParseConfirmTarget(const UniValue& value);
|
||||
|
||||
#endif
|
||||
|
@ -4,10 +4,12 @@
|
||||
|
||||
#include <key_io.h>
|
||||
#include <keystore.h>
|
||||
#include <policy/fees.h>
|
||||
#include <pubkey.h>
|
||||
#include <rpc/util.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <validation.h>
|
||||
|
||||
// Converts a hex string to a public key if possible
|
||||
CPubKey HexToPubKey(const std::string& hex_in)
|
||||
@ -92,6 +94,16 @@ UniValue DescribeAddress(const CTxDestination& dest)
|
||||
return boost::apply_visitor(DescribeAddressVisitor(), dest);
|
||||
}
|
||||
|
||||
unsigned int ParseConfirmTarget(const UniValue& value)
|
||||
{
|
||||
int target = value.get_int();
|
||||
unsigned int max_target = ::feeEstimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE);
|
||||
if (target < 1 || (unsigned int)target > max_target) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid conf_target, must be between %u - %u", 1, max_target));
|
||||
}
|
||||
return (unsigned int)target;
|
||||
}
|
||||
|
||||
std::string RPCHelpMan::ToString() const
|
||||
{
|
||||
std::string ret;
|
||||
|
@ -25,6 +25,9 @@ CScript CreateMultisigRedeemscript(const int required, const std::vector<CPubKey
|
||||
|
||||
UniValue DescribeAddress(const CTxDestination& dest);
|
||||
|
||||
//! Parse a confirm target option and raise an RPC error if it is invalid.
|
||||
unsigned int ParseConfirmTarget(const UniValue& value);
|
||||
|
||||
struct RPCArg {
|
||||
enum class Type {
|
||||
OBJ,
|
||||
|
@ -121,12 +121,6 @@ class CVectorWriter
|
||||
{
|
||||
return nType;
|
||||
}
|
||||
void seek(size_t nSize)
|
||||
{
|
||||
nPos += nSize;
|
||||
if(nPos > vchData.size())
|
||||
vchData.resize(nPos);
|
||||
}
|
||||
size_t size() const
|
||||
{
|
||||
return vchData.size() - nPos;
|
||||
@ -157,9 +151,11 @@ public:
|
||||
* @param[in] pos Starting position. Vector index where reads should start.
|
||||
*/
|
||||
VectorReader(int type, int version, const std::vector<unsigned char>& data, size_t pos)
|
||||
: m_type(type), m_version(version), m_data(data)
|
||||
: m_type(type), m_version(version), m_data(data), m_pos(pos)
|
||||
{
|
||||
seek(pos);
|
||||
if (m_pos > m_data.size()) {
|
||||
throw std::ios_base::failure("VectorReader(...): end of data (m_pos > m_data.size())");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -202,14 +198,6 @@ public:
|
||||
memcpy(dst, m_data.data() + m_pos, n);
|
||||
m_pos = pos_next;
|
||||
}
|
||||
|
||||
void seek(size_t n)
|
||||
{
|
||||
m_pos += n;
|
||||
if (m_pos > m_data.size()) {
|
||||
throw std::ios_base::failure("VectorReader::seek(): end of data");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** Double ended buffer combining vector and stream-like interfaces.
|
||||
|
@ -103,15 +103,15 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader)
|
||||
BOOST_CHECK_THROW(reader >> d, std::ios_base::failure);
|
||||
|
||||
// Read a 4 bytes as a signed int from the beginning of the buffer.
|
||||
reader.seek(-6);
|
||||
reader >> d;
|
||||
VectorReader new_reader(SER_NETWORK, INIT_PROTO_VERSION, vch, 0);
|
||||
new_reader >> d;
|
||||
BOOST_CHECK_EQUAL(d, 67370753); // 1,255,3,4 in little-endian base-256
|
||||
BOOST_CHECK_EQUAL(reader.size(), 2);
|
||||
BOOST_CHECK(!reader.empty());
|
||||
BOOST_CHECK_EQUAL(new_reader.size(), 2);
|
||||
BOOST_CHECK(!new_reader.empty());
|
||||
|
||||
// Reading after end of byte vector throws an error even if the reader is
|
||||
// not totally empty.
|
||||
BOOST_CHECK_THROW(reader >> d, std::ios_base::failure);
|
||||
BOOST_CHECK_THROW(new_reader >> d, std::ios_base::failure);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(streams_vector_reader_rvalue)
|
||||
|
@ -114,7 +114,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
|
||||
// should fail.
|
||||
// Capture this interaction with the upgraded_nop argument: set it when evaluating
|
||||
// any script flag that is implemented as an upgraded NOP code.
|
||||
static void ValidateCheckInputsForAllFlags(const CTransaction &tx, uint32_t failing_flags, bool add_to_cache)
|
||||
static void ValidateCheckInputsForAllFlags(const CTransaction &tx, uint32_t failing_flags, bool add_to_cache) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||
{
|
||||
PrecomputedTransactionData txdata(tx);
|
||||
// If we add many more flags, this loop can get too expensive, but we can
|
||||
|
@ -189,21 +189,6 @@ bool WalletInit::ParameterInteraction() const
|
||||
InitWarning(AmountHighWarn("-minrelaytxfee") + " " +
|
||||
_("The wallet will avoid paying less than the minimum relay fee."));
|
||||
|
||||
if (gArgs.IsArgSet("-maxtxfee"))
|
||||
{
|
||||
CAmount nMaxFee = 0;
|
||||
if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee))
|
||||
return InitError(AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", "")));
|
||||
if (nMaxFee > HIGH_MAX_TX_FEE)
|
||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||
maxTxFee = nMaxFee;
|
||||
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
|
||||
{
|
||||
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
|
||||
gArgs.GetArg("-maxtxfee", ""), ::minRelayTxFee.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (gArgs.IsArgSet("-walletbackupsdir")) {
|
||||
if (!fs::is_directory(gArgs.GetArg("-walletbackupsdir", ""))) {
|
||||
InitWarning(strprintf(_("Warning: incorrect parameter %s, path must exist! Using default path."), "-walletbackupsdir"));
|
||||
|
@ -1726,7 +1726,7 @@ static void MaybePushAddress(UniValue & entry, const CTxDestination &dest)
|
||||
* @param ret The UniValue into which the result is stored.
|
||||
* @param filter The "is mine" filter bool.
|
||||
*/
|
||||
static void ListTransactions(CWallet * const pwallet, const CWalletTx& wtx, const std::string& strAccount, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||
static void ListTransactions(CWallet* const pwallet, const CWalletTx& wtx, const std::string& strAccount, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pwallet->cs_wallet)
|
||||
{
|
||||
CAmount nFee;
|
||||
std::string strSentAccount;
|
||||
|
@ -4203,7 +4203,7 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const std::string& s
|
||||
{
|
||||
bool fUpdated = false;
|
||||
{
|
||||
LOCK(cs_wallet); // mapAddressBook
|
||||
LOCK(cs_wallet);
|
||||
std::map<CTxDestination, CAddressBookData>::iterator mi = mapAddressBook.find(address);
|
||||
fUpdated = mi != mapAddressBook.end();
|
||||
mapAddressBook[address].name = strName;
|
||||
@ -4220,7 +4220,7 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const std::string& s
|
||||
bool CWallet::DelAddressBook(const CTxDestination& address)
|
||||
{
|
||||
{
|
||||
LOCK(cs_wallet); // mapAddressBook
|
||||
LOCK(cs_wallet);
|
||||
|
||||
// Delete destdata tuples associated with address
|
||||
std::string strAddress = EncodeDestination(address);
|
||||
@ -4954,7 +4954,6 @@ bool CWallet::GetDestData(const CTxDestination &dest, const std::string &key, st
|
||||
|
||||
std::vector<std::string> CWallet::GetDestValues(const std::string& prefix) const
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
std::vector<std::string> values;
|
||||
for (const auto& address : mapAddressBook) {
|
||||
for (const auto& data : address.second.destdata) {
|
||||
|
@ -914,7 +914,7 @@ public:
|
||||
int64_t nOrderPosNext GUARDED_BY(cs_wallet) = 0;
|
||||
uint64_t nAccountingEntryNumber = 0;
|
||||
|
||||
std::map<CTxDestination, CAddressBookData> mapAddressBook;
|
||||
std::map<CTxDestination, CAddressBookData> mapAddressBook GUARDED_BY(cs_wallet);
|
||||
|
||||
std::set<COutPoint> setLockedCoins GUARDED_BY(cs_wallet);
|
||||
|
||||
@ -1022,15 +1022,15 @@ public:
|
||||
bool LoadCScript(const CScript& redeemScript);
|
||||
|
||||
//! Adds a destination data tuple to the store, and saves it to disk
|
||||
bool AddDestData(const CTxDestination &dest, const std::string &key, const std::string &value);
|
||||
bool AddDestData(const CTxDestination& dest, const std::string& key, const std::string& value) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
//! Erases a destination data tuple in the store and on disk
|
||||
bool EraseDestData(const CTxDestination &dest, const std::string &key);
|
||||
bool EraseDestData(const CTxDestination& dest, const std::string& key) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
//! Adds a destination data tuple to the store, without saving it to disk
|
||||
void LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value);
|
||||
void LoadDestData(const CTxDestination& dest, const std::string& key, const std::string& value) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
//! Look up a destination data tuple in the store, return true if found false otherwise
|
||||
bool GetDestData(const CTxDestination &dest, const std::string &key, std::string *value) const;
|
||||
bool GetDestData(const CTxDestination& dest, const std::string& key, std::string* value) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
//! Get all destination values matching a prefix.
|
||||
std::vector<std::string> GetDestValues(const std::string& prefix) const;
|
||||
std::vector<std::string> GetDestValues(const std::string& prefix) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
//! Adds a watch-only address to the store, and saves it to disk.
|
||||
bool AddWatchOnly(const CScript& dest, int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
@ -1194,7 +1194,7 @@ public:
|
||||
|
||||
bool DelAddressBook(const CTxDestination& address);
|
||||
|
||||
const std::string& GetLabelName(const CScript& scriptPubKey) const;
|
||||
const std::string& GetLabelName(const CScript& scriptPubKey) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
void GetScriptForMining(std::shared_ptr<CReserveScript> &script);
|
||||
|
||||
|
@ -43,6 +43,7 @@ don't have test cases for.
|
||||
- `mining` for tests for mining features, eg `mining_prioritisetransaction.py`
|
||||
- `p2p` for tests that explicitly test the p2p interface, eg `p2p_disconnect_ban.py`
|
||||
- `rpc` for tests for individual RPC methods or features, eg `rpc_listtransactions.py`
|
||||
- `tool` for tests for tools, eg `tool_wallet.py`
|
||||
- `wallet` for tests for wallet features, eg `wallet_keypool.py`
|
||||
- use an underscore to separate words
|
||||
- exception: for tests for specific RPCs or command line options which don't include underscores, name the test after the exact RPC or argument name, eg `rpc_decodescript.py`, not `rpc_decode_script.py`
|
||||
|
@ -41,8 +41,7 @@ class RESTTest (BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 2
|
||||
# TODO: remove -txindex. Currently required for getrawtransaction call.
|
||||
self.extra_args = [["-rest", "-txindex"], []]
|
||||
self.extra_args = [["-rest"], []]
|
||||
|
||||
def test_rest_request(self, uri, http_method='GET', req_type=ReqType.JSON, body='', status=200, ret_type=RetType.JSON):
|
||||
rest_uri = '/rest' + uri
|
||||
@ -86,15 +85,17 @@ class RESTTest (BitcoinTestFramework):
|
||||
|
||||
txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)
|
||||
self.sync_all()
|
||||
self.nodes[1].generatetoaddress(1, not_related_address)
|
||||
self.sync_all()
|
||||
bb_hash = self.nodes[0].getbestblockhash()
|
||||
|
||||
assert_equal(self.nodes[1].getbalance(), Decimal("0.1"))
|
||||
|
||||
self.log.info("Load the transaction using the /tx URI")
|
||||
self.log.info("Test the /tx URI")
|
||||
|
||||
json_obj = self.test_rest_request("/tx/{}".format(txid))
|
||||
assert_equal(json_obj['txid'], txid)
|
||||
|
||||
# Check hex format response
|
||||
hex_response = self.test_rest_request("/tx/{}".format(txid), req_type=ReqType.HEX, ret_type=RetType.OBJ)
|
||||
assert_greater_than_or_equal(int(hex_response.getheader('content-length')),
|
||||
json_obj['size']*2)
|
||||
|
||||
spent = (json_obj['vin'][0]['txid'], json_obj['vin'][0]['vout']) # get the vin to later check for utxo (should be spent by then)
|
||||
# get n of 0.1 outpoint
|
||||
n, = filter_output_indices_by_value(json_obj['vout'], Decimal('0.1'))
|
||||
@ -102,9 +103,14 @@ class RESTTest (BitcoinTestFramework):
|
||||
|
||||
self.log.info("Query an unspent TXO using the /getutxos URI")
|
||||
|
||||
json_obj = self.test_rest_request("/getutxos/{}-{}".format(*spending))
|
||||
self.nodes[1].generatetoaddress(1, not_related_address)
|
||||
self.sync_all()
|
||||
bb_hash = self.nodes[0].getbestblockhash()
|
||||
|
||||
assert_equal(self.nodes[1].getbalance(), Decimal("0.1"))
|
||||
|
||||
# Check chainTip response
|
||||
json_obj = self.test_rest_request("/getutxos/{}-{}".format(*spending))
|
||||
assert_equal(json_obj['chaintipHash'], bb_hash)
|
||||
|
||||
# Make sure there is one utxo
|
||||
@ -269,17 +275,6 @@ class RESTTest (BitcoinTestFramework):
|
||||
json_obj = self.test_rest_request("/headers/5/{}".format(bb_hash))
|
||||
assert_equal(len(json_obj), 5) # now we should have 5 header objects
|
||||
|
||||
self.log.info("Test the /tx URI")
|
||||
|
||||
tx_hash = block_json_obj['tx'][0]['txid']
|
||||
json_obj = self.test_rest_request("/tx/{}".format(tx_hash))
|
||||
assert_equal(json_obj['txid'], tx_hash)
|
||||
|
||||
# Check hex format response
|
||||
hex_response = self.test_rest_request("/tx/{}".format(tx_hash), req_type=ReqType.HEX, ret_type=RetType.OBJ)
|
||||
assert_greater_than_or_equal(int(hex_response.getheader('content-length')),
|
||||
json_obj['size']*2)
|
||||
|
||||
self.log.info("Test tx inclusion in the /mempool and /block URIs")
|
||||
|
||||
# Make 3 tx and mine them on node 1
|
||||
|
@ -99,11 +99,11 @@ class PSBTTest(BitcoinTestFramework):
|
||||
node1_addr = self.nodes[1].getnewaddress()
|
||||
node2_addr = self.nodes[2].getnewaddress()
|
||||
txid1 = self.nodes[0].sendtoaddress(node1_addr, 13)
|
||||
txid2 =self.nodes[0].sendtoaddress(node2_addr, 13)
|
||||
self.nodes[0].generate(6)
|
||||
txid2 = self.nodes[0].sendtoaddress(node2_addr, 13)
|
||||
blockhash = self.nodes[0].generate(6)[0]
|
||||
self.sync_all()
|
||||
vout1 = find_output(self.nodes[1], txid1, 13)
|
||||
vout2 = find_output(self.nodes[2], txid2, 13)
|
||||
vout1 = find_output(self.nodes[1], txid1, 13, blockhash=blockhash)
|
||||
vout2 = find_output(self.nodes[2], txid2, 13, blockhash=blockhash)
|
||||
|
||||
# Create a psbt spending outputs from nodes 1 and 2
|
||||
psbt_orig = self.nodes[0].createpsbt([{"txid":txid1, "vout":vout1}, {"txid":txid2, "vout":vout2}], {self.nodes[0].getnewaddress():25.999})
|
||||
|
@ -42,7 +42,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 3
|
||||
# TODO: remove -txindex. Currently required for getrawtransaction call.
|
||||
self.extra_args = [["-txindex"], ["-txindex"], ["-txindex"]]
|
||||
|
||||
def setup_network(self):
|
||||
|
@ -221,12 +221,15 @@ class TestNode():
|
||||
raise FailedToStartError(self._node_msg(
|
||||
'dashd exited with status {} during initialization'.format(self.process.returncode)))
|
||||
try:
|
||||
self.rpc = get_rpc_proxy(rpc_url(self.datadir, self.index, self.chain, self.rpchost), self.index, timeout=self.rpc_timeout, coveragedir=self.coverage_dir)
|
||||
self.rpc.getblockcount()
|
||||
rpc = get_rpc_proxy(rpc_url(self.datadir, self.index, self.chain, self.rpchost), self.index, timeout=self.rpc_timeout, coveragedir=self.coverage_dir)
|
||||
rpc.getblockcount()
|
||||
# If the call to getblockcount() succeeds then the RPC connection is up
|
||||
self.log.debug("RPC successfully started")
|
||||
if self.use_cli:
|
||||
return
|
||||
self.rpc = rpc
|
||||
self.rpc_connected = True
|
||||
self.url = self.rpc.url
|
||||
self.log.debug("RPC successfully started")
|
||||
return
|
||||
except IOError as e:
|
||||
if e.errno != errno.ECONNREFUSED: # Port not yet open?
|
||||
|
@ -505,12 +505,12 @@ def force_finish_mnsync(node):
|
||||
# Transaction/Block functions
|
||||
#############################
|
||||
|
||||
def find_output(node, txid, amount):
|
||||
def find_output(node, txid, amount, *, blockhash=None):
|
||||
"""
|
||||
Return index to output of txid with value amount
|
||||
Raises exception if there is none.
|
||||
"""
|
||||
txdata = node.getrawtransaction(txid, 1)
|
||||
txdata = node.getrawtransaction(txid, 1, blockhash)
|
||||
for i in range(len(txdata["vout"])):
|
||||
if txdata["vout"][i]["value"] == amount:
|
||||
return i
|
||||
|
@ -7,8 +7,6 @@
|
||||
This module calls down into individual test cases via subprocess. It will
|
||||
forward all unrecognized arguments onto the individual test scripts.
|
||||
|
||||
Functional tests are disabled on Windows by default. Use --force to run them anyway.
|
||||
|
||||
For a description of arguments recognized by test scripts, see
|
||||
`test/functional/test_framework/test_framework.py:BitcoinTestFramework.main`.
|
||||
|
||||
@ -236,7 +234,6 @@ def main():
|
||||
parser.add_argument('--ci', action='store_true', help='Run checks and code that are usually only enabled in a continuous integration environment')
|
||||
parser.add_argument('--exclude', '-x', help='specify a comma-separated-list of scripts to exclude.')
|
||||
parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
|
||||
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
|
||||
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
|
||||
parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
|
||||
parser.add_argument('--keepcache', '-k', action='store_true', help='the default behavior is to flush the cache directory on startup. --keepcache retains the cache from the previous testrun.')
|
||||
@ -271,12 +268,6 @@ def main():
|
||||
enable_utils = config["components"].getboolean("ENABLE_UTILS")
|
||||
enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
|
||||
|
||||
if config["environment"]["EXEEXT"] == ".exe" and not args.force:
|
||||
# https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9
|
||||
# https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-136646964
|
||||
print("Tests currently disabled on Windows by default. Use --force option to enable")
|
||||
sys.exit(0)
|
||||
|
||||
if not (enable_wallet and enable_utils and enable_bitcoind):
|
||||
print("No functional tests to run. Wallet, utils, and dashd must all be enabled")
|
||||
print("Rerun `configure` with -enable-wallet, -with-utils and -with-daemon and rerun make")
|
||||
|
@ -24,8 +24,7 @@ from test_framework.util import (
|
||||
class AbandonConflictTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
# TODO: remove -txindex. Currently required for getrawtransaction call.
|
||||
self.extra_args = [["-minrelaytxfee=0.00001", "-txindex"], []]
|
||||
self.extra_args = [["-minrelaytxfee=0.00001"], []]
|
||||
|
||||
def run_test(self):
|
||||
self.nodes[1].generate(100)
|
||||
|
@ -22,8 +22,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 4
|
||||
self.setup_clean_chain = True
|
||||
# TODO: remove -txindex. Currently required for getrawtransaction call.
|
||||
self.extra_args = [['-txindex', '-usehd={:d}'.format(i%2==0)] for i in range(4)]
|
||||
self.extra_args = [['-usehd={:d}'.format(i%2==0)] for i in range(4)]
|
||||
|
||||
def setup_network(self):
|
||||
self.add_nodes(4, self.extra_args)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2017 The Bitcoin Core developers
|
||||
# Copyright (c) 2017-2019 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
@ -12,11 +12,11 @@ export LC_ALL=C
|
||||
while getopts "?" opt; do
|
||||
case $opt in
|
||||
?)
|
||||
echo "Usage: .lint-whitespace.sh [N]"
|
||||
echo " COMMIT_RANGE='<commit range>' .lint-whitespace.sh"
|
||||
echo " .lint-whitespace.sh -?"
|
||||
echo "Usage: $0 [N]"
|
||||
echo " COMMIT_RANGE='<commit range>' $0"
|
||||
echo " $0 -?"
|
||||
echo "Checks unstaged changes, the previous N commits, or a commit range."
|
||||
echo "COMMIT_RANGE='47ba2c3...ee50c9e' .lint-whitespace.sh"
|
||||
echo "COMMIT_RANGE='47ba2c3...ee50c9e' $0"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
@ -28,7 +28,6 @@ unsigned-integer-overflow:policy/fees.cpp
|
||||
unsigned-integer-overflow:prevector.h
|
||||
unsigned-integer-overflow:script/interpreter.cpp
|
||||
unsigned-integer-overflow:stl_bvector.h
|
||||
unsigned-integer-overflow:streams.h
|
||||
unsigned-integer-overflow:txmempool.cpp
|
||||
unsigned-integer-overflow:util/strencodings.cpp
|
||||
unsigned-integer-overflow:validation.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user