Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1780961
revert: bitcoin#25464 (Reduce Univalue push_backV peak memory usage i…
kwvg Jul 23, 2025
b1ae6f5
Squashed 'src/univalue/' changes from 2740c4f712..a44caf65fe
kwvg Jul 23, 2025
f0caaf9
depends: update 'src/univalue' to bitcoin-core/univalue-subtree@a44ca…
kwvg Jul 23, 2025
b07e550
merge bitcoin#25153: Use getInt<T> over get_int/get_int64
kwvg Jul 23, 2025
774a8ff
depends: update 'src/univalue' to bitcoin-core/univalue-subtree@6c19d…
kwvg Jul 23, 2025
88f794f
Squashed 'src/univalue/' changes from a44caf65fe..6c19d050a9
kwvg Jul 23, 2025
9db7b12
merge bitcoin#25113: Bump univalue subtree
kwvg Jul 23, 2025
b3443ee
Squashed 'src/univalue/' changes from 6c19d050a9..de4f73ddca
kwvg Jul 23, 2025
c0c3af9
depends: update 'src/univalue' to bitcoin-core/univalue-subtree@de4f7…
kwvg Jul 23, 2025
6b9e682
merge bitcoin#25249: Bump univalue subtree
kwvg Jul 23, 2025
1e023e5
merge bitcoin#25369: Unsubtree Univalue
kwvg Jun 10, 2022
d980870
revert: revert bitcoin#25464 (Reduce Univalue push_backV peak memory …
kwvg Jul 23, 2025
94bbbf1
partial bitcoin#25551: Throw exception on invalid Univalue pushes ove…
kwvg Jul 6, 2022
7802752
merge bitcoin#25617: univalue test cleanups
kwvg Jul 14, 2022
32958da
merge bitcoin#25611: Avoid brittle, narrowing and verbose integral ty…
kwvg Jul 14, 2022
27cffb1
refactor: shed avoidable casts in Dash-specific UniValue-ret functions
kwvg Jul 23, 2025
6f03a13
merge bitcoin#25736: Remove unused and confusing set*() return value
kwvg Jul 29, 2022
41eb3b0
merge bitcoin#25714: Avoid std::string copies
kwvg Jul 26, 2022
203a1c1
merge bitcoin#26612: pass named argument value as string_view
kwvg Nov 30, 2022
6d81d06
merge bitcoin#27605: Replace global find_value function with UniValue…
kwvg May 9, 2023
f00dc78
build: drop `-Wdangling-reference` GCC suppression
kwvg Jul 23, 2025
05e2091
merge bitcoin#30464: Fix MSVC warning C4101 "unreferenced local varia…
kwvg Jul 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ src/obj
share/setup.nsi
share/qt/Info.plist

src/univalue/gen

