mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge branch 'master' into elem-23.3.1-rc1
This commit is contained in:
commit
38cbe9282d
40 changed files with 3809 additions and 213 deletions
29
.cirrus.yml
29
.cirrus.yml
|
|
@ -58,7 +58,8 @@ macos_native_task_template: &MACOS_NATIVE_TASK_TEMPLATE
|
|||
check_clang_script:
|
||||
- clang --version
|
||||
brew_install_script:
|
||||
- brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt
|
||||
- brew install boost@1.85 libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt
|
||||
- brew link --force --overwrite boost@1.85
|
||||
<< : *MAIN_TEMPLATE
|
||||
|
||||
compute_credits_template: &CREDITS_TEMPLATE
|
||||
|
|
@ -80,8 +81,7 @@ task:
|
|||
env:
|
||||
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
|
||||
|
||||
task:
|
||||
name: "Win64 native [msvc]"
|
||||
win64_native_common: &win64_native_common
|
||||
<< : *FILTER_TEMPLATE
|
||||
windows_container:
|
||||
cpu: 4
|
||||
|
|
@ -159,6 +159,22 @@ task:
|
|||
- cd %CIRRUS_WORKING_DIR%
|
||||
- python build_msvc\msvc-autogen.py
|
||||
- msbuild build_msvc\bitcoin.sln -property:Configuration=Release -maxCpuCount -verbosity:minimal -noLogo
|
||||
|
||||
task:
|
||||
name: "Win64 native [msvc] (Short running functional tests)"
|
||||
<<: *win64_native_common
|
||||
functional_tests_script:
|
||||
# Increase the dynamic port range to the maximum allowed value to mitigate "OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted".
|
||||
# See: https://docs.microsoft.com/en-us/biztalk/technical-guides/settings-that-can-be-modified-to-improve-network-performance
|
||||
- netsh int ipv4 set dynamicport tcp start=1025 num=64511
|
||||
- netsh int ipv6 set dynamicport tcp start=1025 num=64511
|
||||
# Heavier tests are moved to a secondary task
|
||||
# Exclude feature_dbcrash and feature_fee_estimation, failing https://github.com/ElementsProject/elements/pull/1298
|
||||
- python test\functional\test_runner.py --nocleanup --ci --quiet --combinedlogslen=4000 --jobs=4 --timeout-factor=8 --extended --exclude wallet_avoidreuse,feature_trim_headers,feature_dbcrash,feature_fee_estimation
|
||||
|
||||
task:
|
||||
name: "Win64 native [msvc] (Long running functional tests + unit tests)"
|
||||
<<: *win64_native_common
|
||||
unit_tests_script:
|
||||
- src\test_elements.exe -l test_suite
|
||||
- src\bench_elements.exe > NUL
|
||||
|
|
@ -169,10 +185,9 @@ task:
|
|||
# See: https://docs.microsoft.com/en-us/biztalk/technical-guides/settings-that-can-be-modified-to-improve-network-performance
|
||||
- netsh int ipv4 set dynamicport tcp start=1025 num=64511
|
||||
- netsh int ipv6 set dynamicport tcp start=1025 num=64511
|
||||
# Exclude feature_dbcrash for now due to timeout
|
||||
# Exclude also wallet_avoidreuse due to timeout
|
||||
# Ignore failures for now, need to investigate but we really don't use native win64 builds
|
||||
- python test\functional\test_runner.py --nocleanup --ci --quiet --combinedlogslen=4000 --jobs=4 --timeout-factor=8 --extended --exclude feature_dbcrash,wallet_avoidreuse || true
|
||||
# Execute tests excluded from the main task
|
||||
# Ignore failures for now until https://github.com/ElementsProject/elements/pull/1298 is merged
|
||||
- python test\functional\test_runner.py --nocleanup --ci --quiet --combinedlogslen=4000 --jobs=4 --timeout-factor=8 wallet_avoidreuse feature_trim_headers feature_dbcrash feature_fee_estimation || true
|
||||
|
||||
task:
|
||||
name: 'ARM [unit tests, no functional tests] [bullseye]'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Elements Project blockchain platform
|
||||
====================================
|
||||
|
||||
[](https://travis-ci.org/ElementsProject/elements)
|
||||
[](https://github.com/ElementsProject/elements/releases)
|
||||
|
||||
https://elementsproject.org
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if [[ $QEMU_USER_CMD == qemu-s390* ]]; then
|
|||
fi
|
||||
|
||||
if [ "$CI_OS_NAME" == "macos" ]; then
|
||||
sudo -H pip3 install --upgrade pip
|
||||
sudo -H pip3 install --upgrade --break-system-packages pip
|
||||
# shellcheck disable=SC2086
|
||||
IN_GETOPT_BIN="$(brew --prefix gnu-getopt)/bin/getopt" ${CI_RETRY_EXE} pip3 install --user $PIP_PACKAGES
|
||||
fi
|
||||
|
|
|
|||
17
configure.ac
17
configure.ac
|
|
@ -997,22 +997,6 @@ AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64],,,
|
|||
#include <byteswap.h>
|
||||
#endif])
|
||||
|
||||
AC_MSG_CHECKING([for __builtin_clzl])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
|
||||
(void) __builtin_clzl(0);
|
||||
]])],
|
||||
[ AC_MSG_RESULT([yes]); have_clzl=yes; AC_DEFINE([HAVE_BUILTIN_CLZL], [1], [Define this symbol if you have __builtin_clzl])],
|
||||
[ AC_MSG_RESULT([no]); have_clzl=no;]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for __builtin_clzll])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
|
||||
(void) __builtin_clzll(0);
|
||||
]])],
|
||||
[ AC_MSG_RESULT([yes]); have_clzll=yes; AC_DEFINE([HAVE_BUILTIN_CLZLL], [1], [Define this symbol if you have __builtin_clzll])],
|
||||
[ AC_MSG_RESULT([no]); have_clzll=no;]
|
||||
)
|
||||
|
||||
dnl Check for malloc_info (for memory statistics information in getmemoryinfo)
|
||||
AC_MSG_CHECKING([for getmemoryinfo])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
|
||||
|
|
@ -1836,7 +1820,6 @@ AM_CONDITIONAL([LIQUID], [test "$liquid_build" = "yes"])
|
|||
|
||||
dnl for minisketch
|
||||
AM_CONDITIONAL([ENABLE_CLMUL], [test "$enable_clmul" = "yes"])
|
||||
AM_CONDITIONAL([HAVE_CLZ], [test "$have_clzl$have_clzll" = "yesyes"])
|
||||
|
||||
AC_DEFINE([CLIENT_VERSION_MAJOR], [_CLIENT_VERSION_MAJOR], [Major version])
|
||||
AC_DEFINE([CLIENT_VERSION_MINOR], [_CLIENT_VERSION_MINOR], [Minor version])
|
||||
|
|
|
|||
1702
contrib/bdb4_config/config.guess
vendored
Executable file
1702
contrib/bdb4_config/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
1864
contrib/bdb4_config/config.sub
vendored
Executable file
1864
contrib/bdb4_config/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
|
|
@ -20,6 +20,7 @@ expand_path() {
|
|||
cd "${1}" && pwd -P
|
||||
}
|
||||
|
||||
CONTRIB_BASEDIR="$(dirname "$(readlink -f "${0}")")"
|
||||
BDB_PREFIX="$(expand_path "${1}")/db4"; shift;
|
||||
BDB_VERSION='db-4.8.30.NC'
|
||||
BDB_HASH='12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef'
|
||||
|
|
@ -238,6 +239,10 @@ CONFIG_SUB_HASH='3969f7d5f6967ccc6f792401b8ef3916a1d1b1d0f0de5a4e354c95addb8b800
|
|||
rm -f "dist/config.guess"
|
||||
rm -f "dist/config.sub"
|
||||
|
||||
# git.savannah.gnu.org is extremely slow, provide a local copy of the files
|
||||
cp -fp "${CONTRIB_BASEDIR}/bdb4_config/config.guess" dist/config.guess
|
||||
cp -fp "${CONTRIB_BASEDIR}/bdb4_config/config.sub" dist/config.sub
|
||||
|
||||
http_get "${CONFIG_GUESS_URL}" dist/config.guess "${CONFIG_GUESS_HASH}"
|
||||
http_get "${CONFIG_SUB_URL}" dist/config.sub "${CONFIG_SUB_HASH}"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# List of fixed seed nodes for liquidtestnet
|
||||
|
||||
34.68.67.175:18891
|
||||
79.98.30.13:18891
|
||||
208.87.99.138:18891
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ LIBMINISKETCH_CPPFLAGS += -DHAVE_CLMUL
|
|||
MINISKETCH_LIBS += $(LIBMINISKETCH_CLMUL)
|
||||
endif
|
||||
|
||||
if HAVE_CLZ
|
||||
LIBMINISKETCH_CPPFLAGS += -DHAVE_CLZ
|
||||
endif
|
||||
|
||||
EXTRA_LIBRARIES += $(MINISKETCH_LIBS)
|
||||
|
||||
minisketch_libminisketch_clmul_a_SOURCES = $(MINISKETCH_FIELD_CLMUL_SOURCES_INT) $(MINISKETCH_FIELD_CLMUL_HEADERS_INT)
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ void AddrManImpl::Serialize(Stream& s_) const
|
|||
|
||||
int nUBuckets = ADDRMAN_NEW_BUCKET_COUNT ^ (1 << 30);
|
||||
s << nUBuckets;
|
||||
std::unordered_map<int, int> mapUnkIds;
|
||||
std::unordered_map<nid_type, int> mapUnkIds;
|
||||
int nIds = 0;
|
||||
for (const auto& entry : mapInfo) {
|
||||
mapUnkIds[entry.first] = nIds;
|
||||
|
|
@ -397,7 +397,7 @@ void AddrManImpl::Unserialize(Stream& s_)
|
|||
}
|
||||
}
|
||||
|
||||
AddrInfo* AddrManImpl::Find(const CService& addr, int* pnId)
|
||||
AddrInfo* AddrManImpl::Find(const CService& addr, nid_type* pnId)
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
|
|
@ -412,11 +412,11 @@ AddrInfo* AddrManImpl::Find(const CService& addr, int* pnId)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
AddrInfo* AddrManImpl::Create(const CAddress& addr, const CNetAddr& addrSource, int* pnId)
|
||||
AddrInfo* AddrManImpl::Create(const CAddress& addr, const CNetAddr& addrSource, nid_type* pnId)
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
int nId = nIdCount++;
|
||||
nid_type nId = nIdCount++;
|
||||
mapInfo[nId] = AddrInfo(addr, addrSource);
|
||||
mapAddr[addr] = nId;
|
||||
mapInfo[nId].nRandomPos = vRandom.size();
|
||||
|
|
@ -435,8 +435,8 @@ void AddrManImpl::SwapRandom(unsigned int nRndPos1, unsigned int nRndPos2) const
|
|||
|
||||
assert(nRndPos1 < vRandom.size() && nRndPos2 < vRandom.size());
|
||||
|
||||
int nId1 = vRandom[nRndPos1];
|
||||
int nId2 = vRandom[nRndPos2];
|
||||
nid_type nId1 = vRandom[nRndPos1];
|
||||
nid_type nId2 = vRandom[nRndPos2];
|
||||
|
||||
const auto it_1{mapInfo.find(nId1)};
|
||||
const auto it_2{mapInfo.find(nId2)};
|
||||
|
|
@ -450,7 +450,7 @@ void AddrManImpl::SwapRandom(unsigned int nRndPos1, unsigned int nRndPos2) const
|
|||
vRandom[nRndPos2] = nId1;
|
||||
}
|
||||
|
||||
void AddrManImpl::Delete(int nId)
|
||||
void AddrManImpl::Delete(nid_type nId)
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ void AddrManImpl::ClearNew(int nUBucket, int nUBucketPos)
|
|||
|
||||
// if there is an entry in the specified bucket, delete it.
|
||||
if (vvNew[nUBucket][nUBucketPos] != -1) {
|
||||
int nIdDelete = vvNew[nUBucket][nUBucketPos];
|
||||
nid_type nIdDelete = vvNew[nUBucket][nUBucketPos];
|
||||
AddrInfo& infoDelete = mapInfo[nIdDelete];
|
||||
assert(infoDelete.nRefCount > 0);
|
||||
infoDelete.nRefCount--;
|
||||
|
|
@ -484,7 +484,7 @@ void AddrManImpl::ClearNew(int nUBucket, int nUBucketPos)
|
|||
}
|
||||
}
|
||||
|
||||
void AddrManImpl::MakeTried(AddrInfo& info, int nId)
|
||||
void AddrManImpl::MakeTried(AddrInfo& info, nid_type nId)
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
|
|
@ -510,7 +510,7 @@ void AddrManImpl::MakeTried(AddrInfo& info, int nId)
|
|||
// first make space to add it (the existing tried entry there is moved to new, deleting whatever is there).
|
||||
if (vvTried[nKBucket][nKBucketPos] != -1) {
|
||||
// find an item to evict
|
||||
int nIdEvict = vvTried[nKBucket][nKBucketPos];
|
||||
nid_type nIdEvict = vvTried[nKBucket][nKBucketPos];
|
||||
assert(mapInfo.count(nIdEvict) == 1);
|
||||
AddrInfo& infoOld = mapInfo[nIdEvict];
|
||||
|
||||
|
|
@ -546,7 +546,7 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_
|
|||
if (!addr.IsRoutable())
|
||||
return false;
|
||||
|
||||
int nId;
|
||||
nid_type nId;
|
||||
AddrInfo* pinfo = Find(addr, &nId);
|
||||
|
||||
// Do not set a penalty for a source's self-announcement
|
||||
|
|
@ -618,7 +618,7 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
|
|||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
int nId;
|
||||
nid_type nId;
|
||||
|
||||
nLastGood = nTime;
|
||||
|
||||
|
|
@ -845,8 +845,8 @@ void AddrManImpl::ResolveCollisions_()
|
|||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
for (std::set<int>::iterator it = m_tried_collisions.begin(); it != m_tried_collisions.end();) {
|
||||
int id_new = *it;
|
||||
for (std::set<nid_type>::iterator it = m_tried_collisions.begin(); it != m_tried_collisions.end();) {
|
||||
nid_type id_new = *it;
|
||||
|
||||
bool erase_collision = false;
|
||||
|
||||
|
|
@ -864,7 +864,7 @@ void AddrManImpl::ResolveCollisions_()
|
|||
} else if (vvTried[tried_bucket][tried_bucket_pos] != -1) { // The position in the tried bucket is not empty
|
||||
|
||||
// Get the to-be-evicted address that is being tested
|
||||
int id_old = vvTried[tried_bucket][tried_bucket_pos];
|
||||
nid_type id_old = vvTried[tried_bucket][tried_bucket_pos];
|
||||
AddrInfo& info_old = mapInfo[id_old];
|
||||
|
||||
// Has successfully connected in last X hours
|
||||
|
|
@ -908,11 +908,11 @@ std::pair<CAddress, int64_t> AddrManImpl::SelectTriedCollision_()
|
|||
|
||||
if (m_tried_collisions.size() == 0) return {};
|
||||
|
||||
std::set<int>::iterator it = m_tried_collisions.begin();
|
||||
std::set<nid_type>::iterator it = m_tried_collisions.begin();
|
||||
|
||||
// Selects a random element from m_tried_collisions
|
||||
std::advance(it, insecure_rand.randrange(m_tried_collisions.size()));
|
||||
int id_new = *it;
|
||||
nid_type id_new = *it;
|
||||
|
||||
// If id_new not found in mapInfo remove it from m_tried_collisions
|
||||
if (mapInfo.count(id_new) != 1) {
|
||||
|
|
@ -975,14 +975,14 @@ int AddrManImpl::CheckAddrman() const
|
|||
LOG_TIME_MILLIS_WITH_CATEGORY_MSG_ONCE(
|
||||
strprintf("new %i, tried %i, total %u", nNew, nTried, vRandom.size()), BCLog::ADDRMAN);
|
||||
|
||||
std::unordered_set<int> setTried;
|
||||
std::unordered_map<int, int> mapNew;
|
||||
std::unordered_set<nid_type> setTried;
|
||||
std::unordered_map<nid_type, int> mapNew;
|
||||
|
||||
if (vRandom.size() != (size_t)(nTried + nNew))
|
||||
return -7;
|
||||
|
||||
for (const auto& entry : mapInfo) {
|
||||
int n = entry.first;
|
||||
nid_type n = entry.first;
|
||||
const AddrInfo& info = entry.second;
|
||||
if (info.fInTried) {
|
||||
if (!info.nLastSuccess)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@ static constexpr int ADDRMAN_NEW_BUCKET_COUNT{1 << ADDRMAN_NEW_BUCKET_COUNT_LOG2
|
|||
static constexpr int32_t ADDRMAN_BUCKET_SIZE_LOG2{6};
|
||||
static constexpr int ADDRMAN_BUCKET_SIZE{1 << ADDRMAN_BUCKET_SIZE_LOG2};
|
||||
|
||||
/**
|
||||
* User-defined type for the internally used nIds
|
||||
* This used to be int, making it feasible for attackers to cause an overflow,
|
||||
* see https://bitcoincore.org/en/2024/07/31/disclose-addrman-int-overflow/
|
||||
*/
|
||||
using nid_type = int64_t;
|
||||
|
||||
/**
|
||||
* Extended statistics about a CAddress
|
||||
*/
|
||||
|
|
@ -178,36 +185,36 @@ private:
|
|||
static constexpr uint8_t INCOMPATIBILITY_BASE = 32;
|
||||
|
||||
//! last used nId
|
||||
int nIdCount GUARDED_BY(cs){0};
|
||||
nid_type nIdCount GUARDED_BY(cs){0};
|
||||
|
||||
//! table with information about all nIds
|
||||
std::unordered_map<int, AddrInfo> mapInfo GUARDED_BY(cs);
|
||||
std::unordered_map<nid_type, AddrInfo> mapInfo GUARDED_BY(cs);
|
||||
|
||||
//! find an nId based on its network address and port.
|
||||
std::unordered_map<CService, int, CServiceHash> mapAddr GUARDED_BY(cs);
|
||||
std::unordered_map<CService, nid_type, CServiceHash> mapAddr GUARDED_BY(cs);
|
||||
|
||||
//! randomly-ordered vector of all nIds
|
||||
//! This is mutable because it is unobservable outside the class, so any
|
||||
//! changes to it (even in const methods) are also unobservable.
|
||||
mutable std::vector<int> vRandom GUARDED_BY(cs);
|
||||
mutable std::vector<nid_type> vRandom GUARDED_BY(cs);
|
||||
|
||||
// number of "tried" entries
|
||||
int nTried GUARDED_BY(cs){0};
|
||||
|
||||
//! list of "tried" buckets
|
||||
int vvTried[ADDRMAN_TRIED_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
|
||||
nid_type vvTried[ADDRMAN_TRIED_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
|
||||
|
||||
//! number of (unique) "new" entries
|
||||
int nNew GUARDED_BY(cs){0};
|
||||
|
||||
//! list of "new" buckets
|
||||
int vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
|
||||
nid_type vvNew[ADDRMAN_NEW_BUCKET_COUNT][ADDRMAN_BUCKET_SIZE] GUARDED_BY(cs);
|
||||
|
||||
//! last time Good was called (memory only). Initially set to 1 so that "never" is strictly worse.
|
||||
int64_t nLastGood GUARDED_BY(cs){1};
|
||||
|
||||
//! Holds addrs inserted into tried table that collide with existing entries. Test-before-evict discipline used to resolve these collisions.
|
||||
std::set<int> m_tried_collisions;
|
||||
std::set<nid_type> m_tried_collisions;
|
||||
|
||||
/** Perform consistency checks every m_consistency_check_ratio operations (if non-zero). */
|
||||
const int32_t m_consistency_check_ratio;
|
||||
|
|
@ -229,22 +236,22 @@ private:
|
|||
const std::vector<bool> m_asmap;
|
||||
|
||||
//! Find an entry.
|
||||
AddrInfo* Find(const CService& addr, int* pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
AddrInfo* Find(const CService& addr, nid_type* pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Create a new entry and add it to the internal data structures mapInfo, mapAddr and vRandom.
|
||||
AddrInfo* Create(const CAddress& addr, const CNetAddr& addrSource, int* pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
AddrInfo* Create(const CAddress& addr, const CNetAddr& addrSource, nid_type* pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Swap two elements in vRandom.
|
||||
void SwapRandom(unsigned int nRandomPos1, unsigned int nRandomPos2) const EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Delete an entry. It must not be in tried, and have refcount 0.
|
||||
void Delete(int nId) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
void Delete(nid_type nId) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Clear a position in a "new" table. This is the only place where entries are actually deleted.
|
||||
void ClearNew(int nUBucket, int nUBucketPos) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
//! Move an entry from the "new" table(s) to the "tried" table
|
||||
void MakeTried(AddrInfo& info, int nId) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
void MakeTried(AddrInfo& info, nid_type nId) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
/** Attempt to add a single address to addrman's new table.
|
||||
* @see AddrMan::Add() for parameters. */
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
|
|||
argsman.AddArg("-con_mandatorycoinbase", "All non-zero valued coinbase outputs must go to this scriptPubKey, if set.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_blocksubsidy", "Defines the amount of block subsidy to start with, at genesis block, in satoshis.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_connect_genesis_outputs", "Connect outputs in genesis block to utxo database.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_elementsmode", "Use Elements-like instead of Core-like witness encoding. This is required for CA/CT. (default: true)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_blockheightinheader", "Whether the chain includes the block height directly in the header, for easier validation of block height in low-resource environments. (default: true)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-con_elementsmode", "Use Elements-like instead of Core-like witness encoding. This is required for CA/CT. (default: 1)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_blockheightinheader", "Whether the chain includes the block height directly in the header, for easier validation of block height in low-resource environments. (default: 1)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-con_genesis_style=<style>", "Use genesis style <style> (default: elements). Results in genesis block compatibility with various networks. Allowed values: elements, bitcoin", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_signed_blocks", "Signed blockchain. Uses input of `-signblockscript` to define what signatures are necessary to solve it.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-signblockscript", "Signed blockchain enumberance. Only active when `-con_signed_blocks` set to true.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
|
|
@ -56,7 +56,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
|
|||
argsman.AddArg("-pak", "Sets the 'first extension space' field to the pak entries ala pre-dynamic federations. Only used for testing in custom chains.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-multi_data_permitted", "Allow relay of multiple OP_RETURN outputs. (default: -enforce_pak)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_csv_deploy_start", "Starting height for CSV deployment. (default: -1, which means ACTIVE from genesis)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_dyna_deploy_signal", "Whether to signal for the Dynamic Federations deployment (default: true).", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-con_dyna_deploy_signal", "Whether to signal for the Dynamic Federations deployment (default: 1).", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-dynamic_epoch_length", "Per-chain parameter that sets how many blocks dynamic federation voting and enforcement are in effect for.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-total_valid_epochs", "Per-chain parameter that sets how long a particular fedpegscript is in effect for.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-evbparams=deployment:start:end:period:threshold", "Use given start/end times for specified version bits deployment (regtest or custom only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::ELEMENTS);
|
||||
|
|
|
|||
|
|
@ -720,6 +720,6 @@ static uint8_t pnSeed6_liquidv1[] = {
|
|||
|
||||
static uint8_t pnSeed6_liquidtestnet[] = {
|
||||
0x01,0x04,0x22,0x44,0x43,0xaf,0x49,0xcb,
|
||||
0x01,0x04,0x4f,0x62,0x1e,0x0d,0x49,0xcb,
|
||||
0x01,0x04,0xd0,0x57,0x63,0x8a,0x49,0xcb,
|
||||
};
|
||||
#endif // BITCOIN_CHAINPARAMSSEEDS_H
|
||||
|
|
|
|||
|
|
@ -151,9 +151,9 @@ void BaseIndex::ThreadSync()
|
|||
const CBlockIndex* pindex_next = NextSyncBlock(pindex, m_chainstate->m_chain);
|
||||
if (!pindex_next) {
|
||||
m_best_block_index = pindex;
|
||||
m_synced = true;
|
||||
// No need to handle errors in Commit. See rationale above.
|
||||
Commit();
|
||||
m_synced = true;
|
||||
break;
|
||||
}
|
||||
if (pindex_next->pprev != pindex && !Rewind(pindex, pindex_next->pprev)) {
|
||||
|
|
|
|||
10
src/init.cpp
10
src/init.cpp
|
|
@ -238,9 +238,9 @@ void Shutdown(NodeContext& node)
|
|||
|
||||
// After everything has been shut down, but before things get flushed, stop the
|
||||
// CScheduler/checkqueue, scheduler and load block thread.
|
||||
if (node.chainman && node.chainman->m_load_block.joinable()) node.chainman->m_load_block.join();
|
||||
if (node.scheduler) node.scheduler->stop();
|
||||
if (node.reverification_scheduler) node.reverification_scheduler->stop();
|
||||
if (node.chainman && node.chainman->m_load_block.joinable()) node.chainman->m_load_block.join();
|
||||
StopScriptCheckWorkerThreads();
|
||||
|
||||
// After the threads that potentially access these pointers have been stopped,
|
||||
|
|
@ -447,7 +447,7 @@ void SetupServerArgs(ArgsManager& argsman)
|
|||
hidden_args.emplace_back("-sysperms");
|
||||
#endif
|
||||
argsman.AddArg("-txindex", strprintf("Maintain a full transaction index, used by the getrawtransaction rpc call (default: %u)", DEFAULT_TXINDEX), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
||||
argsman.AddArg("-trim_headers", strprintf("Trim old headers in memory (by default older than 2 epochs), removing blocksigning and dynafed-related fields. Saves memory, but blocks us from serving blocks or headers to peers, and removes trimmed fields from some JSON RPC outputs. (default: false)"), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
||||
argsman.AddArg("-trim_headers", strprintf("Trim old headers in memory (by default older than 2 epochs), removing blocksigning and dynafed-related fields. Saves memory, but blocks us from serving blocks or headers to peers, and removes trimmed fields from some JSON RPC outputs. (default: 0)"), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
||||
argsman.AddArg("-blockfilterindex=<type>",
|
||||
strprintf("Maintain an index of compact filters by block (default: %s, values: %s).", DEFAULT_BLOCKFILTERINDEX, ListBlockFilterTypes()) +
|
||||
" If <type> is not supplied or if <type> = 1, indexes for all known types are enabled.",
|
||||
|
|
@ -622,7 +622,7 @@ void SetupServerArgs(ArgsManager& argsman)
|
|||
std::vector<std::string> elements_hidden_args = {"-con_fpowallowmindifficultyblocks", "-con_fpownoretargeting", "-con_nsubsidyhalvinginterval", "-con_bip16exception", "-con_bip34height", "-con_bip65height", "-con_bip66height", "-con_npowtargettimespan", "-con_npowtargetspacing", "-con_nrulechangeactivationthreshold", "-con_nminerconfirmationwindow", "-con_powlimit", "-con_bip34hash", "-con_nminimumchainwork", "-con_defaultassumevalid", "-npruneafterheight", "-fdefaultconsistencychecks", "-fmineblocksondemand", "-fallback_fee_enabled", "-pchmessagestart"};
|
||||
|
||||
argsman.AddArg("-initialfreecoins", strprintf("The amount of OP_TRUE coins created in the genesis block. Primarily for testing. (default: %d)", 0), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
|
||||
argsman.AddArg("-validatepegin", "Validate peg-in claims. An RPC connection will be attempted to the trusted mainchain daemon using the `mainchain*` settings below. All functionaries must run this enabled. (default: true if chain has federated peg)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-validatepegin", "Validate peg-in claims. An RPC connection will be attempted to the trusted mainchain daemon using the `mainchain*` settings below. All functionaries must run this enabled. (default: 1 if chain has federated peg)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-mainchainrpchost=<host>", "The address which the daemon will try to connect to the trusted mainchain daemon to validate peg-ins, if enabled. (default: 127.0.0.1)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-mainchainrpcport=<n>", strprintf("The port which the daemon will try to connect to the trusted mainchain daemon to validate peg-ins, if enabled. (default: %u)", defaultBaseParams->MainchainRPCPort()), ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
|
||||
argsman.AddArg("-mainchainrpcuser=<user>", "The rpc username that the daemon will use to connect to the trusted mainchain daemon to validate peg-ins, if enabled. (default: cookie auth)", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::ELEMENTS);
|
||||
|
|
@ -640,8 +640,8 @@ void SetupServerArgs(ArgsManager& argsman)
|
|||
argsman.AddArg("-initialreissuancetokens=<n>", "The amount of reissuance tokens created in the genesis block. (default: 0)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-ct_bits", strprintf("The default number of hiding bits in a rangeproof. Will be exceeded to cover amounts exceeding the maximum hiding value. (default: %d)", 52), ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-ct_exponent", strprintf("The hiding exponent. (default: %s)", 0), ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-acceptdiscountct", "Accept discounted fees for Confidential Transactions (default: true in liquidtestnet and liquidv1, false otherwise)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-creatediscountct", "Create Confidential Transactions with discounted fees (default: false). Setting this to true will also set 'acceptdiscountct' to true.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-acceptdiscountct", "Accept discounted fees for Confidential Transactions (default: 1 in liquidtestnet and liquidv1, 0 otherwise)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-creatediscountct", "Create Confidential Transactions with discounted fees (default: 0). Setting this to 1 will also set 'acceptdiscountct' to 1.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
|
||||
#if defined(USE_SYSCALL_SANDBOX)
|
||||
argsman.AddArg("-sandbox=<mode>", "Use the experimental syscall sandbox in the specified mode (-sandbox=log-and-abort or -sandbox=abort). Allow only expected syscalls to be used by bitcoind. Note that this is an experimental new feature that may cause bitcoind to exit or crash unexpectedly: use with caution. In the \"log-and-abort\" mode the invocation of an unexpected syscall results in a debug handler being invoked which will log the incident and terminate the program (without executing the unexpected syscall). In the \"abort\" mode the invocation of an unexpected syscall results in the entire process being killed immediately by the kernel without executing the unexpected syscall.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
||||
|
|
|
|||
|
|
@ -36,17 +36,6 @@ env_matrix_snippet: &ENV_MATRIX_VALGRIND
|
|||
TESTRUNS: 1
|
||||
BUILD:
|
||||
|
||||
env_matrix_snippet: &ENV_MATRIX_SAN
|
||||
- env:
|
||||
ENABLE_FIELDS: 28
|
||||
- env:
|
||||
BUILD: distcheck
|
||||
- env:
|
||||
CXXFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
|
||||
LDFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
|
||||
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
|
||||
BENCH: no
|
||||
|
||||
env_matrix_snippet: &ENV_MATRIX_SAN_VALGRIND
|
||||
- env:
|
||||
ENABLE_FIELDS: "11,64,37"
|
||||
|
|
@ -72,9 +61,9 @@ task:
|
|||
<< : *ENV_MATRIX_SAN_VALGRIND
|
||||
matrix:
|
||||
- env:
|
||||
CC: gcc
|
||||
CXX: g++
|
||||
- env:
|
||||
CC: clang
|
||||
CXX: clang++ -gdwarf-4
|
||||
<< : *MERGE_BASE
|
||||
test_script:
|
||||
- ./ci/cirrus.sh
|
||||
|
|
@ -92,30 +81,45 @@ task:
|
|||
<< : *ENV_MATRIX_VALGRIND
|
||||
matrix:
|
||||
- env:
|
||||
CC: i686-linux-gnu-gcc
|
||||
CXX: i686-linux-gnu-g++
|
||||
- env:
|
||||
CC: clang --target=i686-pc-linux-gnu -isystem /usr/i686-linux-gnu/include
|
||||
CXX: clang++ --target=i686-linux-gnu -gdwarf-4
|
||||
CXXFLAGS: -g -O2 -isystem /usr/i686-linux-gnu/include -isystem /usr/i686-linux-gnu/include/c++/10/i686-linux-gnu
|
||||
test_script:
|
||||
- ./ci/cirrus.sh
|
||||
<< : *CAT_LOGS
|
||||
|
||||
task:
|
||||
name: "x86_64: macOS Catalina"
|
||||
name: "arm64: macOS Monterey"
|
||||
macos_instance:
|
||||
image: catalina-base
|
||||
image: ghcr.io/cirruslabs/macos-monterey-base:latest
|
||||
env:
|
||||
# Cirrus gives us a fixed number of 12 virtual CPUs.
|
||||
MAKEFLAGS: -j13
|
||||
matrix:
|
||||
<< : *ENV_MATRIX_SAN
|
||||
# Cirrus gives us a fixed number of 4 virtual CPUs.
|
||||
MAKEFLAGS: -j5
|
||||
matrix:
|
||||
- env:
|
||||
CC: gcc-9
|
||||
CXX: g++-11
|
||||
# Homebrew's gcc for arm64 has no libubsan.
|
||||
matrix:
|
||||
- env:
|
||||
ENABLE_FIELDS: 28
|
||||
- env:
|
||||
BUILD: distcheck
|
||||
- env:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
matrix:
|
||||
- env:
|
||||
ENABLE_FIELDS: 28
|
||||
- env:
|
||||
BUILD: distcheck
|
||||
- env:
|
||||
CXXFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
|
||||
LDFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
|
||||
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
|
||||
BENCH: no
|
||||
brew_script:
|
||||
- brew update
|
||||
- brew install automake libtool gcc@9
|
||||
- brew install automake libtool gcc@11
|
||||
<< : *MERGE_BASE
|
||||
test_script:
|
||||
- ./ci/cirrus.sh
|
||||
|
|
@ -128,13 +132,11 @@ task:
|
|||
cpu: 4
|
||||
memory: 2G
|
||||
env:
|
||||
EXEC_CMD: qemu-s390x -L /usr/s390x-linux-gnu
|
||||
EXEC_CMD: qemu-s390x
|
||||
HOST: s390x-linux-gnu
|
||||
BUILD:
|
||||
<< : *MERGE_BASE
|
||||
test_script:
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=27008
|
||||
- rm /etc/ld.so.cache
|
||||
- ./ci/cirrus.sh
|
||||
<< : *CAT_LOGS
|
||||
|
||||
|
|
@ -146,6 +148,7 @@ task:
|
|||
memory: 2G
|
||||
env:
|
||||
EXEC_CMD: wine
|
||||
EXEC_EXT: .exe
|
||||
HOST: x86_64-w64-mingw32
|
||||
BUILD:
|
||||
<< : *MERGE_BASE
|
||||
|
|
|
|||
|
|
@ -203,8 +203,8 @@ Some improvements that are still TODO:
|
|||
* <a name="myfootnote4">[4]</a> Bhaskar Biswas, Vincent Herbert. *Efficient Root Finding of Polynomials over Fields of Characteristic 2.* 2009. hal-00626997. [[URL]](https://hal.archives-ouvertes.fr/hal-00626997) [[PDF]](https://hal.archives-ouvertes.fr/hal-00626997/document)
|
||||
* <a name="myfootnote6">[6]</a> Eppstein, David, Michael T. Goodrich, Frank Uyeda, and George Varghese. *What's the difference?: efficient set reconciliation without prior context.* ACM SIGCOMM Computer Communication Review, vol. 41, no. 4, pp. 218-229. ACM, 2011. [[PDF]](https://www.ics.uci.edu/~eppstein/pubs/EppGooUye-SIGCOMM-11.pdf)
|
||||
* <a name="myfootnote7">[7]</a> Goodrich, Michael T. and Michael Mitzenmacher. *Invertible bloom lookup tables.* 2011 49th Annual Allerton Conference on Communication, Control, and Computing (Allerton) (2011): 792-799. [[PDF]](https://arxiv.org/pdf/1101.2245.pdf)
|
||||
* <a name="myfootnote8">[8]</a> Maxwell, Gregory F. *[Blocksonly mode BW savings, the limits of efficient block xfer, and better relay](https://bitcointalk.org/index.php?topic=1377345.0)* Bitcointalk 2016, *[Technical notes on mempool synchronizing relay](https://people.xiph.org/~greg/mempool_sync_relay.txt)* #bitcoin-wizards 2016.
|
||||
* <a name="myfootnote9">[9]</a> Maxwell, Gregory F. *[Block network coding](https://en.bitcoin.it/wiki/User:Gmaxwell/block_network_coding)* Bitcoin Wiki 2014, *[Technical notes on efficient block xfer](https://people.xiph.org/~greg/efficient.block.xfer.txt)* #bitcoin-wizards 2015.
|
||||
* <a name="myfootnote8">[8]</a> Maxwell, Gregory F. *[Blocksonly mode BW savings, the limits of efficient block xfer, and better relay](https://bitcointalk.org/index.php?topic=1377345.0)* Bitcointalk 2016, *[Technical notes on mempool synchronizing relay](https://nt4tn.net/tech-notes/2016.mempool_sync_relay.txt)* #bitcoin-wizards 2016.
|
||||
* <a name="myfootnote9">[9]</a> Maxwell, Gregory F. *[Block network coding](https://en.bitcoin.it/wiki/User:Gmaxwell/block_network_coding)* Bitcoin Wiki 2014, *[Technical notes on efficient block xfer](https://nt4tn.net/tech-notes/201512.efficient.block.xfer.txt)* #bitcoin-wizards 2015.
|
||||
* <a name="myfootnote10">[10]</a> Ruffing, Tim, Moreno-Sanchez, Pedro, Aniket, Kate, *P2P Mixing and Unlinkable Bitcoin Transactions* NDSS Symposium 2017 [[URL]](https://eprint.iacr.org/2016/824) [[PDF]](https://eprint.iacr.org/2016/824.pdf)
|
||||
* <a name="myfootnote11">[11]</a> Y. Misky, A. Trachtenberg, R. Zippel. *Set Reconciliation with Nearly Optimal Communication Complexity.* Cornell University, 2000. [[URL]](https://ecommons.cornell.edu/handle/1813/5803) [[PDF]](https://ecommons.cornell.edu/bitstream/handle/1813/5803/2000-1813.pdf)
|
||||
* <a name="myfootnote12">[12]</a> Itoh, Toshiya, and Shigeo Tsujii. "A fast algorithm for computing multiplicative inverses in GF (2m) using normal bases." Information and computation 78, no. 3 (1988): 171-177. [[URL]](https://www.sciencedirect.com/science/article/pii/0890540188900247)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export LC_ALL=C
|
|||
|
||||
env >> test_env.log
|
||||
|
||||
$CC -v || true
|
||||
$CXX -v || true
|
||||
valgrind --version || true
|
||||
|
||||
./autogen.sh
|
||||
|
|
@ -32,10 +32,10 @@ then
|
|||
fi
|
||||
|
||||
if [ -n "$EXEC_CMD" ]; then
|
||||
$EXEC_CMD ./test $TESTRUNS
|
||||
$EXEC_CMD ./test-verify $TESTRUNS
|
||||
$EXEC_CMD "./test$EXEC_EXT" $TESTRUNS
|
||||
$EXEC_CMD "./test-verify$EXEC_EXT" $TESTRUNS
|
||||
fi
|
||||
|
||||
if [ "$BENCH" = "yes" ]; then
|
||||
$EXEC_CMD ./bench
|
||||
$EXEC_CMD "./bench$EXEC_EXT"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ RUN apt-get update
|
|||
RUN apt-get install --no-install-recommends --no-upgrade -y \
|
||||
git ca-certificates \
|
||||
make automake libtool pkg-config dpkg-dev valgrind qemu-user \
|
||||
gcc g++ clang libc6-dbg \
|
||||
gcc g++ clang libclang-rt-dev libc6-dbg \
|
||||
gcc-i686-linux-gnu g++-i686-linux-gnu libc6-dev-i386-cross libc6-dbg:i386 \
|
||||
g++-s390x-linux-gnu gcc-s390x-linux-gnu libc6-dev-s390x-cross libc6-dbg:s390x \
|
||||
wine g++-mingw-w64-x86-64
|
||||
g++-s390x-linux-gnu libstdc++6:s390x gcc-s390x-linux-gnu libc6-dev-s390x-cross libc6-dbg:s390x \
|
||||
wine wine64 g++-mingw-w64-x86-64
|
||||
|
||||
# Run a dummy command in wine to make it set up configuration
|
||||
RUN wine true || true
|
||||
|
|
|
|||
|
|
@ -104,11 +104,6 @@ esac
|
|||
AX_CHECK_COMPILE_FLAG([-Wall],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[CXXFLAGS="$CXXFLAGS -fvisibility=hidden"],[],[$CXXFLAG_WERROR])
|
||||
|
||||
## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
|
||||
## unknown options if any other warning is produced. Test the -Wfoo case, and
|
||||
## set the -Wno-foo case if it works.
|
||||
AX_CHECK_COMPILE_FLAG([-Wshift-count-overflow],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-shift-count-overflow"],,[[$CXXFLAG_WERROR]])
|
||||
|
||||
if test "x$use_ccache" != "xno"; then
|
||||
AC_MSG_CHECKING(if ccache should be used)
|
||||
if test x$CCACHE = x; then
|
||||
|
|
@ -119,14 +114,10 @@ if test "x$use_ccache" != "xno"; then
|
|||
fi
|
||||
else
|
||||
use_ccache=yes
|
||||
CC="$ac_cv_path_CCACHE $CC"
|
||||
CXX="$ac_cv_path_CCACHE $CXX"
|
||||
fi
|
||||
AC_MSG_RESULT($use_ccache)
|
||||
fi
|
||||
if test "x$use_ccache" = "xyes"; then
|
||||
AX_CHECK_COMPILE_FLAG([-Qunused-arguments],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Qunused-arguments"],,[[$CXXFLAG_WERROR]])
|
||||
fi
|
||||
|
||||
VERIFY_DEFINES=-DMINISKETCH_VERIFY
|
||||
RELEASE_DEFINES=
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <compat.h>
|
||||
# include <BaseTsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -62,13 +62,11 @@ int main(int argc, char** argv) {
|
|||
if (!states[0]) {
|
||||
printf(" -\t");
|
||||
} else {
|
||||
double total = 0.0;
|
||||
for (auto& state : states) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
minisketch_decode(state, 2 * syndromes, roots.data());
|
||||
auto stop = std::chrono::steady_clock::now();
|
||||
std::chrono::duration<double> dur(stop - start);
|
||||
total += dur.count();
|
||||
benches.push_back(dur.count());
|
||||
}
|
||||
std::sort(benches.begin(), benches.end());
|
||||
|
|
@ -98,7 +96,6 @@ int main(int argc, char** argv) {
|
|||
if (!states[0]) {
|
||||
printf(" -\t");
|
||||
} else {
|
||||
double total = 0.0;
|
||||
for (auto& state : states) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
for (auto val : data) {
|
||||
|
|
@ -106,7 +103,6 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
auto stop = std::chrono::steady_clock::now();
|
||||
std::chrono::duration<double> dur(stop - start);
|
||||
total += dur.count();
|
||||
benches.push_back(dur.count());
|
||||
}
|
||||
std::sort(benches.begin(), benches.end());
|
||||
|
|
|
|||
|
|
@ -7,13 +7,16 @@
|
|||
#ifndef _MINISKETCH_INT_UTILS_H_
|
||||
#define _MINISKETCH_INT_UTILS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L
|
||||
# include <bit>
|
||||
#elif defined(_MSC_VER)
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -54,11 +57,10 @@ class BitWriter {
|
|||
int offset = 0;
|
||||
unsigned char* out;
|
||||
|
||||
public:
|
||||
BitWriter(unsigned char* output) : out(output) {}
|
||||
|
||||
template<int BITS, typename I>
|
||||
inline void Write(I val) {
|
||||
inline void WriteInner(I val) {
|
||||
// We right shift by up to 8 bits below. Verify that's well defined for the type I.
|
||||
static_assert(std::numeric_limits<I>::digits > 8, "BitWriter::WriteInner needs I > 8 bits");
|
||||
int bits = BITS;
|
||||
if (bits + offset >= 8) {
|
||||
state |= ((val & ((I(1) << (8 - offset)) - 1)) << offset);
|
||||
|
|
@ -77,6 +79,19 @@ public:
|
|||
offset += bits;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
BitWriter(unsigned char* output) : out(output) {}
|
||||
|
||||
template<int BITS, typename I>
|
||||
inline void Write(I val) {
|
||||
// If I is smaller than an unsigned int, invoke WriteInner with argument converted to unsigned.
|
||||
using compute_type = typename std::conditional<
|
||||
(std::numeric_limits<I>::digits < std::numeric_limits<unsigned>::digits),
|
||||
unsigned, I>::type;
|
||||
return WriteInner<BITS, compute_type>(val);
|
||||
}
|
||||
|
||||
inline void Flush() {
|
||||
if (offset) {
|
||||
*(out++) = state;
|
||||
|
|
@ -129,17 +144,11 @@ constexpr inline I Mask() { return ((I((I(-1)) << (std::numeric_limits<I>::digit
|
|||
/** Compute the smallest power of two that is larger than val. */
|
||||
template<typename I>
|
||||
static inline int CountBits(I val, int max) {
|
||||
#ifdef HAVE_CLZ
|
||||
#if defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L
|
||||
// c++20 impl
|
||||
(void)max;
|
||||
if (val == 0) return 0;
|
||||
if (std::numeric_limits<unsigned>::digits >= std::numeric_limits<I>::digits) {
|
||||
return std::numeric_limits<unsigned>::digits - __builtin_clz(val);
|
||||
} else if (std::numeric_limits<unsigned long>::digits >= std::numeric_limits<I>::digits) {
|
||||
return std::numeric_limits<unsigned long>::digits - __builtin_clzl(val);
|
||||
} else {
|
||||
return std::numeric_limits<unsigned long long>::digits - __builtin_clzll(val);
|
||||
}
|
||||
#elif _MSC_VER
|
||||
return std::bit_width(val);
|
||||
#elif defined(_MSC_VER)
|
||||
(void)max;
|
||||
unsigned long index;
|
||||
unsigned char ret;
|
||||
|
|
@ -149,7 +158,17 @@ static inline int CountBits(I val, int max) {
|
|||
ret = _BitScanReverse64(&index, val);
|
||||
}
|
||||
if (!ret) return 0;
|
||||
return index;
|
||||
return index + 1;
|
||||
#elif HAVE_CLZ
|
||||
(void)max;
|
||||
if (val == 0) return 0;
|
||||
if (std::numeric_limits<unsigned>::digits >= std::numeric_limits<I>::digits) {
|
||||
return std::numeric_limits<unsigned>::digits - __builtin_clz(val);
|
||||
} else if (std::numeric_limits<unsigned long>::digits >= std::numeric_limits<I>::digits) {
|
||||
return std::numeric_limits<unsigned long>::digits - __builtin_clzl(val);
|
||||
} else {
|
||||
return std::numeric_limits<unsigned long long>::digits - __builtin_clzll(val);
|
||||
}
|
||||
#else
|
||||
while (max && (val >> (max - 1) == 0)) --max;
|
||||
return max;
|
||||
|
|
@ -175,6 +194,7 @@ public:
|
|||
}
|
||||
|
||||
static constexpr inline bool IsZero(I a) { return a == 0; }
|
||||
static constexpr inline bool IsOne(I a) { return a == 1; }
|
||||
static constexpr inline I Mask(I val) { return val & MASK; }
|
||||
static constexpr inline I Shift(I val, int bits) { return ((val << bits) & MASK); }
|
||||
static constexpr inline I UnsafeShift(I val, int bits) { return (val << bits); }
|
||||
|
|
@ -233,7 +253,7 @@ template<typename I, int N, typename L, typename F> inline constexpr I GFMul(con
|
|||
template<typename I, typename F, int BITS, uint32_t MOD>
|
||||
inline I InvExtGCD(I x)
|
||||
{
|
||||
if (F::IsZero(x)) return x;
|
||||
if (F::IsZero(x) || F::IsOne(x)) return x;
|
||||
I t(0), newt(1);
|
||||
I r(MOD), newr = x;
|
||||
int rlen = BITS + 1, newrlen = F::Bits(newr, BITS);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <limits>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../include/minisketch.h"
|
||||
|
|
|
|||
|
|
@ -2226,7 +2226,7 @@ std::vector<AddedNodeInfo> CConnman::GetAddedNodeInfo() const
|
|||
}
|
||||
|
||||
for (const std::string& strAddNode : lAddresses) {
|
||||
CService service(LookupNumeric(strAddNode, Params().GetDefaultPort(strAddNode)));
|
||||
CService service{MaybeFlipIPv6toCJDNS(LookupNumeric(strAddNode, Params().GetDefaultPort(strAddNode)))};
|
||||
AddedNodeInfo addedNode{strAddNode, CService(), false, false};
|
||||
if (service.IsValid()) {
|
||||
// strAddNode is an IP:port
|
||||
|
|
|
|||
|
|
@ -733,7 +733,7 @@ class NetEventsInterface
|
|||
{
|
||||
public:
|
||||
/** Initialize a peer (setup state, queue any initial messages) */
|
||||
virtual void InitializeNode(CNode* pnode) = 0;
|
||||
virtual void InitializeNode(const CNode* pnode) = 0;
|
||||
|
||||
/** Handle removal of a peer (clear state) */
|
||||
virtual void FinalizeNode(const CNode& node) = 0;
|
||||
|
|
|
|||
|
|
@ -222,6 +222,10 @@ struct Peer {
|
|||
* Most peers use headers-first syncing, which doesn't use this mechanism */
|
||||
uint256 m_continuation_block GUARDED_BY(m_block_inv_mutex) {};
|
||||
|
||||
Mutex m_msgproc_mutex;
|
||||
/** Set to true once initial VERSION message was sent (only relevant for outbound peers). */
|
||||
bool m_outbound_version_message_sent GUARDED_BY(m_msgproc_mutex){false};
|
||||
|
||||
/** This peer's reported block height when we connected */
|
||||
std::atomic<int> m_starting_height{-1};
|
||||
|
||||
|
|
@ -312,7 +316,7 @@ public:
|
|||
void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock) override;
|
||||
|
||||
/** Implement NetEventsInterface */
|
||||
void InitializeNode(CNode* pnode) override;
|
||||
void InitializeNode(const CNode* pnode) override;
|
||||
void FinalizeNode(const CNode& node) override;
|
||||
bool ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt) override;
|
||||
bool SendMessages(CNode* pto) override EXCLUSIVE_LOCKS_REQUIRED(pto->cs_sendProcessing);
|
||||
|
|
@ -1198,7 +1202,7 @@ void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds)
|
|||
if (state) state->m_last_block_announcement = time_in_seconds;
|
||||
}
|
||||
|
||||
void PeerManagerImpl::InitializeNode(CNode *pnode)
|
||||
void PeerManagerImpl::InitializeNode(const CNode *pnode)
|
||||
{
|
||||
NodeId nodeid = pnode->GetId();
|
||||
{
|
||||
|
|
@ -1211,9 +1215,6 @@ void PeerManagerImpl::InitializeNode(CNode *pnode)
|
|||
LOCK(m_peer_mutex);
|
||||
m_peer_map.emplace_hint(m_peer_map.end(), nodeid, std::move(peer));
|
||||
}
|
||||
if (!pnode->IsInboundConn()) {
|
||||
PushNodeVersion(*pnode);
|
||||
}
|
||||
}
|
||||
|
||||
void PeerManagerImpl::ReattemptInitialBroadcast(CScheduler& scheduler)
|
||||
|
|
@ -4215,6 +4216,10 @@ bool PeerManagerImpl::ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt
|
|||
PeerRef peer = GetPeerRef(pfrom->GetId());
|
||||
if (peer == nullptr) return false;
|
||||
|
||||
// For outbound connections, ensure that the initial VERSION message
|
||||
// has been sent first before processing any incoming messages
|
||||
if (!pfrom->IsInboundConn() && WITH_LOCK(peer->m_msgproc_mutex, return !peer->m_outbound_version_message_sent)) return false;
|
||||
|
||||
{
|
||||
LOCK(peer->m_getdata_requests_mutex);
|
||||
if (!peer->m_getdata_requests.empty()) {
|
||||
|
|
@ -4674,6 +4679,13 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
|||
// disconnect misbehaving peers even before the version handshake is complete.
|
||||
if (MaybeDiscourageAndDisconnect(*pto, *peer)) return true;
|
||||
|
||||
// Initiate version handshake for outbound connections
|
||||
if (!pto->IsInboundConn() && WITH_LOCK(peer->m_msgproc_mutex, return !peer->m_outbound_version_message_sent)) {
|
||||
LOCK(peer->m_msgproc_mutex);
|
||||
PushNodeVersion(*pto);
|
||||
peer->m_outbound_version_message_sent = true;
|
||||
}
|
||||
|
||||
// Don't send anything until the version handshake is complete
|
||||
if (!pto->fSuccessfullyConnected || pto->fDisconnect)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -279,12 +279,12 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* tip, const CBlockIn
|
|||
const CTxUndo* txundo = (have_undo && i > 0) ? &blockUndo.vtxundo.at(i - 1) : nullptr;
|
||||
UniValue objTx(UniValue::VOBJ);
|
||||
TxToUniv(*tx, uint256(), objTx, true, RPCSerializationFlags(), txundo, verbosity);
|
||||
txs.push_back(objTx);
|
||||
txs.push_back(std::move(objTx));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
result.pushKV("tx", txs);
|
||||
result.pushKV("tx", std::move(txs));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,14 +113,12 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
|||
{ "combinerawtransaction", 0, "txs" },
|
||||
{ "fundrawtransaction", 1, "options" },
|
||||
{ "fundrawtransaction", 2, "iswitness" },
|
||||
{ "fundrawtransaction", 3, "solving_data" },
|
||||
{ "walletcreatefundedpsbt", 0, "inputs" },
|
||||
{ "walletcreatefundedpsbt", 1, "outputs" },
|
||||
{ "walletcreatefundedpsbt", 2, "locktime" },
|
||||
{ "walletcreatefundedpsbt", 3, "options" },
|
||||
{ "walletcreatefundedpsbt", 4, "bip32derivs" },
|
||||
{ "walletcreatefundedpsbt", 5, "solving_data" },
|
||||
{ "walletcreatefundedpsbt", 6, "psbt_version" },
|
||||
{ "walletcreatefundedpsbt", 5, "psbt_version" },
|
||||
{ "walletprocesspsbt", 1, "sign" },
|
||||
{ "walletprocesspsbt", 3, "bip32derivs" },
|
||||
{ "walletprocesspsbt", 4, "finalize" },
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ static fs::path GetAuthCookieFile(bool temp=false)
|
|||
return AbsPathForConfigVal(fs::PathFromString(arg));
|
||||
}
|
||||
|
||||
static bool g_generated_cookie = false;
|
||||
|
||||
bool GenerateAuthCookie(std::string *cookie_out)
|
||||
{
|
||||
const size_t COOKIE_SIZE = 32;
|
||||
|
|
@ -103,6 +105,7 @@ bool GenerateAuthCookie(std::string *cookie_out)
|
|||
LogPrintf("Unable to rename cookie authentication file %s to %s\n", fs::PathToString(filepath_tmp), fs::PathToString(filepath));
|
||||
return false;
|
||||
}
|
||||
g_generated_cookie = true;
|
||||
LogPrintf("Generated RPC authentication cookie %s\n", fs::PathToString(filepath));
|
||||
|
||||
if (cookie_out)
|
||||
|
|
@ -168,7 +171,10 @@ bool GetMainchainAuthCookie(std::string *cookie_out)
|
|||
void DeleteAuthCookie()
|
||||
{
|
||||
try {
|
||||
fs::remove(GetAuthCookieFile());
|
||||
if (g_generated_cookie) {
|
||||
// Delete the cookie file if it was generated by this process
|
||||
fs::remove(GetAuthCookieFile());
|
||||
}
|
||||
} catch (const fs::filesystem_error& e) {
|
||||
LogPrintf("%s: Unable to remove random auth cookie file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
auto IdsReferToSameAddress = [&](int id, int other_id) EXCLUSIVE_LOCKS_REQUIRED(m_impl->cs, other.m_impl->cs) {
|
||||
auto IdsReferToSameAddress = [&](nid_type id, nid_type other_id) EXCLUSIVE_LOCKS_REQUIRED(m_impl->cs, other.m_impl->cs) {
|
||||
if (id == -1 && other_id == -1) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,13 +244,13 @@ void FillNode(FuzzedDataProvider& fuzzed_data_provider, ConnmanTestMsg& connman,
|
|||
filter_txs),
|
||||
};
|
||||
|
||||
(void)connman.ReceiveMsgFrom(node, msg_version);
|
||||
node.fPauseSend = false;
|
||||
connman.ProcessMessagesOnce(node);
|
||||
{
|
||||
LOCK(node.cs_sendProcessing);
|
||||
peerman.SendMessages(&node);
|
||||
}
|
||||
(void)connman.ReceiveMsgFrom(node, msg_version);
|
||||
node.fPauseSend = false;
|
||||
connman.ProcessMessagesOnce(node);
|
||||
if (node.fDisconnect) return;
|
||||
assert(node.nVersion == version);
|
||||
assert(node.GetCommonVersion() == std::min(version, PROTOCOL_VERSION));
|
||||
|
|
|
|||
|
|
@ -867,6 +867,8 @@ void SetSyscallSandboxPolicy(SyscallSandboxPolicy syscall_policy)
|
|||
break;
|
||||
case SyscallSandboxPolicy::MESSAGE_HANDLER: // Thread: msghand
|
||||
seccomp_policy_builder.AllowFileSystem();
|
||||
// ELEMENTS: Need network to call CallMainChainRPC
|
||||
seccomp_policy_builder.AllowNetwork();
|
||||
break;
|
||||
case SyscallSandboxPolicy::NET: // Thread: net
|
||||
seccomp_policy_builder.AllowFileSystem();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,20 @@
|
|||
#include <script/descriptor.h> // getwalletpakinfo
|
||||
#include <rpc/util.h> // IsBlindDestination
|
||||
|
||||
namespace {
|
||||
static secp256k1_context *secp256k1_ctx;
|
||||
|
||||
class CSecp256k1Init {
|
||||
public:
|
||||
CSecp256k1Init() {
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN);
|
||||
}
|
||||
~CSecp256k1Init() {
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
}
|
||||
};
|
||||
static CSecp256k1Init instance_of_csecp256k1;
|
||||
}
|
||||
|
||||
using interfaces::FoundBlock;
|
||||
|
||||
|
|
@ -1955,6 +1968,7 @@ RPCHelpMan getwalletpakinfo()
|
|||
{
|
||||
{RPCResult::Type::STR, "bip32_counter", "next index to be used by the wallet for `sendtomainchain`"},
|
||||
{RPCResult::Type::STR, "bitcoin_descriptor", "Bitcoin script descriptor loaded in the wallet for pegouts"},
|
||||
{RPCResult::Type::STR, "pakentry", "PAK entry to be used at network initialization time in the form of: `pak=<bitcoin_pak>:<liquid_pak>`"},
|
||||
{RPCResult::Type::STR_HEX, "liquid_pak", "pubkey corresponding to the Liquid PAK loaded in the wallet for pegouts"},
|
||||
{RPCResult::Type::STR, "liquid_pak_address", "corresponding address for `liquid_pak`. Useful for `dumpprivkey` for wallet backup or transfer"},
|
||||
{RPCResult::Type::ARR_FIXED, "address_lookahead", "the three next Bitcoin addresses the wallet will use for `sendtomainchain` based on the internal counter",
|
||||
|
|
@ -1987,6 +2001,28 @@ RPCHelpMan getwalletpakinfo()
|
|||
const auto& desc = Parse(desc_str, provider, error);
|
||||
|
||||
ret.pushKV("bitcoin_descriptor", desc_str);
|
||||
{
|
||||
CPubKey masterpub = pwallet->offline_xpub.pubkey;
|
||||
secp256k1_pubkey masterpub_secp;
|
||||
int secp256k1_ret = secp256k1_ec_pubkey_parse(secp256k1_ctx, &masterpub_secp, masterpub.begin(), masterpub.size());
|
||||
if (secp256k1_ret != 1) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "bitcoin_descriptor could not be parsed.");
|
||||
}
|
||||
|
||||
|
||||
// Negate the pubkey
|
||||
secp256k1_ret = secp256k1_ec_pubkey_negate(secp256k1_ctx, &masterpub_secp);
|
||||
|
||||
std::vector<unsigned char> negatedpubkeybytes;
|
||||
negatedpubkeybytes.resize(33);
|
||||
size_t len = 33;
|
||||
secp256k1_ret = secp256k1_ec_pubkey_serialize(secp256k1_ctx, &negatedpubkeybytes[0], &len, &masterpub_secp, SECP256K1_EC_COMPRESSED);
|
||||
CHECK_NONFATAL(secp256k1_ret == 1);
|
||||
CHECK_NONFATAL(len == 33);
|
||||
CHECK_NONFATAL(negatedpubkeybytes.size() == 33);
|
||||
|
||||
ret.pushKV("pakentry", "pak=" + HexStr(negatedpubkeybytes) + ":" + HexStr(pwallet->online_key));
|
||||
}
|
||||
ret.pushKV("liquid_pak", HexStr(pwallet->online_key));
|
||||
ret.pushKV("liquid_pak_address", EncodeDestination(PKHash(pwallet->online_key)));
|
||||
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ static std::vector<RPCArg> FundTxDoc()
|
|||
};
|
||||
}
|
||||
|
||||
void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out, int& change_position, const UniValue& options, CCoinControl& coinControl, const UniValue& solving_data, bool override_min_fee)
|
||||
void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out, int& change_position, const UniValue& options, CCoinControl& coinControl, bool override_min_fee)
|
||||
{
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
|
|
@ -792,25 +792,6 @@ RPCHelpMan fundrawtransaction()
|
|||
"This boolean should reflect whether the transaction has inputs\n"
|
||||
"(e.g. fully valid, or on-chain transactions), if known by the caller."
|
||||
},
|
||||
{"solving_data", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "Keys and scripts needed for producing a final transaction with a dummy signature. Used for fee estimation during coin selection.\n",
|
||||
{
|
||||
{"pubkeys", RPCArg::Type::ARR, RPCArg::DefaultHint{"empty array"}, "A json array of public keys.\n",
|
||||
{
|
||||
{"pubkey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A public key"},
|
||||
},
|
||||
},
|
||||
{"scripts", RPCArg::Type::ARR, RPCArg::DefaultHint{"empty array"}, "A json array of scripts.\n",
|
||||
{
|
||||
{"script", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A script"},
|
||||
},
|
||||
},
|
||||
{"descriptors", RPCArg::Type::ARR, RPCArg::DefaultHint{"empty array"}, "A json array of descriptors.\n",
|
||||
{
|
||||
{"descriptor", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A descriptor"},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
RPCResult{
|
||||
RPCResult::Type::OBJ, "", "",
|
||||
|
|
@ -850,7 +831,7 @@ RPCHelpMan fundrawtransaction()
|
|||
CCoinControl coin_control;
|
||||
// Automatically select (additional) coins. Can be overridden by options.add_inputs.
|
||||
coin_control.m_add_inputs = true;
|
||||
FundTransaction(*pwallet, tx, fee, change_position, request.params[1], coin_control, request.params[3], /* override_min_fee */ true);
|
||||
FundTransaction(*pwallet, tx, fee, change_position, request.params[1], coin_control, /* override_min_fee */ true);
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("hex", EncodeHexTx(CTransaction(tx)));
|
||||
|
|
@ -1293,12 +1274,8 @@ RPCHelpMan send()
|
|||
// Automatically select coins, unless at least one is manually selected. Can
|
||||
// be overridden by options.add_inputs.
|
||||
coin_control.m_add_inputs = rawTx.vin.size() == 0;
|
||||
UniValue solving_data = NullUniValue;
|
||||
if (options.exists("solving_data")) {
|
||||
solving_data = options["solving_data"].get_obj();
|
||||
}
|
||||
SetOptionsInputWeights(options["inputs"], options);
|
||||
FundTransaction(*pwallet, rawTx, fee, change_position, options, coin_control, /* solving_data */ solving_data, /* override_min_fee */ false);
|
||||
FundTransaction(*pwallet, rawTx, fee, change_position, options, coin_control, /* override_min_fee */ false);
|
||||
|
||||
bool add_to_wallet = true;
|
||||
if (options.exists("add_to_wallet")) {
|
||||
|
|
@ -1530,25 +1507,6 @@ RPCHelpMan walletcreatefundedpsbt()
|
|||
FundTxDoc()),
|
||||
"options"},
|
||||
{"bip32derivs", RPCArg::Type::BOOL, RPCArg::Default{true}, "Include BIP 32 derivation paths for public keys if we know them"},
|
||||
{"solving_data", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "Keys and scripts needed for producing a final transaction with a dummy signature. Used for fee estimation during coin selection.\n",
|
||||
{
|
||||
{"pubkeys", RPCArg::Type::ARR, RPCArg::DefaultHint{"empty array"}, "A json array of public keys.\n",
|
||||
{
|
||||
{"pubkey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A public key"},
|
||||
},
|
||||
},
|
||||
{"scripts", RPCArg::Type::ARR, RPCArg::DefaultHint{"empty array"}, "A json array of scripts.\n",
|
||||
{
|
||||
{"script", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A script"},
|
||||
},
|
||||
},
|
||||
{"descriptors", RPCArg::Type::ARR, RPCArg::DefaultHint{"empty array"}, "A json array of descriptors.\n",
|
||||
{
|
||||
{"descriptor", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A descriptor"},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
{"psbt_version", RPCArg::Type::NUM, RPCArg::Default{2}, "The PSBT version number to use."},
|
||||
},
|
||||
RPCResult{
|
||||
|
|
@ -1582,7 +1540,6 @@ RPCHelpMan walletcreatefundedpsbt()
|
|||
UniValue::VNUM,
|
||||
UniValue::VOBJ,
|
||||
UniValue::VBOOL,
|
||||
UniValue::VOBJ,
|
||||
UniValue::VNUM,
|
||||
}, true
|
||||
);
|
||||
|
|
@ -1605,8 +1562,8 @@ RPCHelpMan walletcreatefundedpsbt()
|
|||
|
||||
// Make a blank psbt
|
||||
uint32_t psbt_version = 2;
|
||||
if (!request.params[6].isNull()) {
|
||||
psbt_version = request.params[6].get_int();
|
||||
if (!request.params[5].isNull()) {
|
||||
psbt_version = request.params[5].get_int();
|
||||
}
|
||||
if (psbt_version != 2) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "The PSBT version can only be 2");
|
||||
|
|
@ -1655,7 +1612,7 @@ RPCHelpMan walletcreatefundedpsbt()
|
|||
}
|
||||
}
|
||||
SetOptionsInputWeights(request.params[0], options);
|
||||
FundTransaction(wallet, rawTx, fee, change_position, options, coin_control, /* solving_data */ request.params[5], /* override_min_fee */ true);
|
||||
FundTransaction(wallet, rawTx, fee, change_position, options, coin_control, /* override_min_fee */ true);
|
||||
// Find an input that is ours
|
||||
unsigned int blinder_index = 0;
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ class FilelockTest(BitcoinTestFramework):
|
|||
self.log.info("Check that we can't start a second bitcoind instance using the same datadir")
|
||||
expected_msg = f"Error: Cannot obtain a lock on data directory {datadir}. {self.config['environment']['PACKAGE_NAME']} is probably already running."
|
||||
self.nodes[1].assert_start_raises_init_error(extra_args=[f'-datadir={self.nodes[0].datadir}', '-noserver'], expected_msg=expected_msg)
|
||||
|
||||
cookie_file = datadir + "/.cookie"
|
||||
assert os.path.isfile(cookie_file) # should not be deleted during the second bitcoind instance shutdown
|
||||
if self.is_wallet_compiled():
|
||||
def check_wallet_filelock(descriptors):
|
||||
wallet_name = ''.join([random.choice(string.ascii_lowercase) for _ in range(6)])
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class PAKTest (BitcoinTestFramework):
|
|||
init_results += [ self.nodes[i].initpegoutwallet(xpub) ]
|
||||
info_results += [ self.nodes[i].getwalletpakinfo() ]
|
||||
assert_equal(init_results[i]["address_lookahead"], info_results[i]["address_lookahead"])
|
||||
assert_equal(init_results[i]["pakentry"], info_results[i]["pakentry"])
|
||||
assert_equal(init_results[i]["liquid_pak"], info_results[i]["liquid_pak"])
|
||||
assert_equal(init_results[i]["liquid_pak_address"], info_results[i]["liquid_pak_address"])
|
||||
assert_equal(info_results[i]["bitcoin_descriptor"], xpub_desc)
|
||||
|
|
|
|||
|
|
@ -132,8 +132,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
self.test_all_watched_funds()
|
||||
self.test_option_feerate()
|
||||
self.test_address_reuse()
|
||||
# ELEMENTS: FIXME
|
||||
# self.test_option_subtract_fee_from_outputs()
|
||||
self.test_option_subtract_fee_from_outputs()
|
||||
self.test_subtract_fee_with_presets()
|
||||
self.test_transaction_too_large()
|
||||
self.test_include_unsafe()
|
||||
|
|
@ -1005,11 +1004,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
|
||||
# An external input without solving data should result in an error
|
||||
raw_tx = self.nodes[2].createrawtransaction([{"txid": txid, "vout": vout}], [{addr_info['unconfidential']: 20}])
|
||||
# // ELEMENTS: FIXME or explain why this tx is created without exception
|
||||
# assert_raises_rpc_error(-4, "Missing solving data for estimating transaction size", self.nodes[2].fundrawtransaction, raw_tx)
|
||||
|
||||
# But funding should work when the solving data is provided
|
||||
funded_tx = self.nodes[2].fundrawtransaction(raw_tx, {}, False, {"pubkeys": [addr_info['pubkey']]})
|
||||
# But funding should work when the solving data is provided (as part of options)
|
||||
funded_tx = self.nodes[2].fundrawtransaction(raw_tx, {"solving_data": {"pubkeys": [addr_info['pubkey']]}}, False)
|
||||
signed_tx = self.nodes[2].signrawtransactionwithwallet(funded_tx['hex'])
|
||||
assert not signed_tx['complete']
|
||||
signed_tx = self.nodes[0].signrawtransactionwithwallet(signed_tx['hex'])
|
||||
|
|
|
|||
|
|
@ -1149,6 +1149,8 @@ class PSBTTest(BitcoinTestFramework):
|
|||
# An external input without solving data should result in an error
|
||||
assert_raises_rpc_error(-4, "Insufficient funds", wallet.walletcreatefundedpsbt, [ext_utxo], [{self.nodes[0].getnewaddress(): 15}])
|
||||
|
||||
# ELEMENTS: check psbt version is 2
|
||||
assert_raises_rpc_error(-8, "The PSBT version can only be 2", wallet.walletcreatefundedpsbt, [ext_utxo], [{self.nodes[0].getnewaddress(): 15}], 0, {"add_inputs": True, "solving_data": {"pubkeys": [addr_info['pubkey']], "scripts": [addr_info["embedded"]["scriptPubKey"]]}},True,1)
|
||||
# But funding should work when the solving data is provided
|
||||
psbt = wallet.walletcreatefundedpsbt([ext_utxo], [{self.nodes[0].getnewaddress(): 15}], 0, {"add_inputs": True, "solving_data": {"pubkeys": [addr_info['pubkey']], "scripts": [addr_info["embedded"]["scriptPubKey"], addr_info["embedded"]["embedded"]["scriptPubKey"]]}})
|
||||
signed = wallet.walletprocesspsbt(psbt['psbt'])
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ if ! command -v codespell > /dev/null; then
|
|||
fi
|
||||
|
||||
IGNORE_WORDS_FILE=test/lint/lint-spelling.ignore-words.txt
|
||||
mapfile -t FILES < <(git ls-files -- ":(exclude)build-aux/m4/" ":(exclude)contrib/seeds/*.txt" ":(exclude)depends/" ":(exclude)doc/release-notes/" ":(exclude)src/leveldb/" ":(exclude)src/crc32c/" ":(exclude)src/qt/locale/" ":(exclude)src/qt/*.qrc" ":(exclude)src/secp256k1/" ":(exclude)src/minisketch/" ":(exclude)src/univalue/" ":(exclude)contrib/builder-keys/keys.txt" ":(exclude)contrib/guix/patches") ":(exclude)src/simplicity/"
|
||||
mapfile -t FILES < <(git ls-files -- ":(exclude)build-aux/m4/" ":(exclude)contrib/seeds/*.txt" ":(exclude)depends/" ":(exclude)doc/release-notes/" ":(exclude)src/leveldb/" ":(exclude)src/crc32c/" ":(exclude)src/qt/locale/" ":(exclude)src/qt/*.qrc" ":(exclude)src/secp256k1/" ":(exclude)src/minisketch/" ":(exclude)src/univalue/" ":(exclude)contrib/builder-keys/keys.txt" ":(exclude)contrib/guix/patches" ":(exclude)contrib/bdb4_config") ":(exclude)src/simplicity/"
|
||||
if ! codespell --check-filenames --disable-colors --quiet-level=7 --ignore-words=${IGNORE_WORDS_FILE} "${FILES[@]}"; then
|
||||
echo "^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in ${IGNORE_WORDS_FILE}"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue