Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/dashpay/dash into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta committed Sep 25, 2024
2 parents df96997 + 61201b8 commit a0e056f
Show file tree
Hide file tree
Showing 88 changed files with 2,438 additions and 566 deletions.
2 changes: 1 addition & 1 deletion ci/dash/matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ source ./ci/test/00_setup_env.sh
export ASAN_OPTIONS=""
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1"
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan"
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"

if [ "$BUILD_TARGET" = "arm-linux" ]; then
source ./ci/test/00_setup_env_arm.sh
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AC_PREREQ([2.69])
dnl Don't forget to push a corresponding tag when updating any of _CLIENT_VERSION_* numbers
define(_CLIENT_VERSION_MAJOR, 21)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_MAJOR, 22)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2024)
Expand Down
5 changes: 5 additions & 0 deletions doc/release-notes-6239.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
P2P and Network Changes
-----------------------

The max number of compressed block headers which can be requested at once has been increased from 2000 to 8000. This
change activates with the protocol version `70235` and only applies to compressed block headers.
4 changes: 4 additions & 0 deletions doc/release-notes-6281.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
P2P and Network Changes
-----------------------

`MIN_PEER_PROTO_VERSION` has been bumped to `70216`
2 changes: 1 addition & 1 deletion src/bench/rpc_mempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
static void AddTx(const CTransactionRef& tx, const CAmount& fee, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs)
{
LockPoints lp;
pool.addUnchecked(CTxMemPoolEntry(tx, fee, /* time */ 0, /* height */ 1, /* spendsCoinbase */ false, /* sigOps */ 1, lp));
pool.addUnchecked(CTxMemPoolEntry(tx, fee, /*time=*/0, /*entry_height=*/1, /*spends_coinbase=*/false, /*sigops*/1, lp));
}

static void RpcMempool(benchmark::Bench& bench)
Expand Down
7 changes: 0 additions & 7 deletions src/bip324.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
#include <iterator>
#include <string>

BIP324Cipher::BIP324Cipher() noexcept
{
m_key.MakeNewKey(true);
uint256 entropy = GetRandHash();
m_our_pubkey = m_key.EllSwiftCreate(MakeByteSpan(entropy));
}

BIP324Cipher::BIP324Cipher(const CKey& key, Span<const std::byte> ent32) noexcept :
m_key(key)
{
Expand Down
4 changes: 2 additions & 2 deletions src/bip324.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class BIP324Cipher
std::array<std::byte, GARBAGE_TERMINATOR_LEN> m_recv_garbage_terminator;

public:
/** Initialize a BIP324 cipher with securely generated random keys. */
BIP324Cipher() noexcept;
/** No default constructor; keys must be provided to create a BIP324Cipher. */
BIP324Cipher() = delete;

/** Initialize a BIP324 cipher with specified key and encoding entropy (testing only). */
BIP324Cipher(const CKey& key, Span<const std::byte> ent32) noexcept;
Expand Down
18 changes: 14 additions & 4 deletions src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ static constexpr int DEFAULT_WAIT_CLIENT_TIMEOUT = 0;
static const bool DEFAULT_NAMED=false;
static const int CONTINUE_EXECUTION=-1;
static constexpr int8_t UNKNOWN_NETWORK{-1};
static constexpr std::array NETWORKS{"ipv4", "ipv6", "onion", "i2p", "cjdns"};
// See GetNetworkName() in netbase.cpp
static constexpr std::array NETWORKS{"not_publicly_routable", "ipv4", "ipv6", "onion", "i2p", "cjdns", "internal"};
static constexpr std::array NETWORK_SHORT_NAMES{"npr", "ipv4", "ipv6", "onion", "i2p", "cjdns", "int"};
static constexpr std::array UNREACHABLE_NETWORK_IDS{/*not_publicly_routable*/0, /*internal*/6};

/** Default number of blocks to generate for RPC generatetoaddress. */
static const std::string DEFAULT_NBLOCKS = "1";
Expand Down Expand Up @@ -296,7 +299,7 @@ class AddrinfoRequestHandler : public BaseRequestHandler
// Prepare result to return to user.
UniValue result{UniValue::VOBJ}, addresses{UniValue::VOBJ};
uint64_t total{0}; // Total address count
for (size_t i = 0; i < NETWORKS.size(); ++i) {
for (size_t i = 1; i < NETWORKS.size() - 1; ++i) {
addresses.pushKV(NETWORKS[i], counts.at(i));
total += counts.at(i);
}
Expand Down Expand Up @@ -517,7 +520,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
const bool is_addr_relay_enabled{peer["addr_relay_enabled"].isNull() ? false : peer["addr_relay_enabled"].get_bool()};
const bool is_bip152_hb_from{peer["bip152_hb_from"].get_bool()};
const bool is_bip152_hb_to{peer["bip152_hb_to"].get_bool()};
m_peers.push_back({addr, sub_version, conn_type, network, age, 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});
m_peers.push_back({addr, sub_version, conn_type, NETWORK_SHORT_NAMES[network_id], age, 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});
m_max_addr_length = std::max(addr.length() + 1, m_max_addr_length);
m_max_addr_processed_length = std::max(ToString(addr_processed).length(), m_max_addr_processed_length);
m_max_addr_rate_limited_length = std::max(ToString(addr_rate_limited).length(), m_max_addr_rate_limited_length);
Expand Down Expand Up @@ -582,6 +585,13 @@ class NetinfoRequestHandler : public BaseRequestHandler
reachable_networks.push_back(network_id);
}
};

