Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ dist/

/guix-build-*

/ci/scratch/

# cppcheck cache-directory
test/lint/.cppcheck/*

Expand Down
20 changes: 9 additions & 11 deletions contrib/devtools/gen-manpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

# Verify that all the required binaries are usable, and extract copyright
# message in a first pass.
copyright = None
versions = []
for relpath in BINARIES:
abspath = os.path.join(builddir, relpath)
Expand All @@ -42,32 +41,31 @@
print(f'{abspath} not found or not an executable', file=sys.stderr)
sys.exit(1)
# take first line (which must contain version)
verstr = r.stdout.split('\n')[0]
verstr = r.stdout.splitlines()[0]
# last word of line is the actual version e.g. v22.99.0-5c6b3d5b3508
verstr = verstr.split()[-1]
assert verstr.startswith('v')
# remaining lines are copyright
copyright = r.stdout.split('\n')[1:]
assert copyright[0].startswith('Copyright (C)')

# Only dash-qt prints the copyright message on --version, so store it specifically.
if relpath == 'src/qt/dash-qt':
copyright = r.stdout.split('\n')[1:]
versions.append((abspath, verstr, copyright))

versions.append((abspath, verstr))

if any(verstr.endswith('-dirty') for (_, verstr) in versions):
if any(verstr.endswith('-dirty') for (_, verstr, _) in versions):
print("WARNING: Binaries were built from a dirty tree.")
print('man pages generated from dirty binaries should NOT be committed.')
print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.')
print()

with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer:
# Create copyright footer, and write it to a temporary include file.
assert copyright
# Copyright is the same for all binaries, so just use the first.
footer.write('[COPYRIGHT]\n')
footer.write('\n'.join(copyright).strip())
footer.write('\n'.join(versions[0][2]).strip())
footer.flush()

# Call the binaries through help2man to produce a manual page for each of them.
for (abspath, verstr) in versions:
for (abspath, verstr, _) in versions:
outname = os.path.join(mandir, os.path.basename(abspath) + '.1')
print(f'Generating {outname}…')
subprocess.run([help2man, '-N', '--version-string=' + verstr, '--include=' + footer.name, '-o', outname, abspath], check=True)
42 changes: 23 additions & 19 deletions doc/build-freebsd.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FreeBSD Build Guide

**Updated for FreeBSD [12.2](https://www.freebsd.org/releases/12.2R/announce.html)**
**Updated for FreeBSD [12.3](https://www.freebsd.org/releases/12.3R/announce/)**

This guide describes how to build dashd, command-line utilities, and GUI on FreeBSD.

Expand Down Expand Up @@ -30,22 +30,23 @@ git clone https://github.com/dashpay/dash.git
pkg install gmp
```

#### Wallet Dependencies
It is not necessary to build wallet functionality to run dashd or the GUI. To enable legacy wallets, you must install `db5`. To enable [descriptor wallets](https://github.com/dashpay/dash/blob/master/doc/descriptors.md), `sqlite3` is required. Skip `db5` if you intend to *exclusively* use descriptor wallets

###### Legacy Wallet Support
`db5` is required to enable support for legacy wallets. Skip if you don't intend to use legacy wallets

```bash
pkg install db5
```
It is not necessary to build wallet functionality to run either `dashd` or `dash-qt`.

###### Descriptor Wallet Support

`sqlite3` is required to enable support for descriptor wallets. Skip if you don't intend to use descriptor wallets.
`sqlite3` is required to support [descriptor wallets](descriptors.md).
Skip if you don't intend to use descriptor wallets.
``` bash
pkg install sqlite3
```

###### Legacy Wallet Support
`db5` is only required to support legacy wallets.
Skip if you don't intend to use legacy wallets.

```bash
pkg install db5
```
---

#### GUI Dependencies
Expand Down Expand Up @@ -85,8 +86,17 @@ pkg install python3 databases/py-sqlite3
### 1. Configuration

There are many ways to configure Dash Core, here are a few common examples:
##### Wallet (BDB + SQlite) Support, No GUI:
This explicitly enables legacy wallet support and disables the GUI. If `sqlite3` is installed, then descriptor wallet support will be built.

##### Descriptor Wallet and GUI:
This explicitly enables the GUI and disables legacy wallet support, assuming `sqlite` and `qt` are installed.
```bash
./autogen.sh
./configure --without-bdb --with-gui=yes MAKE=gmake
```

##### Descriptor & Legacy Wallet. No GUI:
This enables support for both wallet types and disables the GUI, assuming
`sqlite3` and `db5` are both installed.
```bash
./autogen.sh
./configure --with-gui=no --with-incompatible-bdb \
Expand All @@ -95,12 +105,6 @@ This explicitly enables legacy wallet support and disables the GUI. If `sqlite3`
MAKE=gmake
```

##### Wallet (only SQlite) and GUI Support:
This explicitly enables the GUI and disables legacy wallet support. If `qt5` is not installed, this will throw an error. If `sqlite3` is installed then descriptor wallet functionality will be built. If `sqlite3` is not installed, then wallet functionality will be disabled.
```bash
./autogen.sh
./configure --without-bdb --with-gui=yes MAKE=gmake
```
##### No Wallet or GUI
``` bash
./autogen.sh
Expand Down
39 changes: 25 additions & 14 deletions doc/build-netbsd.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,33 @@ git clone https://github.com/dashpay/dash.git

See [dependencies.md](dependencies.md) for a complete overview.

### Building BerkeleyDB
### Building Dash Core

**Important**: Use `gmake` (the non-GNU `make` will exit with an error).

#### With descriptor wallet:

The descriptor wallet uses `sqlite3`. You can install it using:
```bash
pkgin install sqlite3
```

```bash
./autogen.sh
./configure --with-gui=no --without-bdb \
CPPFLAGS="-I/usr/pkg/include" \
LDFLAGS="-L/usr/pkg/lib" \
BOOST_CPPFLAGS="-I/usr/pkg/include" \
MAKE=gmake
```

BerkeleyDB is only necessary for the wallet functionality. To skip this, pass
`--disable-wallet` to `./configure` and skip to the next section.
#### With legacy wallet:

BerkeleyDB is use for legacy wallet functionality.

It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
from ports, for the same reason as boost above (g++/libstd++ incompatibility).
If you have to build it yourself, you can use [the installation script included
in contrib/](/contrib/install_db4.sh) like so:
from ports.
You can use [the installation script included in contrib/](/contrib/install_db4.sh) like so:

```bash
./contrib/install_db4.sh `pwd`
Expand All @@ -50,30 +68,23 @@ from the root of the repository. Then set `BDB_PREFIX` for the next section:
export BDB_PREFIX="$PWD/db4"
```

### Building Dash Core

**Important**: Use `gmake` (the non-GNU `make` will exit with an error).

With wallet:
```bash
./autogen.sh
./configure --with-gui=no CPPFLAGS="-I/usr/pkg/include" \
LDFLAGS="-L/usr/pkg/lib" \
BOOST_CPPFLAGS="-I/usr/pkg/include" \
BOOST_LDFLAGS="-L/usr/pkg/lib" \
BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \
BDB_CFLAGS="-I${BDB_PREFIX}/include" \
MAKE=gmake
```

Without wallet:
#### Without wallet:
```bash
./autogen.sh
./configure --with-gui=no --disable-wallet \
CPPFLAGS="-I/usr/pkg/include" \
LDFLAGS="-L/usr/pkg/lib" \
BOOST_CPPFLAGS="-I/usr/pkg/include" \
BOOST_LDFLAGS="-L/usr/pkg/lib" \
MAKE=gmake
```

Expand Down
8 changes: 4 additions & 4 deletions doc/build-unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,16 @@ from the root of the repository.

Otherwise, you can build Dash Core from self-compiled [depends](/depends/README.md).

**Note**: You only need Berkeley DB if the wallet is enabled (see [*Disable-wallet mode*](#disable-wallet-mode)).
**Note**: You only need Berkeley DB if the legacy wallet is enabled (see [*Disable-wallet mode*](#disable-wallet-mode)).

Disable-wallet mode
--------------------
When the intention is to run only a P2P node without a wallet, Dash Core may be compiled in
disable-wallet mode with:
When the intention is to only run a P2P node, without a wallet, Dash Core can
be compiled in disable-wallet mode with:

./configure --disable-wallet

In this case there is no dependency on Berkeley DB 4.8 and SQLite.
In this case there is no dependency on SQLite or Berkeley DB.

Mining is also possible in disable-wallet mode using the `getblocktemplate` RPC call.

Expand Down
29 changes: 15 additions & 14 deletions src/Makefile.bench.include
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,47 @@ GENERATED_BENCH_FILES = $(RAW_BENCH_FILES:.raw=.raw.h)
bench_bench_dash_SOURCES = \
$(RAW_BENCH_FILES) \
bench/addrman.cpp \
bench/bench_bitcoin.cpp \
bench/base58.cpp \
bench/bech32.cpp \
bench/bench.cpp \
bench/bench.h \
bench/bench_bitcoin.cpp \
bench/bip324_ecdh.cpp \
bench/block_assemble.cpp \
bench/bls.cpp \
bench/bls_dkg.cpp \
bench/ccoins_caching.cpp \
bench/chacha20.cpp \
bench/checkblock.cpp \
bench/checkqueue.cpp \
bench/data.h \
bench/crypto_hash.cpp \
bench/data.cpp \
bench/data.h \
bench/duplicate_inputs.cpp \
bench/ecdsa.cpp \
bench/ellswift.cpp \
bench/examples.cpp \
bench/rollingbloom.cpp \
bench/chacha20.cpp \
bench/crypto_hash.cpp \
bench/ccoins_caching.cpp \
bench/gcs_filter.cpp \
bench/hashpadding.cpp \
bench/logging.cpp \
bench/load_external.cpp \
bench/merkle_root.cpp \
bench/lockedpool.cpp \
bench/mempool_eviction.cpp \
bench/mempool_stress.cpp \
bench/nanobench.h \
bench/merkle_root.cpp \
bench/nanobench.cpp \
bench/nanobench.h \
bench/peer_eviction.cpp \
bench/poly1305.cpp \
bench/pool.cpp \
bench/pow_hash.cpp \
bench/prevector.cpp \
bench/rollingbloom.cpp \
bench/rpc_blockchain.cpp \
bench/rpc_mempool.cpp \
bench/strencodings.cpp \
bench/util_time.cpp \
bench/base58.cpp \
bench/bech32.cpp \
bench/lockedpool.cpp \
bench/poly1305.cpp \
bench/prevector.cpp \
bench/string_cast.cpp \
bench/util_time.cpp \
bench/verify_script.cpp

nodist_bench_bench_dash_SOURCES = $(GENERATED_BENCH_FILES)
Expand Down
48 changes: 48 additions & 0 deletions src/bench/logging.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) 2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <bench/bench.h>
#include <logging.h>
#include <test/util/setup_common.h>


static void Logging(benchmark::Bench& bench, const std::vector<const char*>& extra_args, const std::function<void()>& log)
{
TestingSetup test_setup{
CBaseChainParams::REGTEST,
extra_args,
};

bench.run([&] { log(); });
}

static void LoggingYoThreadNames(benchmark::Bench& bench)
{
Logging(bench, {"-logthreadnames=1"}, [] { LogPrintf("%s\n", "test"); });
}
static void LoggingNoThreadNames(benchmark::Bench& bench)
{
Logging(bench, {"-logthreadnames=0"}, [] { LogPrintf("%s\n", "test"); });
}
static void LoggingYoCategory(benchmark::Bench& bench)
{
Logging(bench, {"-logthreadnames=0", "-debug=net"}, [] { LogPrint(BCLog::NET, "%s\n", "test"); });
}
static void LoggingNoCategory(benchmark::Bench& bench)
{
Logging(bench, {"-logthreadnames=0", "-debug=0"}, [] { LogPrint(BCLog::NET, "%s\n", "test"); });
}
static void LoggingNoFile(benchmark::Bench& bench)
{
Logging(bench, {"-nodebuglogfile", "-debug=1"}, [] {
LogPrintf("%s\n", "test");
LogPrint(BCLog::NET, "%s\n", "test");
});
}

BENCHMARK(LoggingYoThreadNames);
BENCHMARK(LoggingNoThreadNames);
BENCHMARK(LoggingYoCategory);
BENCHMARK(LoggingNoCategory);
BENCHMARK(LoggingNoFile);
12 changes: 10 additions & 2 deletions src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ static void SetupCliArgs(ArgsManager& argsman)
argsman.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-conf=<file>", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-datadir=<dir>", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-generate", strprintf("Generate blocks immediately, equivalent to RPC getnewaddress followed by RPC generatetoaddress. Optional positional integer arguments are number of blocks to generate (default: %s) and maximum iterations to try (default: %s), equivalent to RPC generatetoaddress nblocks and maxtries arguments. Example: dash-cli -generate 4 1000", DEFAULT_NBLOCKS, DEFAULT_MAX_TRIES), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-generate",
strprintf("Generate blocks, equivalent to RPC getnewaddress followed by RPC generatetoaddress. Optional positional integer "
"arguments are number of blocks to generate (default: %s) and maximum iterations to try (default: %s), equivalent to "
"RPC generatetoaddress nblocks and maxtries arguments. Example: dash-cli -generate 4 1000",
DEFAULT_NBLOCKS, DEFAULT_MAX_TRIES),
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-addrinfo", "Get the number of addresses known to the node, per network and total, after filtering for quality and recency. The total number of addresses known to the node may be higher.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-getinfo", "Get general information from the remote server. Note that unlike server-side RPC calls, the output of -getinfo is the result of multiple non-atomic requests. Some entries in the output may represent results from different states (e.g. wallet balance may be as of a different block from the chain state reported)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-netinfo", "Get network peer connection information from the remote server. An optional integer argument from 0 to 4 can be passed for different peers listings (default: 0). Pass \"help\" for detailed help documentation.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
Expand Down Expand Up @@ -153,7 +158,10 @@ static int AppInitRPC(int argc, char* argv[])

if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
std::string strUsage = PACKAGE_NAME " RPC client version " + FormatFullVersion() + "\n";
if (!gArgs.IsArgSet("-version")) {

if (gArgs.IsArgSet("-version")) {
strUsage += FormatParagraph(LicenseInfo());
} else {
strUsage += "\n"
"Usage: dash-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n"
"or: dash-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n"
Expand Down
5 changes: 4 additions & 1 deletion src/bitcoin-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ static int AppInitRawTx(int argc, char* argv[])
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
// First part of help message is specific to this utility
std::string strUsage = PACKAGE_NAME " dash-tx utility version " + FormatFullVersion() + "\n";
if (!gArgs.IsArgSet("-version")) {

if (gArgs.IsArgSet("-version")) {
strUsage += FormatParagraph(LicenseInfo());
} else {
strUsage += "\n"
"Usage: dash-tx [options] <hex-tx> [commands] Update hex-encoded dash transaction\n"
"or: dash-tx [options] -create [commands] Create hex-encoded dash transaction\n"
Expand Down
5 changes: 4 additions & 1 deletion src/bitcoin-wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ static bool WalletAppInit(ArgsManager& args, int argc, char* argv[])
}
if (argc < 2 || HelpRequested(args) || args.IsArgSet("-version")) {
std::string strUsage = strprintf("%s dash-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n";
if (!args.IsArgSet("-version")) {

if (args.IsArgSet("-version")) {
strUsage += FormatParagraph(LicenseInfo());
} else {
strUsage += "\n"
"dash-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n"
"By default dash-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n"
Expand Down
Loading
Loading