Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Jul 4, 2024
2 parents 5fe83af + bd5d168 commit 3a89bdb
Show file tree
Hide file tree
Showing 85 changed files with 1,382 additions and 1,044 deletions.
2 changes: 1 addition & 1 deletion ci/lint/04_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_
tar --xz -xf - --directory /tmp/
mv "/tmp/shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/bin/

MLC_VERSION=v0.16.3
MLC_VERSION=v0.18.0
MLC_BIN=mlc-x86_64-linux
curl -sL "https://github.com/becheran/mlc/releases/download/${MLC_VERSION}/${MLC_BIN}" -o "/usr/bin/mlc"
chmod +x /usr/bin/mlc
4 changes: 4 additions & 0 deletions ci/test/01_base_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
-S /msan/llvm-project/runtimes

ninja -C /msan/cxx_build/ "-j$( nproc )" # Use nproc, because MAKEJOBS is the default in docker image builds

# Clear no longer needed source folder
du -sh /msan/llvm-project
rm -rf /msan/llvm-project
fi

if [[ "${RUN_TIDY}" == "true" ]]; then
Expand Down
14 changes: 8 additions & 6 deletions depends/packages/libevent.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ $(package)_version=2.1.12-stable
$(package)_download_path=https://github.com/libevent/libevent/releases/download/release-$($(package)_version)/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
$(package)_patches=cmake_fixups.patch
$(package)_build_subdir=build

