Skip to content

Commit 02f3abd

Browse files
Merge branch 'develop' of https://github.com/dashpay/dash into develop
2 parents 9113138 + 0972dfe commit 02f3abd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1300
-724
lines changed

configure.ac

+4-4
Original file line numberDiff line numberDiff line change
@@ -1974,16 +1974,16 @@ echo " boost process = $with_boost_process"
19741974
echo " multiprocess = $build_multiprocess"
19751975
echo " with libs = $build_bitcoin_libs"
19761976
echo " with wallet = $enable_wallet"
1977-
echo " with gui / qt = $bitcoin_enable_qt"
19781977
if test "x$enable_wallet" != "xno"; then
1979-
echo " with sqlite = $use_sqlite"
1980-
echo " with bdb = $use_bdb"
1978+
echo " with sqlite = $use_sqlite"
1979+
echo " with bdb = $use_bdb"
19811980
fi
1981+
echo " with gui / qt = $bitcoin_enable_qt"
19821982
if test x$bitcoin_enable_qt != xno; then
19831983
echo " with qr = $use_qr"
19841984
fi
19851985
echo " with zmq = $use_zmq"
1986-
if test x$enable_fuzz == xno; then
1986+
if test x$enable_fuzz = xno; then
19871987
echo " with test = $use_tests"
19881988
else
19891989
echo " with test = not building test_dash because fuzzing is enabled"

doc/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ The Dash Core repo's [root README](/README.md) contains relevant information on
7676
- [I2P Support](i2p.md)
7777
- [Init Scripts (systemd/upstart/openrc)](init.md)
7878
- [Managing Wallets](managing-wallets.md)
79+
- [P2P bad ports definition and list](p2p-bad-ports.md)
7980
- [PSBT support](psbt.md)
8081
- [Reduce Memory](reduce-memory.md)
8182
- [Reduce Traffic](reduce-traffic.md)