for (const size_t network_id : UNREACHABLE_NETWORK_IDS) {
if (m_counts.at(2).at(network_id) == 0) continue;
result += strprintf("%8s", NETWORK_SHORT_NAMES.at(network_id)); // column header
reachable_networks.push_back(network_id);
}

result += " total block";
if (m_manual_peers_count) result += " manual";

Expand Down Expand Up @@ -646,7 +656,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
" \"manual\" - peer we manually added using RPC addnode or the -addnode/-connect config options\n"
" \"feeler\" - short-lived connection for testing addresses\n"
" \"addr\" - address fetch; short-lived connection for requesting addresses\n"
" net Network the peer connected through (\"ipv4\", \"ipv6\", \"onion\", \"i2p\", or \"cjdns\")\n"
" net Network the peer connected through (\"ipv4\", \"ipv6\", \"onion\", \"i2p\", \"cjdns\", or \"npr\" (not publicly routable))\n"
" mping Minimum observed ping time, in milliseconds (ms)\n"
" ping Last observed ping time, in milliseconds (ms)\n"
" send Time since last message sent to the peer, in seconds\n"
Expand Down
4 changes: 2 additions & 2 deletions src/coinjoin/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ bool CCoinJoinClientSession::CreateDenominated(CAmount nBalanceToDenominate, con
}

