Skip to content

Commit be20db0

Browse files
9ade0c1 Merge bitcoin#23139: rpc: fix "trusted" field in TransactionDescriptionString(), add coverage (W. J. van der Laan) a2e6b6d Merge bitcoin#25615: rpc: add missing description in gettxout help text (MacroFake) 4c6bc3e Merge bitcoin#25472: build: Increase MS Visual Studio minimum version (fanquake) cbcd3f9 Merge bitcoin#25592: test persistence of non-mempool tx prioritisation (MacroFake) b52fabb fixup: follow-up for bitcoin#12755 - no more expected_stderr is needed for stop_nodes() (Konstantin Akimov) 8360d20 Merge bitcoin#25565: doc: improve developer-notes about threads (MacroFake) cf1b7c9 Merge bitcoin#25581: test: refactor: pass absolute fee in `create_lots_of_big_transactions` helper (MacroFake) eb3cae6 Merge bitcoin#25549: doc: update for NetBSD 9.2, add GUI Build Instructions (MacroFake) 97e8765 Merge bitcoin#25511: test: non-positive integer value to `-peertimeout` should throw an error (MacroFake) 57be110 Merge bitcoin#25070: contrib: fix dirname on `verify-commits` (fanquake) 0406472 Merge bitcoin#24993: test, contrib, refactor: use `with` when opening a file (laanwj) Pull request description: ## What was done? Regular backports from Bitcoin Core v24 ## How Has This Been Tested? Run unit & functional tests ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK 9ade0c1 Tree-SHA512: 4e9755ac6bca34f6f02fc7161d80df38b85fa95c9dee61b70a937ea239f6541f6c960aed4f153ed09889a9b2c0c2947da326558561839acea49a38d399b7bc31
2 parents 7c72638 + 9ade0c1 commit be20db0

19 files changed

+307
-239
lines changed

contrib/devtools/copyright_header.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,13 @@ def get_most_recent_git_change_year(filename):
330330
################################################################################
331331

332332
def read_file_lines(filename):
333-
f = open(filename, 'r', encoding="utf8")
334-
file_lines = f.readlines()
335-
f.close()
333+
with open(filename, 'r', encoding="utf8") as f:
334+
file_lines = f.readlines()
336335
return file_lines
337336

338337
def write_file_lines(filename, file_lines):
339-
f = open(filename, 'w', encoding="utf8")
340-
f.write(''.join(file_lines))
341-
f.close()
338+
with open(filename, 'w', encoding="utf8") as f:
339+
f.write(''.join(file_lines))
342340

343341
################################################################################
344342
# update header years execution

contrib/linearize/linearize-data.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ def get_blk_dt(blk_hdr):
3434
# When getting the list of block hashes, undo any byte reversals.
3535
def get_block_hashes(settings):
3636
blkindex = []
37-
f = open(settings['hashlist'], "r", encoding="utf8")
38-
for line in f:
39-
line = line.rstrip()
40-
if settings['rev_hash_bytes'] == 'true':
41-
line = bytes.fromhex(line)[::-1].hex()
42-
blkindex.append(line)
37+
with open(settings['hashlist'], "r", encoding="utf8") as f:
38+
for line in f:
39+
line = line.rstrip()
40+
if settings['rev_hash_bytes'] == 'true':
41+
line = bytes.fromhex(line)[::-1].hex()
42+
blkindex.append(line)
4343

4444
print("Read " + str(len(blkindex)) + " hashes")
4545

@@ -249,19 +249,18 @@ def run(self):
249249
print("Usage: linearize-data.py CONFIG-FILE")
250250
sys.exit(1)
251251

252-
f = open(sys.argv[1], encoding="utf8")
253-
for line in f:
254-
# skip comment lines
255-
m = re.search(r'^\s*#', line)
256-
if m:
257-
continue
258-
259-
# parse key=value lines
260-
m = re.search(r'^(\w+)\s*=\s*(\S.*)$', line)
261-
if m is None:
262-
continue
263-
settings[m.group(1)] = m.group(2)
264-
f.close()
252+
with open(sys.argv[1], encoding="utf8") as f:
253+
for line in f:
254+
# skip comment lines
255+
m = re.search(r'^\s*#', line)
256+
if m:
257+
continue
258+
259+
# parse key=value lines
260+
m = re.search(r'^(\w+)\s*=\s*(\S.*)$', line)
261+
if m is None:
262+
continue
263+
settings[m.group(1)] = m.group(2)
265264

