mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge 8779adbdda into merged_master (Bitcoin PR bitcoin/bitcoin#25233)
This commit is contained in:
commit
0ddbc5b407
7 changed files with 1 additions and 85 deletions
|
|
@ -145,7 +145,6 @@ BITCOIN_CORE_H = \
|
|||
compat/byteswap.h \
|
||||
compat/cpuid.h \
|
||||
compat/endian.h \
|
||||
compat/sanity.h \
|
||||
compressor.h \
|
||||
confidential_validation.h \
|
||||
consensus/consensus.h \
|
||||
|
|
@ -673,15 +672,12 @@ libbitcoin_common_a_SOURCES = \
|
|||
$(BITCOIN_CORE_H)
|
||||
|
||||
# util: shared between all executables.
|
||||
# This library *must* be included to make sure that the glibc
|
||||
# sanity checks are linked.
|
||||
libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_util_a_SOURCES = \
|
||||
support/lockedpool.cpp \
|
||||
chainparamsbase.cpp \
|
||||
clientversion.cpp \
|
||||
compat/glibcxx_sanity.cpp \
|
||||
fs.cpp \
|
||||
interfaces/echo.cpp \
|
||||
interfaces/handler.cpp \
|
||||
|
|
@ -933,7 +929,6 @@ libbitcoinkernel_la_SOURCES = \
|
|||
chainparams.cpp \
|
||||
clientversion.cpp \
|
||||
coins.cpp \
|
||||
compat/glibcxx_sanity.cpp \
|
||||
compressor.cpp \
|
||||
consensus/merkle.cpp \
|
||||
consensus/tx_check.cpp \
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <list>
|
||||
#include <locale>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
{
|
||||
// trigger: use ctype<char>::widen to trigger ctype<char>::_M_widen_init().
|
||||
// test: convert a char from narrow to wide and back. Verify that the result
|
||||
// matches the original.
|
||||
bool sanity_test_widen(char testchar)
|
||||
{
|
||||
const std::ctype<char>& test(std::use_facet<std::ctype<char> >(std::locale()));
|
||||
return test.narrow(test.widen(testchar), 'b') == testchar;
|
||||
}
|
||||
|
||||
// trigger: use list::push_back and list::pop_back to trigger _M_hook and
|
||||
// _M_unhook.
|
||||
// test: Push a sequence of integers into a list. Pop them off and verify that
|
||||
// they match the original sequence.
|
||||
bool sanity_test_list(unsigned int size)
|
||||
{
|
||||
std::list<unsigned int> test;
|
||||
for (unsigned int i = 0; i != size; ++i)
|
||||
test.push_back(i + 1);
|
||||
|
||||
if (test.size() != size)
|
||||
return false;
|
||||
|
||||
while (!test.empty()) {
|
||||
if (test.back() != test.size())
|
||||
return false;
|
||||
test.pop_back();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// trigger: string::at(x) on an empty string to trigger __throw_out_of_range_fmt.
|
||||
// test: force std::string to throw an out_of_range exception. Verify that
|
||||
// it's caught correctly.
|
||||
bool sanity_test_range_fmt()
|
||||
{
|
||||
std::string test;
|
||||
try {
|
||||
test.at(1);
|
||||
} catch (const std::out_of_range&) {
|
||||
return true;
|
||||
} catch (...) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool glibcxx_sanity_test()
|
||||
{
|
||||
return sanity_test_widen('a') && sanity_test_list(100) && sanity_test_range_fmt();
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) 2009-2021 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_COMPAT_SANITY_H
|
||||
#define BITCOIN_COMPAT_SANITY_H
|
||||
|
||||
bool glibcxx_sanity_test();
|
||||
|
||||
#endif // BITCOIN_COMPAT_SANITY_H
|
||||
|
|
@ -14,7 +14,6 @@
|
|||
#include <blockfilter.h>
|
||||
#include <chain.h>
|
||||
#include <chainparams.h>
|
||||
#include <compat/sanity.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <deploymentstatus.h>
|
||||
#include <fs.h>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ bool AppInitBasicSetup(const ArgsManager& args);
|
|||
*/
|
||||
bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandbox = true);
|
||||
/**
|
||||
* Initialization sanity checks: ecc init, sanity checks, dir lock.
|
||||
* Initialization sanity checks.
|
||||
* @note This can be done before daemonization. Do not call Shutdown() if this function fails.
|
||||
* @pre Parameters should be parsed and config file should be read, AppInitParameterInteraction should have been called.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#endif
|
||||
|
||||
#include <clientversion.h>
|
||||
#include <compat/sanity.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <fs.h>
|
||||
#include <key.h>
|
||||
|
|
@ -49,9 +48,6 @@ bool SanityChecks()
|
|||
return InitError(Untranslated("Elliptic curve cryptography sanity check failure. Aborting."));
|
||||
}
|
||||
|
||||
if (!glibcxx_sanity_test())
|
||||
return false;
|
||||
|
||||
if (!Random_SanityCheck()) {
|
||||
return InitError(Untranslated("OS cryptographic RNG sanity check failure. Aborting."));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <compat/sanity.h>
|
||||
#include <key.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/time.h>
|
||||
|
|
@ -13,7 +12,6 @@ BOOST_FIXTURE_TEST_SUITE(sanity_tests, BasicTestingSetup)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(basic_sanity)
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(glibcxx_sanity_test() == true, "stdlib sanity test");
|
||||
BOOST_CHECK_MESSAGE(ECC_InitSanityCheck() == true, "secp256k1 sanity test");
|
||||
BOOST_CHECK_MESSAGE(ChronoSanityCheck() == true, "chrono epoch test");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue