-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kernel: Remove UniValue from kernel library #28113
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
RPC Wallet | ||
---------- | ||
|
||
- The `signrawtransactionwithkey`, `signrawtransactionwithwallet`, | ||
`walletprocesspsbt` and `descriptorprocesspsbt` calls now return more | ||
specific RPC_INVALID_PARAMETER instead of RPC_PARSE_ERROR if their | ||
sighashtype argument is malformed or not a string. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Woohoo! |
||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,18 @@ | |
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#include <clientversion.h> | ||
#include <core_io.h> | ||
#include <common/args.h> | ||
#include <consensus/amount.h> | ||
#include <script/interpreter.h> | ||
TheCharlatan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include <key_io.h> | ||
#include <outputtype.h> | ||
#include <rpc/util.h> | ||
#include <script/descriptor.h> | ||
#include <script/signingprovider.h> | ||
#include <tinyformat.h> | ||
#include <util/check.h> | ||
#include <util/result.h> | ||
#include <util/strencodings.h> | ||
#include <util/string.h> | ||
#include <util/translation.h> | ||
|
@@ -310,6 +313,21 @@ UniValue DescribeAddress(const CTxDestination& dest) | |
return std::visit(DescribeAddressVisitor(), dest); | ||
} | ||
|
||
int ParseSighashString(const UniValue& sighash) | ||
{ | ||
if (sighash.isNull()) { | ||
return SIGHASH_DEFAULT; | ||
} | ||
if (!sighash.isStr()) { | ||
throw JSONRPCError(RPC_INVALID_PARAMETER, "sighash needs to be null or string"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about adding dead code. Before on master this will already throw and never reach this part of the code:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a suggestion for how to handle the fuzz test then? Could just remove this line again and re-add the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
const auto result{SighashFromStr(sighash.get_str())}; | ||
if (!result) { | ||
throw JSONRPCError(RPC_INVALID_PARAMETER, util::ErrorString(result).original); | ||
} | ||
return result.value(); | ||
} | ||
|
||
unsigned int ParseConfirmTarget(const UniValue& value, unsigned int max_target) | ||
{ | ||
const int target{value.getInt<int>()}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this true? Before on master this will already throw:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is very wrong :(
Before a
RPC_PARSE_ERROR
was raised if the argument is the wrong type, and aRPC_MISC_ERROR
if the sighash type could not be parsed.Now a
RPC_PARSE_ERROR
is still raised if the argument is the wrong type, and aRPC_INVALID_PARAMETER
if the sighash type could not be parsed.Will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#28162