src/qt/*.moc
src/qt/moc_*.cpp
src/qt/forms/ui_*.h
Expand Down
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ LCOV_FILTER_PATTERN = \
-p "src/leveldb/" \
-p "src/crc32c/" \
-p "src/bench/" \
-p "src/univalue" \
-p "src/crypto/ctaes" \
-p "src/minisketch" \
-p "src/secp256k1" \
Expand Down
1 change: 0 additions & 1 deletion ci/lint/06_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export COMMIT_RANGE
test/lint/git-subtree-check.sh src/crypto/ctaes
test/lint/git-subtree-check.sh src/secp256k1
test/lint/git-subtree-check.sh src/minisketch
test/lint/git-subtree-check.sh src/univalue
test/lint/git-subtree-check.sh src/leveldb
test/lint/check-doc.py
test/lint/all-lint.py
Expand Down
2 changes: 1 addition & 1 deletion ci/test/wrap-wine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

export LC_ALL=C.UTF-8

for b_name in {"${BASE_OUTDIR}/bin"/*,src/secp256k1/*tests,src/minisketch/test{,-verify},src/univalue/{no_nul,test_json,unitester,object}}.exe; do
for b_name in {"${BASE_OUTDIR}/bin"/*,src/secp256k1/*tests,src/minisketch/test{,-verify},src/univalue/{test_json,unitester,object}}.exe; do
# shellcheck disable=SC2044
for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
if (file "$b" | grep "Windows"); then
Expand Down
9 changes: 1 addition & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -450,21 +450,14 @@ if test "$enable_werror" = "yes"; then
fi
ERROR_CXXFLAGS=$CXXFLAG_WERROR

dnl -Warray-bounds and -Wdangling-reference cause problems with GCC. Do not treat these warnings as errors.
dnl -Warray-bounds cause problems with GCC. Do not treat these warnings as errors.
dnl Suppress -Warray-bounds entirely because of noisy output, currently unhappy with immer implementation.
AX_CHECK_COMPILE_FLAG([-Warray-bounds], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-array-bounds"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([
#if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__)
#error Non-GCC compiler detected, not setting flag
#endif
int main(void) { return 0; }
])])
dnl TODO: Remove suppression after backporting bitcoin#27605
AX_CHECK_COMPILE_FLAG([-Wdangling-reference], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-error=dangling-reference"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([
#if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__)
#error Non-GCC compiler detected, not setting flag
#endif
int main(void) { return 0; }
])])

dnl -Wattributes cause problems with some versions of GCC. Do not treat these warnings as errors.
AX_CHECK_COMPILE_FLAG([-Wattributes], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-error=attributes"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([
Expand Down
1 change: 0 additions & 1 deletion contrib/devtools/copyright_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"src/leveldb/",
"src/minisketch",
"src/secp256k1/",
"src/univalue/",
]

INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.mm', '*.py', '*.sh', '*.bash-completion']
Expand Down
4 changes: 0 additions & 4 deletions doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1155,10 +1155,6 @@ Current subtrees include:
- src/crypto/ctaes
- Upstream at https://github.com/bitcoin-core/ctaes ; maintained by Core contributors.

- src/univalue
- Subtree at https://github.com/bitcoin-core/univalue-subtree ; maintained by Core contributors.
- Deviates from upstream https://github.com/jgarzik/univalue.

- src/minisketch
- Upstream at https://github.com/sipa/minisketch ; maintained by Core contributors.

Expand Down
7 changes: 1 addition & 6 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ endif
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check

if ENABLE_TESTS
UNIVALUE_TESTS = univalue/test/object univalue/test/unitester univalue/test/no_nul
UNIVALUE_TESTS = univalue/test/object univalue/test/unitester
noinst_PROGRAMS += $(UNIVALUE_TESTS)
TESTS += $(UNIVALUE_TESTS)

Expand All @@ -414,11 +414,6 @@ univalue_test_unitester_LDADD = $(LIBUNIVALUE)
univalue_test_unitester_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\"
univalue_test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)

univalue_test_no_nul_SOURCES = $(UNIVALUE_TEST_NO_NUL_INT)
univalue_test_no_nul_LDADD = $(LIBUNIVALUE)
univalue_test_no_nul_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
univalue_test_no_nul_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)

univalue_test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT)
univalue_test_object_LDADD = $(LIBUNIVALUE)
univalue_test_object_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
Expand Down
54 changes: 27 additions & 27 deletions src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
if (!batch[ID_NETWORKINFO]["error"].isNull()) return batch[ID_NETWORKINFO];

const UniValue& networkinfo{batch[ID_NETWORKINFO]["result"]};
if (networkinfo["version"].get_int() < 200000) {
if (networkinfo["version"].getInt<int>() < 200000) {
throw std::runtime_error("-netinfo requires dashd server to be running v20.0 and up");
}
const int64_t time_now{TicksSinceEpoch<std::chrono::seconds>(CliClock::now())};
Expand All @@ -504,16 +504,16 @@ class NetinfoRequestHandler : public BaseRequestHandler
if (conn_type == "manual") ++m_manual_peers_count;
if (DetailsRequested()) {
// Push data for this peer to the peers vector.
const int peer_id{peer["id"].get_int()};
const int mapped_as{peer["mapped_as"].isNull() ? 0 : peer["mapped_as"].get_int()};
const int version{peer["version"].get_int()};
const int64_t addr_processed{peer["addr_processed"].isNull() ? 0 : peer["addr_processed"].get_int64()};
const int64_t addr_rate_limited{peer["addr_rate_limited"].isNull() ? 0 : peer["addr_rate_limited"].get_int64()};
const int64_t conn_time{peer["conntime"].get_int64()};
const int64_t last_blck{peer["last_block"].get_int64()};
const int64_t last_recv{peer["lastrecv"].get_int64()};
const int64_t last_send{peer["lastsend"].get_int64()};
const int64_t last_trxn{peer["last_transaction"].get_int64()};
const int peer_id{peer["id"].getInt<int>()};
const int mapped_as{peer["mapped_as"].isNull() ? 0 : peer["mapped_as"].getInt<int>()};
const int version{peer["version"].getInt<int>()};
const int64_t addr_processed{peer["addr_processed"].isNull() ? 0 : peer["addr_processed"].getInt<int64_t>()};
const int64_t addr_rate_limited{peer["addr_rate_limited"].isNull() ? 0 : peer["addr_rate_limited"].getInt<int64_t>()};
const int64_t conn_time{peer["conntime"].getInt<int64_t>()};
const int64_t last_blck{peer["last_block"].getInt<int64_t>()};
const int64_t last_recv{peer["lastrecv"].getInt<int64_t>()};
const int64_t last_send{peer["lastsend"].getInt<int64_t>()};
const int64_t last_trxn{peer["last_transaction"].getInt<int64_t>()};
const double min_ping{peer["minping"].isNull() ? -1 : peer["minping"].get_real()};
const double ping{peer["pingtime"].isNull() ? -1 : peer["pingtime"].get_real()};
const std::string addr{peer["addr"].get_str()};
Expand All @@ -534,7 +534,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
}

// Generate report header.
std::string result{strprintf("%s client %s%s - server %i%s\n\n", PACKAGE_NAME, FormatFullVersion(), ChainToString(), networkinfo["protocolversion"].get_int(), networkinfo["subversion"].get_str())};
std::string result{strprintf("%s client %s%s - server %i%s\n\n", PACKAGE_NAME, FormatFullVersion(), ChainToString(), networkinfo["protocolversion"].getInt<int>(), networkinfo["subversion"].get_str())};

// Report detailed peer connections list sorted by direction and minimum ping time.
if (DetailsRequested() && !m_peers.empty()) {
Expand Down Expand Up @@ -623,7 +623,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
max_addr_size = std::max(addr["address"].get_str().length() + 1, max_addr_size);
}
for (const UniValue& addr : local_addrs) {
result += strprintf("\n%-*s port %6i score %6i", max_addr_size, addr["address"].get_str(), addr["port"].get_int(), addr["score"].get_int());
result += strprintf("\n%-*s port %6i score %6i", max_addr_size, addr["address"].get_str(), addr["port"].getInt<int>(), addr["score"].getInt<int>());
}
}

Expand Down Expand Up @@ -876,8 +876,8 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str
try {
response = CallRPC(rh, strMethod, args, rpcwallet);
if (fWait) {
const UniValue& error = find_value(response, "error");
if (!error.isNull() && error["code"].get_int() == RPC_IN_WARMUP) {
const UniValue& error = response.find_value("error");
if (!error.isNull() && error["code"].getInt<int>() == RPC_IN_WARMUP) {
throw CConnectionFailed("server in warmup");
}
}
Expand All @@ -904,21 +904,21 @@ static void ParseResult(const UniValue& result, std::string& strPrint)
static void ParseError(const UniValue& error, std::string& strPrint, int& nRet)
{
if (error.isObject()) {
const UniValue& err_code = find_value(error, "code");
const UniValue& err_msg = find_value(error, "message");
const UniValue& err_code = error.find_value("code");
const UniValue& err_msg = error.find_value("message");
if (!err_code.isNull()) {
strPrint = "error code: " + err_code.getValStr() + "\n";
}
if (err_msg.isStr()) {
strPrint += ("error message:\n" + err_msg.get_str());
}
if (err_code.isNum() && err_code.get_int() == RPC_WALLET_NOT_SPECIFIED) {
if (err_code.isNum() && err_code.getInt<int>() == RPC_WALLET_NOT_SPECIFIED) {
strPrint += "\nTry adding \"-rpcwallet=<filename>\" option to dash-cli command line.";
}
} else {
strPrint = "error: " + error.write();
}
nRet = abs(error["code"].get_int());
nRet = abs(error["code"].getInt<int>());
}

/**
Expand All @@ -931,15 +931,15 @@ static void GetWalletBalances(UniValue& result)
{
DefaultRequestHandler rh;
const UniValue listwallets = ConnectAndCallRPC(&rh, "listwallets", /* args=*/{});
if (!find_value(listwallets, "error").isNull()) return;
const UniValue& wallets = find_value(listwallets, "result");
if (!listwallets.find_value("error").isNull()) return;
const UniValue& wallets = listwallets.find_value("result");
if (wallets.size() <= 1) return;