266265
# Force hash byte format setting to be lowercase to make comparisons easier.
267266
# Also place upfront in case any settings need to know about it.

contrib/linearize/linearize-hashes.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,18 @@ def get_rpc_cookie():
9898
print("Usage: linearize-hashes.py CONFIG-FILE")
9999
sys.exit(1)
100100

101-
f = open(sys.argv[1], encoding="utf8")
102-
for line in f:
103-
# skip comment lines
104-
m = re.search(r'^\s*#', line)
105-
if m:
106-
continue
107-
108-
# parse key=value lines
109-
m = re.search(r'^(\w+)\s*=\s*(\S.*)$', line)
110-
if m is None:
111-
continue
112-
settings[m.group(1)] = m.group(2)
113-
f.close()
101+
with open(sys.argv[1], encoding="utf8") as f:
102+
for line in f:
103+
# skip comment lines
104+
m = re.search(r'^\s*#', line)
105+
if m:
106+
continue
107+
108+
# parse key=value lines
109+
m = re.search(r'^(\w+)\s*=\s*(\S.*)$', line)
110+
if m is None:
111+
continue
112+
settings[m.group(1)] = m.group(2)
114113

115114
if 'host' not in settings:
116115
settings['host'] = '127.0.0.1'

contrib/verify-commits/verify-commits.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,16 @@ def main():
8282
# get directory of this program and read data files
8383
dirname = os.path.dirname(os.path.abspath(__file__))
8484
print("Using verify-commits data from " + dirname)
85-
verified_root = open(dirname + "/trusted-git-root", "r", encoding="utf8").read().splitlines()[0]
86-
verified_sha512_root = open(dirname + "/trusted-sha512-root-commit", "r", encoding="utf8").read().splitlines()[0]
87-
revsig_allowed = open(dirname + "/allow-revsig-commits", "r", encoding="utf-8").read().splitlines()
88-
unclean_merge_allowed = open(dirname + "/allow-unclean-merge-commits", "r", encoding="utf-8").read().splitlines()
89-
incorrect_sha512_allowed = open(dirname + "/allow-incorrect-sha512-commits", "r", encoding="utf-8").read().splitlines()
85+
with open(dirname + "/trusted-git-root", "r", encoding="utf8") as f:
86+
verified_root = f.read().splitlines()[0]
87+
with open(dirname + "/trusted-sha512-root-commit", "r", encoding="utf8") as f:
88+
verified_sha512_root = f.read().splitlines()[0]
89+
with open(dirname + "/allow-revsig-commits", "r", encoding="utf8") as f:
90+
revsig_allowed = f.read().splitlines()
91+
with open(dirname + "/allow-unclean-merge-commits", "r", encoding="utf8") as f:
92+
unclean_merge_allowed = f.read().splitlines()
93+
with open(dirname + "/allow-incorrect-sha512-commits", "r", encoding="utf8") as f:
94+
incorrect_sha512_allowed = f.read().splitlines()
9095

9196
# Set commit and branch and set variables
9297
current_commit = args.commit

doc/build-netbsd.md

