mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
kernel: Remove Univalue from kernel library
It is not required by any of the kernel components. A JSON library should not need to be part of a consensus library.
This commit is contained in:
parent
10eb3a9faa
commit
6960c81cbf
5 changed files with 12 additions and 21 deletions
|
@ -896,8 +896,8 @@ if BUILD_BITCOIN_KERNEL_LIB
|
|||
lib_LTLIBRARIES += $(LIBBITCOINKERNEL)
|
||||
|
||||
libbitcoinkernel_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS) $(PTHREAD_FLAGS)
|
||||
libbitcoinkernel_la_LIBADD = $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) $(LIBSECP256K1)
|
||||
libbitcoinkernel_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
|
||||
libbitcoinkernel_la_LIBADD = $(LIBBITCOIN_CRYPTO) $(LIBLEVELDB) $(LIBMEMENV) $(LIBSECP256K1)
|
||||
libbitcoinkernel_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS)
|
||||
|
||||
# libbitcoinkernel requires default symbol visibility, explicitly specify that
|
||||
# here so that things still work even when user configures with
|
||||
|
|
|
@ -562,6 +562,16 @@ static CAmount AmountFromValue(const UniValue& value)
|
|||
return amount;
|
||||
}
|
||||
|
||||
static std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName)
|
||||
{
|
||||
std::string strHex;
|
||||
if (v.isStr())
|
||||
strHex = v.getValStr();
|
||||
if (!IsHex(strHex))
|
||||
throw std::runtime_error(strName + " must be hexadecimal string (not '" + strHex + "')");
|
||||
return ParseHex(strHex);
|
||||
}
|
||||
|
||||
static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
|
||||
{
|
||||
int nHashType = SIGHASH_ALL;
|
||||
|
|
|
@ -46,7 +46,6 @@ bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
|
|||
* @see ParseHashV for an RPC-oriented version of this
|
||||
*/
|
||||
bool ParseHashStr(const std::string& strHex, uint256& result);
|
||||
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
|
||||
[[nodiscard]] util::Result<int> SighashFromStr(const std::string& sighash);
|
||||
|
||||
// core_write.cpp
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <script/sign.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
#include <univalue.h>
|
||||
#include <util/result.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <version.h>
|
||||
|
@ -243,16 +242,6 @@ bool ParseHashStr(const std::string& strHex, uint256& result)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName)
|
||||
{
|
||||
std::string strHex;
|
||||
if (v.isStr())
|
||||
strHex = v.getValStr();
|
||||
if (!IsHex(strHex))
|
||||
throw std::runtime_error(strName + " must be hexadecimal string (not '" + strHex + "')");
|
||||
return ParseHex(strHex);
|
||||
}
|
||||
|
||||
util::Result<int> SighashFromStr(const std::string& sighash)
|
||||
{
|
||||
static std::map<std::string, int> map_sighash_values = {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <core_io.h>
|
||||
#include <rpc/client.h>
|
||||
#include <rpc/util.h>
|
||||
#include <test/fuzz/fuzz.h>
|
||||
|
@ -57,12 +56,6 @@ FUZZ_TARGET_INIT(parse_univalue, initialize_parse_univalue)
|
|||
(void)ParseHexO(univalue, random_string);
|
||||
} catch (const UniValue&) {
|
||||
}
|
||||
try {
|
||||
(void)ParseHexUV(univalue, "A");
|
||||
(void)ParseHexUV(univalue, random_string);
|
||||
} catch (const UniValue&) {
|
||||
} catch (const std::runtime_error&) {
|
||||
}
|
||||
try {
|
||||
(void)ParseHexV(univalue, "A");
|
||||
} catch (const UniValue&) {
|
||||
|
|
Loading…
Add table
Reference in a new issue