# When building for Windows, we set _WIN32_WINNT to target the same Windows
# version as we do in configure. Due to quirks in libevents build system, this
# is also required to enable support for ipv6. See #19375.
define $(package)_set_vars
$(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress --disable-samples
$(package)_config_opts += --disable-dependency-tracking --enable-option-checking
$(package)_config_opts_release=--disable-debug-mode
$(package)_config_opts=-DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_OPENSSL=ON
$(package)_config_opts+=-DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_REGRESS=ON
$(package)_config_opts+=-DEVENT__DISABLE_TESTS=ON -DEVENT__LIBRARY_TYPE=STATIC
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601

ifeq ($(NO_HARDEN),)
Expand All @@ -19,11 +21,11 @@ define $(package)_set_vars
endef

define $(package)_preprocess_cmds
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub build-aux
patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch
endef

define $(package)_config_cmds
$($(package)_autoconf)
$($(package)_cmake) -S .. -B .
endef

define $(package)_build_cmds
Expand All @@ -35,7 +37,7 @@ define $(package)_stage_cmds
endef

define $(package)_postprocess_cmds
rm lib/*.la && \
rm bin/event_rpcgen.py && \
rm include/ev*.h && \
rm include/event2/*_compat.h
endef
35 changes: 35 additions & 0 deletions depends/patches/libevent/cmake_fixups.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake: set minimum version to 3.5

Fix generated pkg-config files, see
https://github.com/libevent/libevent/pull/1165.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@
# start libevent.sln
#

-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake
index 04f5837e..d8ea42c4 100644
--- a/cmake/AddEventLibrary.cmake
+++ b/cmake/AddEventLibrary.cmake
@@ -20,12 +20,12 @@ macro(generate_pkgconfig LIB_NAME)

set(LIBS "")
foreach (LIB ${LIB_PLATFORM})
- set(LIBS "${LIBS} -L${LIB}")
+ set(LIBS "${LIBS} -l${LIB}")
endforeach()

set(OPENSSL_LIBS "")
foreach(LIB ${OPENSSL_LIBRARIES})
- set(OPENSSL_LIBS "${OPENSSL_LIBS} -L${LIB}")
+ set(OPENSSL_LIBS "${OPENSSL_LIBS} -l${LIB}")
endforeach()

configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY)
8 changes: 8 additions & 0 deletions doc/release-notes-27307.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Wallet
---

The wallet now detects when wallet transactions conflict with the mempool. Mempool
conflicting transactions can be seen in the `"mempoolconflicts"` field of
`gettransaction`. The inputs of mempool conflicted transactions can now be respent
without manually abandoning the transactions when the parent transaction is dropped
from the mempool, which can cause wallet balances to appear higher.
11 changes: 11 additions & 0 deletions doc/release-notes-29496.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Mempool Policy Changes
----------------------

- Transactions with version number set to 3 are now treated as standard on all networks (#29496),
subject to Opt-in Topologically Restricted Until Confirmation (TRUC) Transactions policy as
described in [BIP 431](https://github.com/bitcoin/bips/blob/master/bip-0431.mediawiki). The
policy includes limits on spending unconfirmed outputs (#28948), eviction of a previous descendant
if a more incentive-compatible one is submitted (#29306), and a maximum transaction size of 10,000vB
(#29873). These restrictions simplify the assessment of incentive compatibility of accepting or
replacing TRUC transactions, thus ensuring any replacements are more profitable for the node and
making fee-bumping more reliable.
13 changes: 6 additions & 7 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ BITCOIN_CORE_H = \
kernel/mempool_entry.h \
kernel/mempool_limits.h \
kernel/mempool_options.h \
kernel/mempool_persist.h \
kernel/mempool_removal_reason.h \
kernel/messagestartchars.h \
kernel/notifications_interface.h \
Expand Down Expand Up @@ -229,6 +228,7 @@ BITCOIN_CORE_H = \
node/interface_ui.h \
node/kernel_notifications.h \
node/mempool_args.h \
node/mempool_persist.h \
node/mempool_persist_args.h \
node/miner.h \
node/mini_miner.h \
Expand All @@ -245,14 +245,14 @@ BITCOIN_CORE_H = \
node/warnings.h \
noui.h \
outputtype.h \
policy/v3_policy.h \
policy/feerate.h \
policy/fees.h \
policy/fees_args.h \
policy/packages.h \
policy/policy.h \
policy/rbf.h \
policy/settings.h \
policy/truc_policy.h \
pow.h \
protocol.h \
psbt.h \
Expand Down Expand Up @@ -416,7 +416,6 @@ libgroestlcoin_node_a_SOURCES = \
kernel/context.cpp \
kernel/cs_main.cpp \
kernel/disconnected_transactions.cpp \
kernel/mempool_persist.cpp \
kernel/mempool_removal_reason.cpp \
mapport.cpp \
net.cpp \
Expand All @@ -438,6 +437,7 @@ libgroestlcoin_node_a_SOURCES = \
node/interfaces.cpp \
node/kernel_notifications.cpp \
node/mempool_args.cpp \
node/mempool_persist.cpp \
node/mempool_persist_args.cpp \
node/miner.cpp \
node/mini_miner.cpp \
Expand All @@ -451,12 +451,12 @@ libgroestlcoin_node_a_SOURCES = \
node/validation_cache_args.cpp \
node/warnings.cpp \
noui.cpp \
policy/v3_policy.cpp \
policy/fees.cpp \
policy/fees_args.cpp \
policy/packages.cpp \
policy/rbf.cpp \
policy/settings.cpp \
policy/truc_policy.cpp \
pow.cpp \
rest.cpp \
rpc/blockchain.cpp \
Expand Down Expand Up @@ -714,9 +714,9 @@ libgroestlcoin_common_a_SOURCES = \
netbase.cpp \
net_permissions.cpp \
outputtype.cpp \
policy/v3_policy.cpp \
policy/feerate.cpp \
policy/policy.cpp \
policy/truc_policy.cpp \
protocol.cpp \
psbt.cpp \
rpc/external_signer.cpp \
Expand Down Expand Up @@ -958,18 +958,17 @@ libgroestlcoinkernel_la_SOURCES = \
kernel/context.cpp \
kernel/cs_main.cpp \
kernel/disconnected_transactions.cpp \
kernel/mempool_persist.cpp \
kernel/mempool_removal_reason.cpp \
logging.cpp \
node/blockstorage.cpp \
node/chainstate.cpp \
node/utxo_snapshot.cpp \
policy/v3_policy.cpp \
policy/feerate.cpp \
policy/packages.cpp \
policy/policy.cpp \
policy/rbf.cpp \
policy/settings.cpp \
policy/truc_policy.cpp \
pow.cpp \
primitives/block.cpp \
primitives/transaction.cpp \
Expand Down
3 changes: 1 addition & 2 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ BITCOIN_TESTS =\
test/validation_flush_tests.cpp \
test/validation_tests.cpp \
test/validationinterface_tests.cpp \
test/versionbits_tests.cpp \
test/xoroshiro128plusplus_tests.cpp
test/versionbits_tests.cpp

if ENABLE_WALLET
BITCOIN_TESTS += \
Expand Down
3 changes: 1 addition & 2 deletions src/Makefile.test_util.include
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ TEST_UTIL_H = \
test/util/str.h \
test/util/transaction_utils.h \
test/util/txmempool.h \
test/util/validation.h \
test/util/xoroshiro128plusplus.h
test/util/validation.h

if ENABLE_WALLET
TEST_UTIL_H += wallet/test/util.h
Expand Down
2 changes: 1 addition & 1 deletion src/addrdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ template <typename Data>
bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data& data)
{
// Generate random temporary filename
const uint16_t randv{GetRand<uint16_t>()};
const uint16_t randv{FastRandomContext().rand<uint16_t>()};
std::string tmpfn = strprintf("%s.%04x", prefix, randv);

// open temp output file
Expand Down
2 changes: 1 addition & 1 deletion src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ std::pair<CAddress, NodeSeconds> AddrManImpl::Select_(bool new_only, std::option
const AddrInfo& info{it_found->second};

// With probability GetChance() * chance_factor, return the entry.
if (insecure_rand.randbits(30) < chance_factor * info.GetChance() * (1 << 30)) {
if (insecure_rand.randbits<30>() < chance_factor * info.GetChance() * (1 << 30)) {
LogPrint(BCLog::ADDRMAN, "Selected %s from %s\n", info.ToStringAddrPort(), search_tried ? "tried" : "new");
return {info, info.m_last_try};
}
Expand Down
4 changes: 2 additions & 2 deletions src/blockencodings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#include <unordered_map>

CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block) :
nonce(GetRand<uint64_t>()),
CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(const CBlock& block, const uint64_t nonce) :
nonce(nonce),
shorttxids(block.vtx.size() - 1), prefilledtxn(1), header(block) {
FillShortTxIDSelector();
//TODO: Use our mempool prior to block acceptance to predictively fill more than just the coinbase
Expand Down
11 changes: 8 additions & 3 deletions src/blockencodings.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,15 @@ class CBlockHeaderAndShortTxIDs {

CBlockHeader header;

// Dummy for deserialization
/**
* Dummy for deserialization
*/
CBlockHeaderAndShortTxIDs() {}

CBlockHeaderAndShortTxIDs(const CBlock& block);
/**
* @param[in] nonce This should be randomly generated, and is used for the siphash secret key
*/
CBlockHeaderAndShortTxIDs(const CBlock& block, const uint64_t nonce);

uint64_t GetShortID(const Wtxid& wtxid) const;

Expand Down Expand Up @@ -141,7 +146,7 @@ class PartiallyDownloadedBlock {

explicit PartiallyDownloadedBlock(CTxMemPool* poolIn) : pool(poolIn) {}

// extra_txn is a list of extra transactions to look at, in <witness hash, reference> form
// extra_txn is a list of extra orphan/conflicted/etc transactions to look at
ReadStatus InitData(const CBlockHeaderAndShortTxIDs& cmpctblock, const std::vector<CTransactionRef>& extra_txn);
bool IsTxAvailable(size_t index) const;
ReadStatus FillBlock(CBlock& block, const std::vector<CTransactionRef>& vtx_missing);
Expand Down
2 changes: 1 addition & 1 deletion src/common/bloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ bool CRollingBloomFilter::contains(Span<const unsigned char> vKey) const

void CRollingBloomFilter::reset()
{
nTweak = GetRand<unsigned int>();
nTweak = FastRandomContext().rand<unsigned int>();
nEntriesThisGeneration = 0;
nGeneration = 1;
std::fill(data.begin(), data.end(), 0);
Expand Down
2 changes: 1 addition & 1 deletion src/headerssync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static_assert(sizeof(CompressedHeader) == 48);

HeadersSyncState::HeadersSyncState(NodeId id, const Consensus::Params& consensus_params,
const CBlockIndex* chain_start, const arith_uint256& minimum_required_work) :
m_commit_offset(GetRand<unsigned>(HEADER_COMMITMENT_PERIOD)),
m_commit_offset(FastRandomContext().randrange<unsigned>(HEADER_COMMITMENT_PERIOD)),
m_id(id), m_consensus_params(consensus_params),
m_chain_start(chain_start),
m_minimum_required_work(minimum_required_work),
Expand Down
Loading

0 comments on commit 3a89bdb

Please sign in to comment.