doc/p2p-bad-ports.md

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
When Dash Core automatically opens outgoing P2P connections, it chooses
2+
a peer (address and port) from its list of potential peers. This list is
3+
populated with unchecked data gossiped over the P2P network by other peers.
4+
5+
A malicious actor may gossip an address:port where no Dash node is listening,
6+
or one where a service is listening that is not related to the Dash network.
7+
As a result, this service may occasionally get connection attempts from Dash
8+
nodes.
9+
10+
"Bad" ports are ones used by services which are usually not open to the public
11+
and usually require authentication. A connection attempt (by Dash Core,
12+
trying to connect because it thinks there is a Dash node on that
13+
address:port) to such service may be considered a malicious action by an
14+
ultra-paranoid administrator. An example for such a port is 22 (ssh). On the
15+
other hand, connection attempts to public services that usually do not require
16+
authentication are unlikely to be considered a malicious action,
17+
e.g. port 80 (http).
18+
19+
Below is a list of "bad" ports which Dash Core avoids when choosing a peer to
20+
connect to. If a node is listening on such a port, it will likely receive fewer
21+
incoming connections.
22+
23+
1: tcpmux
24+
7: echo
25+
9: discard
26+
11: systat
27+
13: daytime
28+
15: netstat
29+
17: qotd
30+
19: chargen
31+
20: ftp data
32+
21: ftp access
33+
22: ssh
34+
23: telnet
35+
25: smtp
36+
37: time
37+
42: name
38+
43: nicname
39+
53: domain
40+
69: tftp
41+
77: priv-rjs
42+
79: finger
43+
87: ttylink
44+
95: supdup
45+
101: hostname
46+
102: iso-tsap
47+
103: gppitnp
48+
104: acr-nema
49+
109: pop2
50+
110: pop3
51+
111: sunrpc
52+
113: auth
53+
115: sftp
54+
117: uucp-path
55+
119: nntp
56+
123: NTP
57+
135: loc-srv /epmap
58+
137: netbios
59+
139: netbios
60+
143: imap2
61+
161: snmp
62+
179: BGP
63+
389: ldap
64+
427: SLP (Also used by Apple Filing Protocol)
65+
465: smtp+ssl
66+
512: print / exec
67+
513: login
68+
514: shell
69+
515: printer
70+
526: tempo
71+
530: courier
72+
531: chat
73+
532: netnews
74+
540: uucp
75+
548: AFP (Apple Filing Protocol)
76+
554: rtsp
77+
556: remotefs
78+
563: nntp+ssl
79+
587: smtp (rfc6409)
80+
601: syslog-conn (rfc3195)
81+
636: ldap+ssl
82+
989: ftps-data
83+
990: ftps
84+
993: ldap+ssl
85+
995: pop3+ssl
86+
1719: h323gatestat
87+
1720: h323hostcall
88+
1723: pptp
89+
2049: nfs
90+
3659: apple-sasl / PasswordServer
91+
4045: lockd
92+
5060: sip
93+
5061: sips
94+
6000: X11
95+
6566: sane-port
96+
6665: Alternate IRC
97+
6666: Alternate IRC
98+
6667: Standard IRC
99+
6668: Alternate IRC
100+
6669: Alternate IRC
101+
6697: IRC + TLS
102+
10080: Amanda
103+
104+
For further information see:
105+
106+
[pull/23306](https://github.com/bitcoin/bitcoin/pull/23306#issuecomment-947516736)
107+
108+
[pull/23542](https://github.com/bitcoin/bitcoin/pull/23542)
109+
110+
[fetch.spec.whatwg.org](https://fetch.spec.whatwg.org/#port-blocking)
111+
112+
[chromium.googlesource.com](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/net/base/port_util.cc)
113+
114+
[hg.mozilla.org](https://hg.mozilla.org/mozilla-central/file/tip/netwerk/base/nsIOService.cpp)

doc/release-notes-6455.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## New RPCs
2+
3+
- **`getislocks`**
4+
- Retrieves the InstantSend lock data for the given transaction IDs (txids).
5+
Returns the lock information in both human-friendly JSON format and binary hex-encoded zmq-compatible format.
6+
7+
## Updated RPCs
8+
9+
- **`getbestchainlock` Changes**
10+
- A new hex field has been added to the getbestchainlock RPC, which returns the ChainLock information in zmq-compatible, hex-encoded binary format.
11+

doc/release-notes-6530.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Notable changes
2+
===============
3+
4+
Updated RPCs
5+
------------
6+
7+
- `lockunspent` now optionally takes a third parameter, `persistent`, which
8+
causes the lock to be written persistently to the wallet database. This
9+
allows UTXOs to remain locked even after node restarts or crashes.
10+
11+
GUI changes
12+
-----------
13+
14+
- UTXOs which are locked via the GUI are now stored persistently in the
15+
wallet database, so are not lost on node shutdown or crash.

src/Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ BITCOIN_CORE_H = \
372372
util/sock.h \
373373
util/string.h \
374374
util/spanparsing.h \
375+
util/syserror.h \
375376
util/system.h \
376377
util/time.h \
377378
util/thread.h \
@@ -825,6 +826,7 @@ libbitcoin_util_a_SOURCES = \
825826
util/hasher.cpp \
826827
util/getuniquepath.cpp \
827828
util/sock.cpp \
829+
util/syserror.cpp \
828830
util/system.cpp \
829831
util/message.cpp \
830832
util/moneystr.cpp \

src/Makefile.test.include

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ BITCOIN_TESTS =\
139139
test/net_peer_eviction_tests.cpp \
140140
test/net_tests.cpp \
141141
test/netbase_tests.cpp \
142+
test/orphanage_tests.cpp \
142143
test/pmt_tests.cpp \
143144
test/policyestimator_tests.cpp \
144145
test/pool_tests.cpp \

src/base58.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ std::string EncodeBase58(Span<const unsigned char> input)
126126

127127
bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet, int max_ret_len)
128128
{
129-
if (!ValidAsCString(str)) {
129+
if (!ContainsNoNUL(str)) {
130130
return false;
131131
}
132132
return DecodeBase58(str.c_str(), vchRet, max_ret_len);
@@ -160,7 +160,7 @@ std::string EncodeBase58Check(Span<const unsigned char> input)
160160

161161
bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet, int max_ret)
162162
{
163-
if (!ValidAsCString(str)) {
163+
if (!ContainsNoNUL(str)) {
164164
return false;
165165
}
166166
return DecodeBase58Check(str.c_str(), vchRet, max_ret);

src/bitcoin-cli.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
433433
bool is_addr_relay_enabled;
434434
bool is_bip152_hb_from;
435435
bool is_bip152_hb_to;
436-
bool is_block_relay;
437436
bool is_outbound;
437+
bool is_tx_relay;
438438
bool operator<(const Peer& rhs) const { return std::tie(is_outbound, min_ping) < std::tie(rhs.is_outbound, rhs.min_ping); }
439439
};
440440
std::vector<Peer> m_peers;
@@ -498,13 +498,13 @@ class NetinfoRequestHandler : public BaseRequestHandler
498498
const int8_t network_id{NetworkStringToId(network)};
499499
if (network_id == UNKNOWN_NETWORK) continue;
500500
const bool is_outbound{!peer["inbound"].get_bool()};
501-
const bool is_block_relay{peer["relaytxes"].isNull() ? false : !peer["relaytxes"].get_bool()};
501+
const bool is_tx_relay{peer["relaytxes"].isNull() ? true : peer["relaytxes"].get_bool()};
502502
const std::string conn_type{peer["connection_type"].get_str()};
503503
++m_counts.at(is_outbound).at(network_id); // in/out by network
504504
++m_counts.at(is_outbound).at(NETWORKS.size()); // in/out overall
505505
++m_counts.at(2).at(network_id); // total by network
506506
++m_counts.at(2).at(NETWORKS.size()); // total overall
507-
if (is_block_relay) ++m_block_relay_peers_count;
507+
if (conn_type == "block-relay-only") ++m_block_relay_peers_count;
508508
if (conn_type == "manual") ++m_manual_peers_count;
509509
if (DetailsRequested()) {
510510
// Push data for this peer to the peers vector.
@@ -527,7 +527,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
527527
const bool is_addr_relay_enabled{peer["addr_relay_enabled"].isNull() ? false : peer["addr_relay_enabled"].get_bool()};
528528
const bool is_bip152_hb_from{peer["bip152_hb_from"].get_bool()};
529529
const bool is_bip152_hb_to{peer["bip152_hb_to"].get_bool()};
530-
m_peers.push_back({addr, sub_version, conn_type, NETWORK_SHORT_NAMES[network_id], age, transport, min_ping, ping, addr_processed, addr_rate_limited, last_blck, last_recv, last_send, last_trxn, peer_id, mapped_as, version, is_addr_relay_enabled, is_bip152_hb_from, is_bip152_hb_to, is_block_relay, is_outbound});
530+
m_peers.push_back({addr, sub_version, conn_type, NETWORK_SHORT_NAMES[network_id], age, transport, min_ping, ping, addr_processed, addr_rate_limited, last_blck, last_recv, last_send, last_trxn, peer_id, mapped_as, version, is_addr_relay_enabled, is_bip152_hb_from, is_bip152_hb_to, is_outbound, is_tx_relay});
531531
m_max_addr_length = std::max(addr.length() + 1, m_max_addr_length);
532532
m_max_addr_processed_length = std::max(ToString(addr_processed).length(), m_max_addr_processed_length);
533533
m_max_addr_rate_limited_length = std::max(ToString(addr_rate_limited).length(), m_max_addr_rate_limited_length);
@@ -561,7 +561,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
561561
PingTimeToString(peer.ping),
562562
peer.last_send ? ToString(time_now - peer.last_send) : "",
563563
peer.last_recv ? ToString(time_now - peer.last_recv) : "",
564-
peer.last_trxn ? ToString((time_now - peer.last_trxn) / 60) : peer.is_block_relay ? "*" : "",
564+
peer.last_trxn ? ToString((time_now - peer.last_trxn) / 60) : peer.is_tx_relay ? "" : "*",
565565
peer.last_blck ? ToString((time_now - peer.last_blck) / 60) : "",
566566
strprintf("%s%s", peer.is_bip152_hb_to ? "." : " ", peer.is_bip152_hb_from ? "*" : " "),
567567
m_max_addr_processed_length, // variable spacing

src/bitcoin-tx.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
223223
template <typename T>
224224
static T TrimAndParse(const std::string& int_str, const std::string& err)
225225
{
226-
const auto parsed{ToIntegral<T>(TrimString(int_str))};
226+
const auto parsed{ToIntegral<T>(TrimStringView(int_str))};
227227
if (!parsed.has_value()) {
228228
throw std::runtime_error(err + " '" + int_str + "'");
229229
}

src/bitcoind.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <noui.h>
2020
#include <shutdown.h>
2121
#include <util/check.h>
22+
#include <util/syserror.h>
2223
#include <util/system.h>
2324
#include <util/strencodings.h>
2425
#include <util/threadnames.h>
@@ -212,7 +213,7 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
212213
}
213214
break;
214215
case -1: // Error happened.
215-
return InitError(Untranslated(strprintf("fork_daemon() failed: %s\n", strerror(errno))));
216+
return InitError(Untranslated(strprintf("fork_daemon() failed: %s\n", SysErrorString(errno))));
216217
default: { // Parent: wait and exit.
217218
int token = daemon_ep.TokenRead();
218219
if (token) { // Success

src/compat/compat.h

-8
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,6 @@ typedef char* sockopt_arg_type;
109109
#define USE_KQUEUE
110110
#endif
111111

112-
bool static inline IsSelectableSocket(const SOCKET& s) {
113-
#if defined(USE_POLL) || defined(WIN32)
114-
return true;
115-
#else
116-
return (s < FD_SETSIZE);
117-
#endif
118-
}
119-
120112
// MSG_NOSIGNAL is not available on some platforms, if it doesn't exist define it as 0
121113
#if !defined(MSG_NOSIGNAL)
122114
#define MSG_NOSIGNAL 0

src/evo/deterministicmns.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,14 @@ void CDeterministicMNManager::HandleQuorumCommitment(const llmq::CFinalCommitmen
10181018

10191019
CDeterministicMNList CDeterministicMNManager::GetListForBlockInternal(gsl::not_null<const CBlockIndex*> pindex)
10201020
{
1021-
AssertLockHeld(cs);
10221021
CDeterministicMNList snapshot;
1022+
1023+
if (!DeploymentActiveAt(*pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0003)) {
1024+
return snapshot;
1025+
}
1026+
1027+
AssertLockHeld(cs);
1028+
10231029
std::list<const CBlockIndex*> listDiffIndexes;
10241030

10251031
while (true) {

src/fs.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <fs.h>
6+
#include <util/syserror.h>
67

78
#ifndef WIN32
89
#include <cstring>
@@ -41,7 +42,7 @@ fs::path AbsPathJoin(const fs::path& base, const fs::path& path)
4142

4243
static std::string GetErrorReason()
4344
{
44-
return std::strerror(errno);
45+
return SysErrorString(errno);
4546
}
4647

4748
FileLock::FileLock(const fs::path& file)

src/httprpc.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,11 @@ static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUserna
171171
return false;
172172
if (strAuth.substr(0, 6) != "Basic ")
173173
return false;
174-
std::string strUserPass64 = TrimString(strAuth.substr(6));
175-
bool invalid;
176-
std::string strUserPass = DecodeBase64(strUserPass64, &invalid);
177-
if (invalid) return false;
174+
std::string_view strUserPass64 = TrimStringView(std::string_view{strAuth}.substr(6));
175+
auto userpass_data = DecodeBase64(strUserPass64);
176+
std::string strUserPass;
177+
if (!userpass_data) return false;
178+
strUserPass.assign(userpass_data->begin(), userpass_data->end());
178179

179180
if (strUserPass.find(':') != std::string::npos)
180181
strAuthUsernameOut = strUserPass.substr(0, strUserPass.find(':'));

src/httpserver.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,11 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
272272
return false;
273273

274274
std::string strUserPass64 = TrimString(strAuth.substr(6));
275-
bool invalid;
276-
std::string strUserPass = DecodeBase64(strUserPass64, &invalid);
277-
if (invalid) return false;
278-
279-
if (strUserPass.find(':') == std::string::npos) return false;
280-
const std::string username{strUserPass.substr(0, strUserPass.find(':'))};
275+
auto opt_strUserPass = DecodeBase64(strUserPass64);
276+
if (!opt_strUserPass.has_value()) return false;
277+
auto it = std::find(opt_strUserPass->begin(), opt_strUserPass->end(), ':');
278+
if (it == opt_strUserPass->end()) return false;
279+
const std::string username = std::string(opt_strUserPass->begin(), it);
281280
return find(g_external_usernames.begin(), g_external_usernames.end(), username) != g_external_usernames.end();
282281
}();
283282

src/i2p.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ static std::string SwapBase64(const std::string& from)
6969
static Binary DecodeI2PBase64(const std::string& i2p_b64)
7070
{
7171
const std::string& std_b64 = SwapBase64(i2p_b64);
72-
bool invalid;
73-
Binary decoded = DecodeBase64(std_b64.c_str(), &invalid);
74-
if (invalid) {
72+
auto decoded = DecodeBase64(std_b64);
73+
if (!decoded) {
7574
throw std::runtime_error(strprintf("Cannot decode Base64: \"%s\"", i2p_b64));
7675
}
77-
return decoded;
76+
return std::move(*decoded);
7877
}
7978

8079
/**

0 commit comments

Comments
 (0)