Skip to content

Commit

Permalink
Fix compilation failure after syncing to 31st Dec. 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
janus committed Jan 25, 2025
1 parent 064ba6f commit 2e48b28
Show file tree
Hide file tree
Showing 71 changed files with 797 additions and 1,232 deletions.
298 changes: 127 additions & 171 deletions CMakeLists.txt

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions cmake/BGL-build-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@
#cmakedefine HAVE_VM_VM_PARAM_H 1

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "@CLIENT_BUGREPORT@"
#define CLIENT_BUGREPORT "@CLIENT_BUGREPORT@"

/* Define to the full name of this package. */
#define PACKAGE_NAME "@CLIENT_NAME@"
#define CLIENT_NAME "@CLIENT_NAME@"

/* Define to the home page for this package. */
#define PACKAGE_URL "@PROJECT_HOMEPAGE_URL@"
#define CLIENT_URL "@PROJECT_HOMEPAGE_URL@"

/* Define to the version of this package. */
#define PACKAGE_VERSION "@CLIENT_VERSION_STRING@"
#define CLIENT_VERSION_STRING "@CLIENT_VERSION_STRING@"

/* Define to 1 if strerror_r returns char *. */
#cmakedefine STRERROR_R_CHAR_P 1
Expand Down
8 changes: 4 additions & 4 deletions src/BGL-wallet-res.rc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ BEGIN
BLOCK "040904E4" // U.S. English - multilingual (hex)
BEGIN
VALUE "CompanyName", "Bitgesell"
VALUE "FileDescription", "BGL-cli (JSON-RPC client for " CLIENT_NAME ")"
VALUE "FileDescription", "BGL-wallet (CLI tool for " CLIENT_NAME " wallets)"
VALUE "FileVersion", CLIENT_VERSION_STRING
VALUE "InternalName", "BGL-cli"
VALUE "InternalName", "BGL-wallet"
VALUE "LegalCopyright", COPYRIGHT_STR
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
VALUE "OriginalFilename", "BGL-cli.exe"
VALUE "ProductName", "BGL-cli"
VALUE "OriginalFilename", "BGL-wallet.exe"
VALUE "ProductName", "BGL-wallet"
VALUE "ProductVersion", CLIENT_VERSION_STRING
END
END
Expand Down
2 changes: 1 addition & 1 deletion src/BGL-wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static std::optional<int> WalletAppInit(ArgsManager& args, int argc, char* argv[
} else {
strUsage += "\n"
"BGL-wallet is an offline tool for creating and interacting with " CLIENT_NAME " wallet files.\n\n"
"By default bitcoin-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n\n"
"By default BGL-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n\n"
"To change the target wallet, use the -datadir, -wallet and (test)chain selection arguments.\n"
"\n"
"Usage: BGL-wallet [options] <command>\n"
Expand Down
70 changes: 18 additions & 52 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# file COPYING or https://opensource.org/license/mit/.

include(GNUInstallDirs)
include(AddWindowsResources)

configure_file(${PROJECT_SOURCE_DIR}/cmake/BGL-build-config.h.in BGL-build-config.h USE_SOURCE_PERMISSIONS @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
Expand All @@ -16,7 +17,7 @@ add_custom_target(generate_build_info
add_library(BGL_clientversion OBJECT EXCLUDE_FROM_ALL
clientversion.cpp
)
target_link_libraries(bitgesell_clientversion
target_link_libraries(BGL_clientversion
PRIVATE
core_interface
)
Expand All @@ -29,8 +30,6 @@ if(WITH_MULTIPROCESS)
add_subdirectory(ipc)
endif()

add_subdirectory(univalue)

#=============================
# secp256k1 subtree
#=============================
Expand Down Expand Up @@ -366,7 +365,7 @@ target_link_libraries(BGL_cli
# Bitcoin Core RPC client
if(BUILD_CLI)
add_executable(BGL-cli BGL-cli.cpp)
add_windows_resources(BGL-cli BGL-cli-res.rc)
add_windows_resources(BGL-cli BUILDSYSTEM_TARGETS-cli-res.rc)
target_link_libraries(BGL-cli
core_interface
BGL_cli
Expand All @@ -375,37 +374,20 @@ if(BUILD_CLI)
libevent::core
libevent::extra
)
unset(${PROJECT_NAME}_windows)
endif()
unset(${PROJECT_NAME}_soversion)

if(SECP256K1_BUILD_BENCHMARK)
add_executable(bench bench.c)
target_link_libraries(bench secp256k1)
add_executable(bench_internal bench_internal.c)
target_link_libraries(bench_internal secp256k1_precomputed secp256k1_asm)
add_executable(bench_ecmult bench_ecmult.c)
target_link_libraries(bench_ecmult secp256k1_precomputed secp256k1_asm)
list(APPEND installable_targets BGL-cli)
endif()

if(SECP256K1_BUILD_TESTS)
add_executable(noverify_tests tests.c)
target_link_libraries(noverify_tests secp256k1_precomputed secp256k1_asm)
add_test(NAME secp256k1_noverify_tests COMMAND noverify_tests)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Coverage")
add_executable(tests tests.c)
target_compile_definitions(tests PRIVATE VERIFY)
target_link_libraries(tests secp256k1_precomputed secp256k1_asm)
add_test(NAME secp256k1_tests COMMAND tests)
endif()
endif()

if(SECP256K1_BUILD_EXHAUSTIVE_TESTS)
# Note: do not include secp256k1_precomputed in exhaustive_tests (it uses runtime-generated tables).
add_executable(exhaustive_tests tests_exhaustive.c)
target_link_libraries(exhaustive_tests secp256k1_asm)
target_compile_definitions(exhaustive_tests PRIVATE $<$<NOT:$<CONFIG:Coverage>>:VERIFY>)
add_test(NAME secp256k1_exhaustive_tests COMMAND exhaustive_tests)
if(BUILD_TX)
add_executable(BGL-tx BGL-tx.cpp)
add_windows_resources(BGL-tx BGL-tx-res.rc)
target_link_libraries(BGL-tx
core_interface
BGL_common
BGL_util
univalue
)
list(APPEND installable_targets BGL-tx)
endif()


Expand Down Expand Up @@ -443,26 +425,10 @@ if(BUILD_UTIL_CHAINSTATE)
set_target_properties(BGL-chainstate PROPERTIES
SKIP_BUILD_RPATH OFF
)
if(SECP256K1_ENABLE_MODULE_ECDH)
list(APPEND ${PROJECT_NAME}_headers "${PROJECT_SOURCE_DIR}/include/secp256k1_ecdh.h")
endif()
if(SECP256K1_ENABLE_MODULE_RECOVERY)
list(APPEND ${PROJECT_NAME}_headers "${PROJECT_SOURCE_DIR}/include/secp256k1_recovery.h")
endif()
if(SECP256K1_ENABLE_MODULE_EXTRAKEYS)
list(APPEND ${PROJECT_NAME}_headers "${PROJECT_SOURCE_DIR}/include/secp256k1_extrakeys.h")
endif()
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
list(APPEND ${PROJECT_NAME}_headers "${PROJECT_SOURCE_DIR}/include/secp256k1_schnorrsig.h")
endif()
if(SECP256K1_ENABLE_MODULE_MUSIG)
list(APPEND ${PROJECT_NAME}_headers "${PROJECT_SOURCE_DIR}/include/secp256k1_musig.h")
endif()
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
list(APPEND ${PROJECT_NAME}_headers "${PROJECT_SOURCE_DIR}/include/secp256k1_ellswift.h")
endif()
install(FILES ${${PROJECT_NAME}_headers}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
target_link_libraries(BGL-chainstate
PRIVATE
core_interface
BGLkernel
)
endif()

Expand Down
16 changes: 8 additions & 8 deletions src/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
include(GenerateHeaders)
generate_header_from_raw(data/block413567.raw benchmark::data)

add_executable(bench_bitcoin
bench_bitcoin.cpp
add_executable(bench_BGL
bench_BGL.cpp
bench.cpp
nanobench.cpp
${CMAKE_CURRENT_BINARY_DIR}/data/block413567.raw.h
Expand Down Expand Up @@ -56,15 +56,15 @@ add_executable(bench_bitcoin
xor.cpp
)

target_link_libraries(bench_bitcoin
target_link_libraries(bench_BGL
core_interface
test_util
bitcoin_node
BGL_node
Boost::headers
)

if(ENABLE_WALLET)
target_sources(bench_bitcoin
target_sources(bench_BGL
PRIVATE
coin_selection.cpp
wallet_balance.cpp
Expand All @@ -74,13 +74,13 @@ if(ENABLE_WALLET)
wallet_ismine.cpp
wallet_migration.cpp
)
target_link_libraries(bench_bitcoin bitcoin_wallet)
target_link_libraries(bench_BGL BGL_wallet)
endif()

add_test(NAME bench_sanity_check_high_priority
COMMAND bench_bitcoin -sanity-check -priority-level=high
COMMAND bench_BGL -sanity-check -priority-level=high
)

install(TARGETS bench_bitcoin
install(TARGETS bench_BGL
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
19 changes: 15 additions & 4 deletions src/cluster_linearize.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
#ifndef BGL_CLUSTER_LINEARIZE_H
#define BGL_CLUSTER_LINEARIZE_H

#include <algorithm>
#include <numeric>
#include <optional>
#include <stdint.h>
#include <vector>
#include <utility>

#include <random.h>
#include <span.h>
#include <util/feefrac.h>
#include <util/vecdeque.h>

Expand Down Expand Up @@ -767,7 +771,9 @@ class SearchCandidateFinder
// processing loop below, and during the add_fn/split_fn calls, we do not need to deal
// with the best=empty case.
if (best.feerate.IsEmpty()) best = SetInfo(m_sorted_depgraph, component);
queue.emplace_back(/*inc=*/SetInfo<SetType>{}, /*und=*/std::move(component));
queue.emplace_back(/*inc=*/SetInfo<SetType>{},
/*und=*/std::move(component),
/*pot_feerate=*/FeeFrac{});
} while (to_cover.Any());

/** Local copy of the iteration limit. */
Expand All @@ -782,7 +788,8 @@ class SearchCandidateFinder
}

/** Internal function to add an item to the queue of elements to explore if there are any
* transactions left to split on, and to update best/imp.
* transactions left to split on, possibly improving it before doing so, and to update
* best/imp.
*
* - inc: the "inc" value for the new work item (must be topological).
* - und: the "und" value for the new work item ((inc | und) must be topological).
Expand Down Expand Up @@ -854,7 +861,9 @@ class SearchCandidateFinder
// space runs out (see below), we know that no reallocation of the queue should ever
// occur.
Assume(queue.size() < queue.capacity());
queue.emplace_back(/*inc=*/std::move(inc), /*und=*/std::move(und));
queue.emplace_back(/*inc=*/std::move(inc),
/*und=*/std::move(und),
/*pot_feerate=*/std::move(pot.feerate));
};

/** Internal process function. It takes an existing work item, and splits it in two: one
Expand Down Expand Up @@ -996,6 +1005,8 @@ class SearchCandidateFinder
* @param[in] rng_seed A random number seed to control search order. This prevents peers
* from predicting exactly which clusters would be hard for us to
* linearize.
* @param[in] old_linearization An existing linearization for the cluster (which must be
* topologically valid), or empty.
* @return A pair of:
* - The resulting linearization. It is guaranteed to be at least as
* good (in the feerate diagram sense) as old_linearization.
Expand All @@ -1005,7 +1016,7 @@ class SearchCandidateFinder
* Complexity: possibly O(N * min(max_iterations + N, sqrt(2^N))) where N=depgraph.TxCount().
*/
template<typename SetType>
std::pair<std::vector<ClusterIndex>, bool> Linearize(const DepGraph<SetType>& depgraph, uint64_t max_iterations, uint64_t rng_seed) noexcept
std::pair<std::vector<ClusterIndex>, bool> Linearize(const DepGraph<SetType>& depgraph, uint64_t max_iterations, uint64_t rng_seed, Span<const ClusterIndex> old_linearization = {}) noexcept
{
Assume(old_linearization.empty() || old_linearization.size() == depgraph.TxCount());
if (depgraph.TxCount() == 0) return {{}, true};
Expand Down
18 changes: 1 addition & 17 deletions src/coins.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,6 @@ struct CCoinsCacheEntry
SetClean();
}

//! Adding a flag also requires a self reference to the pair that contains
//! this entry in the CCoinsCache map and a reference to the sentinel of the
//! flagged pair linked list.
static void AddFlags(uint8_t flags, CoinsCachePair& pair, CoinsCachePair& sentinel) noexcept
{
Assume(flags & (DIRTY | FRESH));
if (!pair.second.m_flags) {
Assume(!pair.second.m_prev && !pair.second.m_next);
pair.second.m_prev = sentinel.second.m_prev;
pair.second.m_next = &sentinel;
sentinel.second.m_prev = &pair;
pair.second.m_prev->second.m_next = &pair;
}
Assume(pair.second.m_prev && pair.second.m_next);
pair.second.m_flags |= flags;
}
static void SetDirty(CoinsCachePair& pair, CoinsCachePair& sentinel) noexcept { AddFlags(DIRTY, pair, sentinel); }
static void SetFresh(CoinsCachePair& pair, CoinsCachePair& sentinel) noexcept { AddFlags(FRESH, pair, sentinel); }

Expand Down Expand Up @@ -542,4 +526,4 @@ class CCoinsViewErrorCatcher final : public CCoinsViewBacked

};

#endif // BGL_COINS_H
#endif // BGL_COINS_H
2 changes: 1 addition & 1 deletion src/common/netif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.

#include <bitcoin-build-config.h> // IWYU pragma: keep
#include <BGL-build-config.h> // IWYU pragma: keep

#include <common/netif.h>

Expand Down
6 changes: 3 additions & 3 deletions src/common/netif.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_COMMON_NETIF_H
#define BITCOIN_COMMON_NETIF_H
#ifndef BGL_COMMON_NETIF_H
#define BGL_COMMON_NETIF_H

#include <netaddress.h>

Expand All @@ -16,4 +16,4 @@ std::optional<CNetAddr> QueryDefaultGateway(Network network);
//! Return all local non-loopback IPv4 and IPv6 network addresses.
std::vector<CNetAddr> GetLocalAddresses();

#endif // BITCOIN_COMMON_NETIF_H
#endif // BGL_COMMON_NETIF_H
2 changes: 1 addition & 1 deletion src/crc32c/src/crc32c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.

#include "crc32c/crc32c.h"
#include "../include/crc32c/crc32c.h"

#include <cstddef>
#include <cstdint>
Expand Down
Loading

0 comments on commit 2e48b28

Please sign in to comment.