Skip to content

Commit 6960c81

Browse files
committed
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.
1 parent 10eb3a9 commit 6960c81

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

src/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,8 @@ if BUILD_BITCOIN_KERNEL_LIB
896896
lib_LTLIBRARIES += $(LIBBITCOINKERNEL)
897897

898898
libbitcoinkernel_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS) $(PTHREAD_FLAGS)
899-
libbitcoinkernel_la_LIBADD = $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) $(LIBSECP256K1)
900-
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)
899+
libbitcoinkernel_la_LIBADD = $(LIBBITCOIN_CRYPTO) $(LIBLEVELDB) $(LIBMEMENV) $(LIBSECP256K1)
900+
libbitcoinkernel_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS)
901901

902902
# libbitcoinkernel requires default symbol visibility, explicitly specify that
903903
# here so that things still work even when user configures with

src/bitcoin-tx.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,16 @@ static CAmount AmountFromValue(const UniValue& value)
562562
return amount;
563563
}
564564

565+
static std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName)
566+
{
567+
std::string strHex;
568+
if (v.isStr())
569+
strHex = v.getValStr();
570+
if (!IsHex(strHex))
571+
throw std::runtime_error(strName + " must be hexadecimal string (not '" + strHex + "')");
572+
return ParseHex(strHex);
573+
}
574+
565575
static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
566576
{
567577
int nHashType = SIGHASH_ALL;

src/core_io.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
4646
* @see ParseHashV for an RPC-oriented version of this
4747
*/
4848
bool ParseHashStr(const std::string& strHex, uint256& result);
49-
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
5049
[[nodiscard]] util::Result<int> SighashFromStr(const std::string& sighash);
5150

5251
// core_write.cpp

src/core_read.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <script/sign.h>
1111
#include <serialize.h>
1212
#include <streams.h>
13-
#include <univalue.h>
1413
#include <util/result.h>
1514
#include <util/strencodings.h>
1615
#include <version.h>
@@ -243,16 +242,6 @@ bool ParseHashStr(const std::string& strHex, uint256& result)
243242
return true;
244243
}
245244

246-
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName)
247-
{
248-
std::string strHex;
249-
if (v.isStr())
250-
strHex = v.getValStr();
251-
if (!IsHex(strHex))
252-
throw std::runtime_error(strName + " must be hexadecimal string (not '" + strHex + "')");
253-
return ParseHex(strHex);
254-
}
255-
256245
util::Result<int> SighashFromStr(const std::string& sighash)
257246
{
258247
static std::map<std::string, int> map_sighash_values = {

src/test/fuzz/parse_univalue.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <chainparams.h>
6-
#include <core_io.h>
76
#include <rpc/client.h>
87
#include <rpc/util.h>
98
#include <test/fuzz/fuzz.h>
@@ -57,12 +56,6 @@ FUZZ_TARGET_INIT(parse_univalue, initialize_parse_univalue)
5756
(void)ParseHexO(univalue, random_string);
5857
} catch (const UniValue&) {
5958
}
60-
try {
61-
(void)ParseHexUV(univalue, "A");
62-
(void)ParseHexUV(univalue, random_string);
63-
} catch (const UniValue&) {
64-
} catch (const std::runtime_error&) {
65-
}
6659
try {
6760
(void)ParseHexV(univalue, "A");
6861
} catch (const UniValue&) {

0 commit comments

Comments
 (0)