UniValue balances(UniValue::VOBJ);
for (const UniValue& wallet : wallets.getValues()) {
const std::string wallet_name = wallet.get_str();
const UniValue getbalances = ConnectAndCallRPC(&rh, "getbalances", /* args=*/{}, wallet_name);
const UniValue& balance = find_value(getbalances, "result")["mine"]["trusted"];
const UniValue& balance = getbalances.find_value("result")["mine"]["trusted"];
balances.pushKV(wallet_name, balance);
}
result.pushKV("balances", balances);
Expand Down Expand Up @@ -975,7 +975,7 @@ static void GetProgressBar(double progress, std::string& progress_bar)
*/
static void ParseGetInfoResult(UniValue& result)
{
if (!find_value(result, "error").isNull()) return;
if (!result.find_value("error").isNull()) return;

std::string RESET, GREEN, BLUE, YELLOW, MAGENTA, CYAN;
bool should_colorize = false;
Expand Down Expand Up @@ -1191,9 +1191,9 @@ static int CommandLineRPC(int argc, char *argv[])
rh.reset(new NetinfoRequestHandler());
} else if (gArgs.GetBoolArg("-generate", false)) {
const UniValue getnewaddress{GetNewAddress()};
const UniValue& error{find_value(getnewaddress, "error")};
const UniValue& error{getnewaddress.find_value("error")};
if (error.isNull()) {
SetGenerateToAddressArgs(find_value(getnewaddress, "result").get_str(), args);
SetGenerateToAddressArgs(getnewaddress.find_value("result").get_str(), args);
rh.reset(new GenerateToAddressRequestHandler());
} else {
ParseError(error, strPrint, nRet);
Expand All @@ -1215,8 +1215,8 @@ static int CommandLineRPC(int argc, char *argv[])
const UniValue reply = ConnectAndCallRPC(rh.get(), method, args, wallet_name);

// Parse reply
UniValue result = find_value(reply, "result");
const UniValue& error = find_value(reply, "error");
UniValue result = reply.find_value("result");
const UniValue& error = reply.find_value("error");
if (error.isNull()) {
if (gArgs.GetBoolArg("-getinfo", false)) {
if (!gArgs.IsArgSet("-rpcwallet")) {
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
throw std::runtime_error("txid must be hexadecimal string (not '" + prevOut["txid"].get_str() + "')");
}

const int nOut = prevOut["vout"].get_int();
const int nOut = prevOut["vout"].getInt<int>();
if (nOut < 0)
throw std::runtime_error("vout cannot be negative");

Expand Down
14 changes: 7 additions & 7 deletions src/coinjoin/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ void CCoinJoinClientOptions::GetJsonInfo(UniValue& obj)
{
assert(obj.isObject());
const CCoinJoinClientOptions& options = CCoinJoinClientOptions::Get();
obj.pushKV("enabled", options.fEnableCoinJoin);
obj.pushKV("multisession", options.fCoinJoinMultiSession);
obj.pushKV("max_sessions", options.nCoinJoinSessions);
obj.pushKV("max_rounds", options.nCoinJoinRounds);
obj.pushKV("max_amount", options.nCoinJoinAmount);
obj.pushKV("denoms_goal", options.nCoinJoinDenomsGoal);
obj.pushKV("denoms_hardcap", options.nCoinJoinDenomsHardCap);
obj.pushKV("enabled", options.fEnableCoinJoin.load());
obj.pushKV("multisession", options.fCoinJoinMultiSession.load());
obj.pushKV("max_sessions", options.nCoinJoinSessions.load());
obj.pushKV("max_rounds", options.nCoinJoinRounds.load());
obj.pushKV("max_amount", options.nCoinJoinAmount.load());
obj.pushKV("denoms_goal", options.nCoinJoinDenomsGoal.load());
obj.pushKV("denoms_hardcap", options.nCoinJoinDenomsHardCap.load());
}
4 changes: 2 additions & 2 deletions src/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
if (it != ptxSpentInfo->mSpentInfo.end()) {
auto spentInfo = it->second;
out.pushKV("spentTxId", spentInfo.m_tx_hash.GetHex());
out.pushKV("spentIndex", (int)spentInfo.m_tx_index);
out.pushKV("spentIndex", spentInfo.m_tx_index);
out.pushKV("spentHeight", spentInfo.m_block_height);
}
}
Expand All @@ -283,7 +283,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
entry.pushKV("vout", vout);

if (!tx.vExtraPayload.empty()) {
entry.pushKV("extraPayloadSize", (int)tx.vExtraPayload.size());
entry.pushKV("extraPayloadSize", tx.vExtraPayload.size());
entry.pushKV("extraPayload", HexStr(tx.vExtraPayload));
}

Expand Down
26 changes: 14 additions & 12 deletions src/evo/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <core_io.h>
#include <util/underlying.h>

#include <evo/assetlocktx.h>
#include <evo/cbtx.h>
#include <evo/mnhftx.h>
Expand All @@ -28,18 +30,18 @@
}

UniValue ret(UniValue::VOBJ);
ret.pushKV("version", int(nVersion));
ret.pushKV("version", nVersion);
ret.pushKV("creditOutputs", outputs);
return ret;
}

[[nodiscard]] UniValue CAssetUnlockPayload::ToJson() const
{
UniValue ret(UniValue::VOBJ);
ret.pushKV("version", int(nVersion));
ret.pushKV("index", int(index));
ret.pushKV("fee", int(fee));
ret.pushKV("requestedHeight", int(requestedHeight));
ret.pushKV("version", nVersion);
ret.pushKV("index", index);
ret.pushKV("fee", fee);
ret.pushKV("requestedHeight", requestedHeight);
ret.pushKV("quorumHash", quorumHash.ToString());
ret.pushKV("quorumSig", quorumSig.ToString());
return ret;
Expand All @@ -48,13 +50,13 @@
[[nodiscard]] UniValue CCbTx::ToJson() const
{
UniValue ret(UniValue::VOBJ);
ret.pushKV("version", (int)nVersion);
ret.pushKV("version", ToUnderlying(nVersion));
ret.pushKV("height", nHeight);
ret.pushKV("merkleRootMNList", merkleRootMNList.ToString());
if (nVersion >= CCbTx::Version::MERKLE_ROOT_QUORUMS) {
ret.pushKV("merkleRootQuorums", merkleRootQuorums.ToString());
if (nVersion >= CCbTx::Version::CLSIG_AND_BALANCE) {
ret.pushKV("bestCLHeightDiff", static_cast<int>(bestCLHeightDiff));
ret.pushKV("bestCLHeightDiff", bestCLHeightDiff);
ret.pushKV("bestCLSignature", bestCLSignature.ToString());
Comment on lines 50 to 60
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Consistency: convert enum values with ToUnderlying

nVersion is explicitly converted with ToUnderlying, but bestCLHeightDiff (plain integral) and nReason below are not enums.
However, CProUpRevTx::nReason is an enum class (see protx.h). Passing it directly relies on an implicit conversion that is forbidden for scoped enums on some compilers. Use the same helper for clarity and portability:

-    ret.pushKV("reason", nReason);
+    ret.pushKV("reason", ToUnderlying(nReason));

This mirrors the pattern used for nType and avoids future compile issues.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[[nodiscard]] UniValue CCbTx::ToJson() const
{
UniValue ret(UniValue::VOBJ);
ret.pushKV("version", (int)nVersion);
ret.pushKV("version", ToUnderlying(nVersion));
ret.pushKV("height", nHeight);
ret.pushKV("merkleRootMNList", merkleRootMNList.ToString());
if (nVersion >= CCbTx::Version::MERKLE_ROOT_QUORUMS) {
ret.pushKV("merkleRootQuorums", merkleRootQuorums.ToString());
if (nVersion >= CCbTx::Version::CLSIG_AND_BALANCE) {
ret.pushKV("bestCLHeightDiff", static_cast<int>(bestCLHeightDiff));
ret.pushKV("bestCLHeightDiff", bestCLHeightDiff);
ret.pushKV("bestCLSignature", bestCLSignature.ToString());
ret.pushKV("reason", ToUnderlying(nReason));
🤖 Prompt for AI Agents
In src/evo/core_write.cpp around lines 50 to 60, the enum class member nReason
in CProUpRevTx is passed directly without using ToUnderlying, which can cause
implicit conversion issues on some compilers. To fix this, explicitly convert
nReason using ToUnderlying before passing it to pushKV, following the pattern
used for nVersion and nType to ensure clarity and portability.

ret.pushKV("creditPoolBalance", ValueFromAmount(creditPoolBalance));
}
Expand All @@ -68,7 +70,7 @@
ret.pushKV("version", nVersion);
ret.pushKV("type", ToUnderlying(nType));
ret.pushKV("collateralHash", collateralOutpoint.hash.ToString());
ret.pushKV("collateralIndex", (int)collateralOutpoint.n);
ret.pushKV("collateralIndex", collateralOutpoint.n);
if (IsServiceDeprecatedRPCEnabled()) {
ret.pushKV("service", netInfo->GetPrimary().ToStringAddrPort());
}
Expand Down Expand Up @@ -108,7 +110,7 @@
UniValue ret(UniValue::VOBJ);
ret.pushKV("version", nVersion);
ret.pushKV("proTxHash", proTxHash.ToString());
ret.pushKV("reason", (int)nReason);
ret.pushKV("reason", nReason);
ret.pushKV("inputsHash", inputsHash.ToString());
return ret;
}
Expand Down Expand Up @@ -138,16 +140,16 @@
[[nodiscard]] UniValue MNHFTxPayload::ToJson() const
{
UniValue ret(UniValue::VOBJ);
ret.pushKV("version", (int)nVersion);
ret.pushKV("version", nVersion);
ret.pushKV("signal", signal.ToJson());
return ret;
}

[[nodiscard]] UniValue llmq::CFinalCommitmentTxPayload::ToJson() const
{
UniValue ret(UniValue::VOBJ);
ret.pushKV("version", int{nVersion});
ret.pushKV("height", int(nHeight));
ret.pushKV("version", nVersion);
ret.pushKV("height", nHeight);
ret.pushKV("commitment", commitment.ToJson());
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ UniValue CDeterministicMN::ToJson() const
obj.pushKV("type", std::string(GetMnType(nType).description));
obj.pushKV("proTxHash", proTxHash.ToString());
obj.pushKV("collateralHash", collateralOutpoint.hash.ToString());
obj.pushKV("collateralIndex", (int)collateralOutpoint.n);
obj.pushKV("collateralIndex", collateralOutpoint.n);

if (g_txindex) {
CTransactionRef collateralTx;
Expand Down
4 changes: 2 additions & 2 deletions src/governance/classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ CSuperblock::CSuperblock(const CGovernanceObject& govObj, uint256& nHash) :

UniValue obj = govObj.GetJSONObject();

if (obj["type"].get_int() != ToUnderlying(GovernanceObject::TRIGGER)) {
if (obj["type"].getInt<int>() != ToUnderlying(GovernanceObject::TRIGGER)) {
throw std::runtime_error("CSuperblock: invalid data type");
}

// FIRST WE GET THE START HEIGHT, THE BLOCK HEIGHT AT WHICH THE PAYMENT SHALL OCCUR
nBlockHeight = obj["event_block_height"].get_int();
nBlockHeight = obj["event_block_height"].getInt<int>();

// NEXT WE GET THE PAYMENT INFORMATION AND RECONSTRUCT THE PAYMENT VECTOR
std::string strAddresses = obj["payment_addresses"].get_str();
Expand Down
Loading
Loading