mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge pull request #5821 from PastaPastaPasta/develop-trivial-2024-01-13
backport: trivial 2024 01 13
This commit is contained in:
commit
d0a6284817
@ -490,6 +490,8 @@ fi
|
||||
dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
|
||||
AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers],[[CXXFLAGS="$CXXFLAGS -fno-extended-identifiers"]],,[[$CXXFLAG_WERROR]])
|
||||
|
||||
enable_arm_crc=no
|
||||
enable_arm_shani=no
|
||||
enable_sse42=no
|
||||
enable_sse41=no
|
||||
enable_avx2=no
|
||||
|
@ -1 +1 @@
|
||||
82bcf405f6db1d55b684a1f63a4aabad376cdad7
|
||||
577bd51a4b8de066466a445192c1c653872657e2
|
||||
|
@ -1,7 +1,5 @@
|
||||
71A3B16735405025D447E8F274810B012346C9A6
|
||||
133EAC179436F14A5CF1B794860FEB804E669320
|
||||
32EE5C4C3FA15CCADB46ABE529D4BCB6416F53EC
|
||||
B8B3F1C0E58C15DB6A81D30C3648A882F4316B9B
|
||||
CA03882CB1FC067B5D3ACFE4D300116E1C875A3D
|
||||
E777299FC265DD04793070EB944D35F9AC3DB76A
|
||||
D1DBF2C4B96F2DEBF4C16654410108112E7EA81F
|
||||
|
@ -1,6 +1,6 @@
|
||||
NetBSD build guide
|
||||
NetBSD Build Guide
|
||||
======================
|
||||
(updated for NetBSD 8.0)
|
||||
**Updated for NetBSD [8.0](https://www.netbsd.org/releases/formal-8/NetBSD-8.0.html)**
|
||||
|
||||
This guide describes how to build dashd and command-line utilities on NetBSD.
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
||||
*/
|
||||
template<unsigned int N, typename T, typename Size = uint32_t, typename Diff = int32_t>
|
||||
class prevector {
|
||||
static_assert(std::is_trivially_copyable_v<T>);
|
||||
|
||||
public:
|
||||
typedef Size size_type;
|
||||
typedef Diff difference_type;
|
||||
@ -428,15 +430,7 @@ public:
|
||||
// representation (with capacity N and size <= N).
|
||||
iterator p = first;
|
||||
char* endp = (char*)&(*end());
|
||||
if (!std::is_trivially_destructible<T>::value) {
|
||||
while (p != last) {
|
||||
(*p).~T();
|
||||
_size--;
|
||||
++p;
|
||||
}
|
||||
} else {
|
||||
_size -= last - p;
|
||||
}
|
||||
memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
|
||||
return first;
|
||||
}
|
||||
@ -482,9 +476,6 @@ public:
|
||||
}
|
||||
|
||||
~prevector() {
|
||||
if (!std::is_trivially_destructible<T>::value) {
|
||||
clear();
|
||||
}
|
||||
if (!is_direct()) {
|
||||
free(_union.indirect_contents.indirect);
|
||||
_union.indirect_contents.indirect = nullptr;
|
||||
|
@ -141,7 +141,7 @@ void SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()
|
||||
if (m_are_callbacks_running) return;
|
||||
if (m_callbacks_pending.empty()) return;
|
||||
}
|
||||
m_pscheduler->schedule(std::bind(&SingleThreadedSchedulerClient::ProcessQueue, this), std::chrono::system_clock::now());
|
||||
m_scheduler.schedule([this] { this->ProcessQueue(); }, std::chrono::system_clock::now());
|
||||
}
|
||||
|
||||
void SingleThreadedSchedulerClient::ProcessQueue()
|
||||
@ -177,8 +177,6 @@ void SingleThreadedSchedulerClient::ProcessQueue()
|
||||
|
||||
void SingleThreadedSchedulerClient::AddToProcessQueue(std::function<void()> func)
|
||||
{
|
||||
assert(m_pscheduler);
|
||||
|
||||
{
|
||||
LOCK(m_callbacks_mutex);
|
||||
m_callbacks_pending.emplace_back(std::move(func));
|
||||
@ -188,7 +186,7 @@ void SingleThreadedSchedulerClient::AddToProcessQueue(std::function<void()> func
|
||||
|
||||
void SingleThreadedSchedulerClient::EmptyQueue()
|
||||
{
|
||||
assert(!m_pscheduler->AreThreadsServicingQueue());
|
||||
assert(!m_scheduler.AreThreadsServicingQueue());
|
||||
bool should_continue = true;
|
||||
while (should_continue) {
|
||||
ProcessQueue();
|
||||
|
@ -5,13 +5,18 @@
|
||||
#ifndef BITCOIN_SCHEDULER_H
|
||||
#define BITCOIN_SCHEDULER_H
|
||||
|
||||
#include <attributes.h>
|
||||
#include <sync.h>
|
||||
#include <threadsafety.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
|
||||
#include <sync.h>
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* Simple class for background tasks that should be run
|
||||
@ -117,7 +122,7 @@ private:
|
||||
class SingleThreadedSchedulerClient
|
||||
{
|
||||
private:
|
||||
CScheduler* m_pscheduler;
|
||||
CScheduler& m_scheduler;
|
||||
|
||||
Mutex m_callbacks_mutex;
|
||||
std::list<std::function<void()>> m_callbacks_pending GUARDED_BY(m_callbacks_mutex);
|
||||
@ -127,7 +132,7 @@ private:
|
||||
void ProcessQueue();
|
||||
|
||||
public:
|
||||
explicit SingleThreadedSchedulerClient(CScheduler* pschedulerIn) : m_pscheduler(pschedulerIn) {}
|
||||
explicit SingleThreadedSchedulerClient(CScheduler& scheduler LIFETIMEBOUND) : m_scheduler{scheduler} {}
|
||||
|
||||
/**
|
||||
* Add a callback to be executed. Callbacks are executed serially
|
||||
|
@ -128,8 +128,8 @@ BOOST_AUTO_TEST_CASE(singlethreadedscheduler_ordered)
|
||||
CScheduler scheduler;
|
||||
|
||||
// each queue should be well ordered with respect to itself but not other queues
|
||||
SingleThreadedSchedulerClient queue1(&scheduler);
|
||||
SingleThreadedSchedulerClient queue2(&scheduler);
|
||||
SingleThreadedSchedulerClient queue1(scheduler);
|
||||
SingleThreadedSchedulerClient queue2(scheduler);
|
||||
|
||||
// create more threads than queues
|
||||
// if the queues only permit execution of one task at once then
|
||||
@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(singlethreadedscheduler_ordered)
|
||||
// if they don't we'll get out of order behaviour
|
||||
std::vector<std::thread> threads;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
threads.emplace_back(std::bind(&CScheduler::serviceQueue, &scheduler));
|
||||
threads.emplace_back([&] { scheduler.serviceQueue(); });
|
||||
}
|
||||
|
||||
// these are not atomic, if SinglethreadedSchedulerClient prevents
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
// our own queue here :(
|
||||
SingleThreadedSchedulerClient m_schedulerClient;
|
||||
|
||||
explicit MainSignalsInstance(CScheduler *pscheduler) : m_schedulerClient(pscheduler) {}
|
||||
explicit MainSignalsInstance(CScheduler& scheduler LIFETIMEBOUND) : m_schedulerClient(scheduler) {}
|
||||
|
||||
void Register(std::shared_ptr<CValidationInterface> callbacks)
|
||||
{
|
||||
@ -97,7 +97,7 @@ static CMainSignals g_signals;
|
||||
void CMainSignals::RegisterBackgroundSignalScheduler(CScheduler& scheduler)
|
||||
{
|
||||
assert(!m_internals);
|
||||
m_internals.reset(new MainSignalsInstance(&scheduler));
|
||||
m_internals = std::make_unique<MainSignalsInstance>(scheduler);
|
||||
}
|
||||
|
||||
void CMainSignals::UnregisterBackgroundSignalScheduler()
|
||||
|
@ -1939,8 +1939,10 @@ int64_t CWallet::RescanFromTime(int64_t startTime, const WalletRescanReserver& r
|
||||
*/
|
||||
CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_block, int start_height, std::optional<int> max_height, const WalletRescanReserver& reserver, bool fUpdate)
|
||||
{
|
||||
int64_t nNow = GetTime();
|
||||
int64_t start_time = GetTimeMillis();
|
||||
using Clock = std::chrono::steady_clock;
|
||||
constexpr auto LOG_INTERVAL{60s};
|
||||
auto current_time{Clock::now()};
|
||||
auto start_time{Clock::now()};
|
||||
|
||||
assert(reserver.isReserved());
|
||||
|
||||
@ -1967,8 +1969,8 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
|
||||
if (block_height % 100 == 0 && progress_end - progress_begin > 0.0) {
|
||||
ShowProgress(strprintf("%s " + _("Rescanning...").translated, GetDisplayName()), std::max(1, std::min(99, (int)(m_scanning_progress * 100))));
|
||||
}
|
||||
if (GetTime() >= nNow + 60) {
|
||||
nNow = GetTime();
|
||||
if (Clock::now() >= current_time + LOG_INTERVAL) {
|
||||
current_time = Clock::now();
|
||||
WalletLogPrintf("Still rescanning. At block %d. Progress=%f\n", block_height, progress_current);
|
||||
}
|
||||
|
||||
@ -2035,7 +2037,8 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
|
||||
WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height, progress_current);
|
||||
result.status = ScanResult::USER_ABORT;
|
||||
} else {
|
||||
WalletLogPrintf("Rescan completed in %15dms\n", GetTimeMillis() - start_time);
|
||||
auto duration_milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(Clock::now() - start_time);
|
||||
WalletLogPrintf("Rescan completed in %15dms\n", duration_milliseconds.count());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -306,6 +306,9 @@ class RESTTest (BitcoinTestFramework):
|
||||
# the size of the memory pool should be greater than 3x ~100 bytes
|
||||
assert_greater_than(json_obj['bytes'], 300)
|
||||
|
||||
mempool_info = self.nodes[0].getmempoolinfo()
|
||||
assert_equal(json_obj, mempool_info)
|
||||
|
||||
# Check that there are our submitted transactions in the TX memory pool
|
||||
json_obj = self.test_rest_request("/mempool/contents")
|
||||
raw_mempool_verbose = self.nodes[0].getrawmempool(verbose=True)
|
||||
|
@ -254,12 +254,7 @@ class AcceptBlockTest(BitcoinTestFramework):
|
||||
test_node.send_message(msg_block(block_291))
|
||||
|
||||
# At this point we've sent an obviously-bogus block, wait for full processing
|
||||
# without assuming whether we will be disconnected or not
|
||||
try:
|
||||
# Only wait a short while so the test doesn't take forever if we do get
|
||||
# disconnected
|
||||
test_node.sync_with_ping(timeout=1)
|
||||
except AssertionError:
|
||||
# and assume disconnection
|
||||
test_node.wait_for_disconnect()
|
||||
|
||||
self.nodes[0].disconnect_p2ps()
|
||||
|
@ -2371,7 +2371,7 @@ class msg_getcfilters:
|
||||
__slots__ = ("filter_type", "start_height", "stop_hash")
|
||||
msgtype = b"getcfilters"
|
||||
|
||||
def __init__(self, filter_type, start_height, stop_hash):
|
||||
def __init__(self, filter_type=None, start_height=None, stop_hash=None):
|
||||
self.filter_type = filter_type
|
||||
self.start_height = start_height
|
||||
self.stop_hash = stop_hash
|
||||
@ -2421,7 +2421,7 @@ class msg_getcfheaders:
|
||||
__slots__ = ("filter_type", "start_height", "stop_hash")
|
||||
msgtype = b"getcfheaders"
|
||||
|
||||
def __init__(self, filter_type, start_height, stop_hash):
|
||||
def __init__(self, filter_type=None, start_height=None, stop_hash=None):
|
||||
self.filter_type = filter_type
|
||||
self.start_height = start_height
|
||||
self.stop_hash = stop_hash
|
||||
@ -2474,7 +2474,7 @@ class msg_getcfcheckpt:
|
||||
__slots__ = ("filter_type", "stop_hash")
|
||||
msgtype = b"getcfcheckpt"
|
||||
|
||||
def __init__(self, filter_type, stop_hash):
|
||||
def __init__(self, filter_type=None, stop_hash=None):
|
||||
self.filter_type = filter_type
|
||||
self.stop_hash = stop_hash
|
||||
|
||||
|
@ -44,6 +44,9 @@ from test_framework.messages import (
|
||||
msg_getaddr,
|
||||
msg_getblocks,
|
||||
msg_getblocktxn,
|
||||
msg_getcfcheckpt,
|
||||
msg_getcfheaders,
|
||||
msg_getcfilters,
|
||||
msg_getdata,
|
||||
msg_getheaders,
|
||||
msg_getheaders2,
|
||||
@ -93,6 +96,9 @@ MESSAGEMAP = {
|
||||
b"getaddr": msg_getaddr,
|
||||
b"getblocks": msg_getblocks,
|
||||
b"getblocktxn": msg_getblocktxn,
|
||||
b"getcfcheckpt": msg_getcfcheckpt,
|
||||
b"getcfheaders": msg_getcfheaders,
|
||||
b"getcfilters": msg_getcfilters,
|
||||
b"getdata": msg_getdata,
|
||||
b"getheaders": msg_getheaders,
|
||||
b"getheaders2": msg_getheaders2,
|
||||
|
@ -28,7 +28,7 @@ import logging
|
||||
import unittest
|
||||
|
||||
# Formatting. Default colors to empty strings.
|
||||
BOLD, GREEN, RED, GREY = ("", ""), ("", ""), ("", ""), ("", "")
|
||||
DEFAULT, BOLD, GREEN, RED = ("", ""), ("", ""), ("", ""), ("", "")
|
||||
try:
|
||||
# Make sure python thinks it can write unicode to its stdout
|
||||
"\u2713".encode("utf_8").decode(sys.stdout.encoding)
|
||||
@ -59,10 +59,10 @@ if os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393):
|
||||
kernel32.SetConsoleMode(stderr, stderr_mode.value | ENABLE_VIRTUAL_TERMINAL_PROCESSING)
|
||||
# primitive formatting on supported
|
||||
# terminal via ANSI escape sequences:
|
||||
DEFAULT = ('\033[0m', '\033[0m')
|
||||
BOLD = ('\033[0m', '\033[1m')
|
||||
GREEN = ('\033[0m', '\033[0;32m')
|
||||
RED = ('\033[0m', '\033[0;31m')
|
||||
GREY = ('\033[0m', '\033[1;30m')
|
||||
|
||||
TEST_EXIT_PASSED = 0
|
||||
TEST_EXIT_SKIPPED = 77
|
||||
@ -321,11 +321,11 @@ def main():
|
||||
|
||||
args, unknown_args = parser.parse_known_args()
|
||||
if not args.ansi:
|
||||
global BOLD, GREEN, RED, GREY
|
||||
global DEFAULT, BOLD, GREEN, RED
|
||||
DEFAULT = ("", "")
|
||||
BOLD = ("", "")
|
||||
GREEN = ("", "")
|
||||
RED = ("", "")
|
||||
GREY = ("", "")
|
||||
|
||||
# args to be passed on always start with two dashes; tests are the remaining unknown args
|
||||
tests = [arg for arg in unknown_args if arg[:2] != "--"]
|
||||
@ -692,7 +692,7 @@ class TestResult():
|
||||
color = RED
|
||||
glyph = CROSS
|
||||
elif self.status == "Skipped":
|
||||
color = GREY
|
||||
color = DEFAULT
|
||||
glyph = CIRCLE
|
||||
|
||||
return color[1] + "%s | %s%s | %s s\n" % (self.name.ljust(self.padding), glyph, self.status.ljust(7), self.time) + color[0]
|
||||
|
Loading…
Reference in New Issue
Block a user