Skip to content

Commit 0498ea6

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 c8aa59a commit 0498ea6

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

src/Makefile.am

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

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

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

src/bitcoin-tx.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <coins.h>
1212
#include <common/args.h>
1313
#include <common/system.h>
14+
#include <common/univalue_helpers.h>
1415
#include <compat/compat.h>
1516
#include <consensus/amount.h>
1617
#include <consensus/consensus.h>

src/common/univalue_helpers.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@
66
#include <core_io.h>
77
#include <script/interpreter.h>
88
#include <util/result.h>
9+
#include <util/strencodings.h>
910
#include <util/translation.h>
1011

1112
#include <stdexcept>
1213
#include <string>
1314

15+
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName)
16+
{
17+
std::string strHex;
18+
if (v.isStr())
19+
strHex = v.getValStr();
20+
if (!IsHex(strHex))
21+
throw std::runtime_error(strName + " must be hexadecimal string (not '" + strHex + "')");
22+
return ParseHex(strHex);
23+
}
24+
1425
int ParseSighashString(const UniValue& sighash)
1526
{
1627
if (sighash.isNull()) {

src/common/univalue_helpers.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
#include <univalue.h> // IWYU pragma: export
99

10+
#include <string>
11+
#include <vector>
12+
13+
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
14+
1015
int ParseSighashString(const UniValue& sighash);
1116

1217
#endif // BITCOIN_COMMON_UNIVALUE_HELPERS_H

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
util::Result<int> ParseSighash(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/strencodings.h>
1514
#include <version.h>
1615

@@ -242,16 +241,6 @@ bool ParseHashStr(const std::string& strHex, uint256& result)
242241
return true;
243242
}
244243

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

0 commit comments

Comments
 (0)