Lines changed: 73 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,118 @@
1-
NetBSD Build Guide
2-
======================
3-
**Updated for NetBSD [8.0](https://www.netbsd.org/releases/formal-8/NetBSD-8.0.html)**
1+
# NetBSD Build Guide
42

5-
This guide describes how to build dashd and command-line utilities on NetBSD.
3+
Updated for NetBSD [9.2](https://netbsd.org/releases/formal-9/NetBSD-9.2.html).
64

7-
This guide does not contain instructions for building the GUI.
5+
This guide describes how to build dashd, command-line utilities, and GUI on NetBSD.
86

97
**This guide has not been tested for building Dash Core and is expected to fail due to missing `bls_dash` and `backtrace`. Please report your results; contributions welcome.**
108

11-
Preparation
12-
-------------
9+
## Preparation
1310

14-
You will need the following modules, which can be installed via pkgsrc or pkgin:
11+
### 1. Install Required Dependencies
12+
13+
Install the required dependencies the usual way you [install software on NetBSD](https://www.netbsd.org/docs/guide/en/chap-boot.html#chap-boot-pkgsrc).
14+
The example commands below use `pkgin`.
15+
16+
```bash
17+
pkgin install autoconf automake libtool pkg-config git gmake boost libevent gmp
1518

1619
```
17-
autoconf
18-
automake
19-
boost
20-
git
21-
gmake
22-
gmp
23-
libevent
24-
libtool
25-
pkg-config
26-
python37
2720

28-
git clone https://github.com/dashpay/dash.git
21+
NetBSD currently ships with an older version of `gcc` than is needed to build. You should upgrade your `gcc` and then pass this new version to the configure script.
22+
23+
For example, grab `gcc9`:
24+
```
25+
pkgin install gcc9
26+
```
27+
28+
Then, when configuring, pass the following:
29+
```bash
30+
./configure
31+
...
32+
CC="/usr/pkg/gcc9/bin/gcc" \
33+
CXX="/usr/pkg/gcc9/bin/g++" \
34+
...
2935
```
3036

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

33-
### Building Dash Core
39+
### 2. Clone Dash Core Repo
3440

35-
**Important**: Use `gmake` (the non-GNU `make` will exit with an error).
41+
Clone the Dash Core repository to a directory. All build scripts and commands will run from this directory.
3642

37-
#### With descriptor wallet:
43+
```bash
44+
git clone https://github.com/dashpay/dash.git
45+
```
46+
47+
### 3. Install Optional Dependencies
48+
49+
#### Wallet Dependencies
50+
51+
It is not necessary to build wallet functionality to run dashd or the GUI.
52+
53+
###### Descriptor Wallet Support
54+
55+
`sqlite3` is required to enable support for [descriptor wallets](https://github.com/dashpay/dash/blob/master/doc/descriptors.md).
3856

39-
The descriptor wallet uses `sqlite3`. You can install it using:
4057
```bash
4158
pkgin install sqlite3
4259
```
4360

61+
###### Legacy Wallet Support
62+
63+
`db4` is required to enable support for legacy wallets.
64+
4465
```bash
45-
./autogen.sh
46-
./configure --with-gui=no --without-bdb \
47-
CPPFLAGS="-I/usr/pkg/include" \
48-
LDFLAGS="-L/usr/pkg/lib" \
49-
BOOST_CPPFLAGS="-I/usr/pkg/include" \
50-
MAKE=gmake
66+
pkgin install db4
5167
```
5268

53-
#### With legacy wallet:
54-
55-
BerkeleyDB is use for legacy wallet functionality.
69+
#### GUI Dependencies
5670

57-
It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
58-
from ports.
59-
You can use [the installation script included in contrib/](/contrib/install_db4.sh) like so:
71+
Dash Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install `qt5`.
6072

6173
```bash
62-
./contrib/install_db4.sh `pwd`
74+
pkgin install qt5
6375
```
6476

65-
from the root of the repository. Then set `BDB_PREFIX` for the next section:
77+
The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `qrencode`.
6678

6779
```bash
68-
export BDB_PREFIX="$PWD/db4"
80+
pkgin install qrencode
6981
```
7082

83+
#### Test Suite Dependencies
84+
85+
There is an included test suite that is useful for testing code changes when developing.
86+
To run the test suite (recommended), you will need to have Python 3 installed:
87+
7188
```bash
72-
./autogen.sh
73-
./configure --with-gui=no CPPFLAGS="-I/usr/pkg/include" \
74-
LDFLAGS="-L/usr/pkg/lib" \
75-
BOOST_CPPFLAGS="-I/usr/pkg/include" \
76-
BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \
77-
BDB_CFLAGS="-I${BDB_PREFIX}/include" \
78-
MAKE=gmake
89+
pkgin install python37
7990
```
8091

81-
#### Without wallet:
92+
### Building Dash Core
93+
94+
**Note**: Use `gmake` (the non-GNU `make` will exit with an error).
95+
96+
97+
### 1. Configuration
98+
99+
There are many ways to configure Dash Core. Here is an example that
100+
explicitly disables the wallet and GUI:
101+
82102
```bash
83103
./autogen.sh
84-
./configure --with-gui=no --disable-wallet \
104+
./configure --without-wallet --with-gui=no \
85105
CPPFLAGS="-I/usr/pkg/include" \
86-
LDFLAGS="-L/usr/pkg/lib" \
87-
BOOST_CPPFLAGS="-I/usr/pkg/include" \
88106
MAKE=gmake
89107
```
90108

109+
For a full list of configuration options, see the output of `./configure --help`
110+
111+
### 2. Compile
112+
91113
Build and run the tests:
114+
92115
```bash
93116
gmake # use "-j N" here for N parallel jobs
94-
gmake check
117+
gmake check # Run tests if Python 3 is available
95118
```

doc/developer-notes.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,10 @@ Threads
612612
: Started from `main()` in `bitcoind.cpp`. Responsible for starting up and
613613
shutting down the application.
614614

615-
- [ThreadImport (`d-loadblk`)](https://doxygen.bitcoincore.org/init_8cpp.html#ae9e290a0e829ec0198518de2eda579d1)
615+
- [ThreadImport (`d-loadblk`)](https://doxygen.bitcoincore.org/namespacenode.html#ab4305679079866f0f420f7dbf278381d)
616616
: Loads blocks from `blk*.dat` files or `-loadblock=<file>` on startup.
617617

618-
- [ThreadScriptCheck (`d-scriptch.x`)](https://doxygen.bitcoincore.org/validation_8cpp.html#a925a33e7952a157922b0bbb8dab29a20)
618+
- [CCheckQueue::Loop (`d-scriptch.x`)](https://doxygen.bitcoincore.org/class_c_check_queue.html#a6e7fa51d3a25e7cb65446d4b50e6a987)
619619
: Parallel script validation threads for transactions in blocks.
620620

621621
- [ThreadHTTP (`d-http`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#abb9f6ea8819672bd9a62d3695070709c)
@@ -631,7 +631,7 @@ Threads
631631
: Does asynchronous background tasks like dumping wallet contents, dumping
632632
addrman and running asynchronous validationinterface callbacks.
633633

634-
- [TorControlThread (`d-torcontrol`)](https://doxygen.bitcoincore.org/torcontrol_8cpp.html#a4faed3692d57a0d7bdbecf3b37f72de0)
634+
- [TorControlThread (`d-torcontrol`)](https://doxygen.bitcoincore.org/torcontrol_8cpp.html#a52a3efff23634500bb42c6474f306091)
635635
: Libevent thread for tor connections.
636636

637637
- Net threads:
@@ -643,7 +643,7 @@ Threads
643643
- [ThreadDNSAddressSeed (`d-dnsseed`)](https://doxygen.bitcoincore.org/class_c_connman.html#aa7c6970ed98a4a7bafbc071d24897d13)
644644
: Loads addresses of peers from the DNS.
645645

646-
- [ThreadMapPort (`d-upnp`)](https://doxygen.bitcoincore.org/net_8cpp.html#a63f82a71c4169290c2db1651a9bbe249)
646+
- ThreadMapPort (`d-mapport`)
647647
: Universal plug-and-play startup/shutdown.
648648

649649
- [ThreadSocketHandler (`d-net`)](https://doxygen.bitcoincore.org/class_c_connman.html#a765597cbfe99c083d8fa3d61bb464e34)
@@ -655,6 +655,9 @@ Threads
655655
- [ThreadOpenConnections (`d-opencon`)](https://doxygen.bitcoincore.org/class_c_connman.html#a55e9feafc3bab78e5c9d408c207faa45)
656656
: Initiates new connections to peers.
657657

658+
- [ThreadI2PAcceptIncoming (`d-i2paccept`)](https://doxygen.bitcoincore.org/class_c_connman.html#a57787b4f9ac847d24065fbb0dd6e70f8)
659+
: Listens for and accepts incoming I2P connections through the I2P SAM proxy.
660+
658661
- ThreadOpenMasternodeConnections (`d-mncon`)
659662
: Opens network connections to masternodes.
660663

0 commit comments

Comments
 (0)