bool finished = true;
for (const auto [denom, count] : mapDenomCount) {
for (const auto& [denom, count] : mapDenomCount) {
// Check if this specific denom could use another loop, check that there aren't nCoinJoinDenomsGoal of this
// denom and that our nValueLeft/nBalanceToDenominate is enough to create one of these denoms, if so, loop again.
if (count < CCoinJoinClientOptions::GetDenomsGoal() && txBuilder.CouldAddOutput(denom) && nBalanceToDenominate > 0) {
Expand Down Expand Up @@ -1807,7 +1807,7 @@ bool CCoinJoinClientSession::CreateDenominated(CAmount nBalanceToDenominate, con

WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- 3 - nBalanceToDenominate: %f, %s\n", __func__, (float) nBalanceToDenominate / COIN, txBuilder.ToString());

for (const auto [denom, count] : mapDenomCount) {
for (const auto& [denom, count] : mapDenomCount) {
WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- 3 - DONE - nDenomValue: %f, count: %d\n", __func__, (float) denom / COIN, count);
}

Expand Down
2 changes: 2 additions & 0 deletions src/dsnotificationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,5 @@ void CDSNotificationInterface::NotifyChainLock(const CBlockIndex* pindex, const
m_llmq_ctx->isman->NotifyChainLock(pindex);
m_cj_ctx->dstxman->NotifyChainLock(pindex, *m_llmq_ctx->clhandler, m_mn_sync);
}

std::unique_ptr<CDSNotificationInterface> g_ds_notification_interface;
2 changes: 2 additions & 0 deletions src/dsnotificationinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@ class CDSNotificationInterface : public CValidationInterface
const std::unique_ptr<CJContext>& m_cj_ctx;
};

extern std::unique_ptr<CDSNotificationInterface> g_ds_notification_interface;

#endif // BITCOIN_DSNOTIFICATIONINTERFACE_H
7 changes: 4 additions & 3 deletions src/evo/cbtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <consensus/validation.h>
#include <evo/cbtx.h>
#include <evo/deterministicmns.h>
#include <evo/simplifiedmns.h>
#include <evo/specialtx.h>
#include <llmq/blockprocessor.h>
#include <llmq/chainlocks.h>
#include <llmq/commitment.h>
#include <llmq/options.h>
#include <llmq/quorums.h>
#include <node/blockstorage.h>
#include <evo/simplifiedmns.h>
#include <evo/specialtx.h>
#include <consensus/validation.h>

#include <chain.h>
#include <chainparams.h>
Expand Down
1 change: 1 addition & 0 deletions src/evo/creditpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <evo/assetlocktx.h>
#include <evo/cbtx.h>
#include <evo/evodb.h>
#include <evo/specialtx.h>

#include <chain.h>
Expand Down
2 changes: 1 addition & 1 deletion src/evo/creditpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <coins.h>

#include <evo/assetlocktx.h>
#include <evo/evodb.h>

#include <saltedhasher.h>
#include <serialize.h>
Expand All @@ -23,6 +22,7 @@
class BlockManager;
class CBlockIndex;
class BlockValidationState;
class CEvoDB;
class TxValidationState;
namespace Consensus {
struct Params;
Expand Down
1 change: 1 addition & 0 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <evo/deterministicmns.h>
#include <evo/dmn_types.h>
#include <evo/dmnstate.h>
#include <evo/evodb.h>
#include <evo/providertx.h>
#include <evo/specialtx.h>
#include <llmq/commitment.h>
Expand Down
5 changes: 3 additions & 2 deletions src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#include <evo/dmnstate.h>

#include <arith_uint256.h>
#include <clientversion.h>
#include <consensus/params.h>
#include <crypto/common.h>
#include <evo/dmn_types.h>
#include <evo/evodb.h>
#include <evo/providertx.h>
#include <gsl/pointers.h>
#include <saltedhasher.h>
#include <scheduler.h>
#include <sync.h>
#include <gsl/pointers.h>

#include <immer/map.hpp>

Expand All @@ -30,6 +30,7 @@ class CBlock;
class CBlockIndex;
class CChainState;
class CConnman;
class CEvoDB;
class TxValidationState;

extern RecursiveMutex cs_main;
Expand Down
3 changes: 2 additions & 1 deletion src/evo/mnhftx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

#include <consensus/validation.h>
#include <deploymentstatus.h>
#include <evo/evodb.h>
#include <evo/mnhftx.h>
#include <evo/specialtx.h>
#include <llmq/commitment.h>
#include <llmq/signing.h>
#include <llmq/quorums.h>
#include <llmq/signing.h>
#include <node/blockstorage.h>

#include <chain.h>
Expand Down
17 changes: 8 additions & 9 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
#include <spork.h>
#include <walletinitinterface.h>

#include <evo/evodb.h>
#include <evo/chainhelper.h>
#include <evo/creditpool.h>
#include <evo/deterministicmns.h>
Expand Down Expand Up @@ -141,8 +142,6 @@ static constexpr bool DEFAULT_PROXYRANDOMIZE{true};
static constexpr bool DEFAULT_REST_ENABLE{false};
static constexpr bool DEFAULT_I2P_ACCEPT_INCOMING{true};

static CDSNotificationInterface* pdsNotificationInterface = nullptr;

#ifdef WIN32
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
// accessing block files don't count towards the fd_set size limit
Expand Down Expand Up @@ -369,11 +368,11 @@ void PrepareShutdown(NodeContext& node)
}
#endif

if (pdsNotificationInterface) {
UnregisterValidationInterface(pdsNotificationInterface);
delete pdsNotificationInterface;
pdsNotificationInterface = nullptr;
if (g_ds_notification_interface) {
UnregisterValidationInterface(g_ds_notification_interface.get());
g_ds_notification_interface.reset();
}

if (node.mn_activeman) {
UnregisterValidationInterface(node.mn_activeman.get());
node.mn_activeman.reset();
Expand Down Expand Up @@ -2147,10 +2146,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
node.cj_ctx, node.llmq_ctx, ignores_incoming_txs);
RegisterValidationInterface(node.peerman.get());

pdsNotificationInterface = new CDSNotificationInterface(
g_ds_notification_interface = std::make_unique<CDSNotificationInterface>(
*node.connman, *node.mn_sync, *node.govman, *node.peerman, chainman, node.mn_activeman.get(), node.dmnman, node.llmq_ctx, node.cj_ctx
);
RegisterValidationInterface(pdsNotificationInterface);
RegisterValidationInterface(g_ds_notification_interface.get());

// ********************************************************* Step 7c: Setup CoinJoin

Expand Down Expand Up @@ -2327,7 +2326,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}

chainman.m_load_block = std::thread(&util::TraceThread, "loadblk", [=, &args, &chainman, &node] {
ThreadImport(chainman, *node.dmnman, *pdsNotificationInterface, vImportFiles, node.mn_activeman.get(), args);
ThreadImport(chainman, *node.dmnman, *g_ds_notification_interface, vImportFiles, node.mn_activeman.get(), args);
});

// Wait for genesis block to be processed
Expand Down
5 changes: 3 additions & 2 deletions src/interfaces/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
#include <util/message.h>
#include <util/ui_change_type.h>

#include <cstdint>
#include <functional>
#include <map>
#include <memory>
#include <psbt.h>
#include <stdint.h>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

Expand All @@ -37,7 +38,7 @@ struct CRecipient;
struct PartiallySignedTransaction;
struct WalletContext;
struct bilingual_str;
typedef uint8_t isminefilter;
using isminefilter = std::underlying_type<isminetype>::type;

namespace interfaces {

Expand Down
2 changes: 1 addition & 1 deletion src/llmq/chainlocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <crypto/common.h>
#include <llmq/signing.h>
#include <llmq/quorums.h>
#include <net.h>
#include <net_types.h>
#include <primitives/block.h>
Expand All @@ -36,6 +35,7 @@ namespace llmq
{
class CSigningManager;
class CSigSharesManager;
enum class VerifyRecSigStatus;

class CChainLocksHandler : public CRecoveredSigsListener
{
Expand Down
21 changes: 12 additions & 9 deletions src/llmq/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@
#include <llmq/signing_shares.h>

LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman, CEvoDB& evo_db,
CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman, CTxMemPool& mempool,
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
const std::unique_ptr<PeerManager>& peerman, bool unit_tests, bool wipe) :
CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman,
CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman,
const CMasternodeSync& mn_sync, const std::unique_ptr<PeerManager>& peerman, bool unit_tests,
bool wipe) :
is_masternode{mn_activeman != nullptr},
bls_worker{std::make_shared<CBLSWorker>()},
dkg_debugman{std::make_unique<llmq::CDKGDebugManager>()},
quorum_block_processor{std::make_unique<llmq::CQuorumBlockProcessor>(chainstate, dmnman, evo_db, peerman)},
qdkgsman{std::make_unique<llmq::CDKGSessionManager>(*bls_worker, chainstate, connman, dmnman, *dkg_debugman, mn_metaman, *quorum_block_processor, mn_activeman, sporkman, peerman, unit_tests, wipe)},
qman{std::make_unique<llmq::CQuorumManager>(*bls_worker, chainstate, connman, dmnman, *qdkgsman, evo_db, *quorum_block_processor, mn_activeman, mn_sync, sporkman)},
qdkgsman{std::make_unique<llmq::CDKGSessionManager>(*bls_worker, chainstate, connman, dmnman, *dkg_debugman,
mn_metaman, *quorum_block_processor, mn_activeman, sporkman,
peerman, unit_tests, wipe)},
qman{std::make_unique<llmq::CQuorumManager>(*bls_worker, chainstate, connman, dmnman, *qdkgsman, evo_db,
*quorum_block_processor, mn_activeman, mn_sync, sporkman, unit_tests,
wipe)},
sigman{std::make_unique<llmq::CSigningManager>(connman, mn_activeman, chainstate, *qman, peerman, unit_tests, wipe)},
shareman{std::make_unique<llmq::CSigSharesManager>(connman, *sigman, mn_activeman, *qman, sporkman, peerman)},
clhandler{[&]() -> llmq::CChainLocksHandler* const {
Expand All @@ -39,11 +44,9 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterminis
llmq::quorumInstantSendManager = std::make_unique<llmq::CInstantSendManager>(*llmq::chainLocksHandler, chainstate, connman, *qman, *sigman, *shareman, sporkman, mempool, mn_sync, peerman, is_masternode, unit_tests, wipe);
return llmq::quorumInstantSendManager.get();
}()},
ehfSignalsHandler{std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool, *qman, sporkman, peerman)}
ehfSignalsHandler{std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool,
*qman, sporkman, peerman)}
{
// NOTE: we use this only to wipe the old db, do NOT use it for anything else
// TODO: remove it in some future version
auto llmqDbTmp = std::make_unique<CDBWrapper>(unit_tests ? "" : (gArgs.GetDataDirNet() / "llmq"), 1 << 20, unit_tests, true);
}

LLMQContext::~LLMQContext() {
Expand Down
Loading

0 comments on commit a0e056f

Please sign in to comment.