aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xci/test/wrap-qemu.sh2
-rwxr-xr-xci/test/wrap-wine.sh2
-rw-r--r--depends/packages/native_ds_store.mk2
-rw-r--r--depends/packages/native_mac_alias.mk2
-rw-r--r--src/Makefile.test.include7
-rw-r--r--src/rpc/blockchain.cpp6
-rw-r--r--src/rpc/rawtransaction.cpp2
-rw-r--r--src/univalue/sources.mk9
-rw-r--r--src/univalue/test/.gitignore1
-rw-r--r--src/univalue/test/no_nul.cpp8
-rw-r--r--src/univalue/test/object.cpp22
-rw-r--r--src/univalue/test/unitester.cpp8
-rw-r--r--src/wallet/receive.cpp16
13 files changed, 32 insertions, 55 deletions
diff --git a/ci/test/wrap-qemu.sh b/ci/test/wrap-qemu.sh
index fcd56f533e..eb31edbce8 100755
--- a/ci/test/wrap-qemu.sh
+++ b/ci/test/wrap-qemu.sh
@@ -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}}; do
+for b_name in {"${BASE_OUTDIR}/bin"/*,src/secp256k1/*tests,src/minisketch/test{,-verify},src/univalue/{test_json,unitester,object}}; do
# shellcheck disable=SC2044
for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
echo "Wrap $b ..."
diff --git a/ci/test/wrap-wine.sh b/ci/test/wrap-wine.sh
index 525db9eded..1662f8f6a3 100755
--- a/ci/test/wrap-wine.sh
+++ b/ci/test/wrap-wine.sh
@@ -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
diff --git a/depends/packages/native_ds_store.mk b/depends/packages/native_ds_store.mk
index 44108925a4..51a95f48ef 100644
--- a/depends/packages/native_ds_store.mk
+++ b/depends/packages/native_ds_store.mk
@@ -1,6 +1,6 @@
package=native_ds_store
$(package)_version=1.3.0
-$(package)_download_path=https://github.com/al45tair/ds_store/archive/
+$(package)_download_path=https://github.com/dmgbuild/ds_store/archive/
$(package)_file_name=v$($(package)_version).tar.gz
$(package)_sha256_hash=76b3280cd4e19e5179defa23fb594a9dd32643b0c80d774bd3108361d94fb46d
$(package)_install_libdir=$(build_prefix)/lib/python3/dist-packages
diff --git a/depends/packages/native_mac_alias.mk b/depends/packages/native_mac_alias.mk
index 783f87ca7c..ddd631186e 100644
--- a/depends/packages/native_mac_alias.mk
+++ b/depends/packages/native_mac_alias.mk
@@ -1,6 +1,6 @@
package=native_mac_alias
$(package)_version=2.2.0
-$(package)_download_path=https://github.com/al45tair/mac_alias/archive/
+$(package)_download_path=https://github.com/dmgbuild/mac_alias/archive/
$(package)_file_name=v$($(package)_version).tar.gz
$(package)_sha256_hash=421e6d7586d1f155c7db3e7da01ca0dacc9649a509a253ad7077b70174426499
$(package)_install_libdir=$(build_prefix)/lib/python3/dist-packages
diff --git a/src/Makefile.test.include b/src/Makefile.test.include
index b806b62d5b..d9195ad32e 100644
--- a/src/Makefile.test.include
+++ b/src/Makefile.test.include
@@ -373,7 +373,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)
@@ -382,11 +382,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)
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index b80cdce3f0..52d5eaaa50 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -617,7 +617,7 @@ const RPCResult getblock_vin{
{RPCResult::Type::OBJ, "scriptPubKey", "",
{
{RPCResult::Type::STR, "asm", "The asm"},
- {RPCResult::Type::STR, "hex", "The hex"},
+ {RPCResult::Type::STR_HEX, "hex", "The hex"},
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
{RPCResult::Type::STR, "type", "The type (one of: " + GetAllOutputTypes() + ")"},
}},
@@ -1014,9 +1014,9 @@ static RPCHelpMan gettxout()
{RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
{RPCResult::Type::STR_AMOUNT, "value", "The transaction value in " + CURRENCY_UNIT},
{RPCResult::Type::OBJ, "scriptPubKey", "", {
- {RPCResult::Type::STR, "asm", ""},
+ {RPCResult::Type::STR, "asm", "The asm"},
{RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
- {RPCResult::Type::STR_HEX, "hex", ""},
+ {RPCResult::Type::STR_HEX, "hex", "The hex"},
{RPCResult::Type::STR, "type", "The type, eg pubkeyhash"},
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
}},
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 5ca921ae2f..43e0e6bc2d 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -730,7 +730,7 @@ const RPCResult decodepsbt_inputs{
{RPCResult::Type::OBJ, "final_scriptSig", /*optional=*/true, "",
{
{RPCResult::Type::STR, "asm", "The asm"},
- {RPCResult::Type::STR, "hex", "The hex"},
+ {RPCResult::Type::STR_HEX, "hex", "The hex"},
}},
{RPCResult::Type::ARR, "final_scriptwitness", /*optional=*/true, "",
{
diff --git a/src/univalue/sources.mk b/src/univalue/sources.mk
index e156216378..5e4d9c3831 100644
--- a/src/univalue/sources.mk
+++ b/src/univalue/sources.mk
@@ -1,12 +1,8 @@
-# - All variables are namespaced with UNIVALUE_ to avoid colliding with
-# downstream makefiles.
# - All Variables ending in _HEADERS or _SOURCES confuse automake, so the
# _INT postfix is applied.
# - Convenience variables, for example a UNIVALUE_TEST_DIR should not be used
# as they interfere with automatic dependency generation
-# - The %reldir% is the relative path from the Makefile.am. This allows
-# downstreams to use these variables without having to manually account for
-# the path change.
+# - The %reldir% is the relative path from the Makefile.am.
UNIVALUE_INCLUDE_DIR_INT = %reldir%/include
@@ -29,9 +25,6 @@ UNIVALUE_TEST_UNITESTER_INT += %reldir%/test/unitester.cpp
UNIVALUE_TEST_JSON_INT =
UNIVALUE_TEST_JSON_INT += %reldir%/test/test_json.cpp
-UNIVALUE_TEST_NO_NUL_INT =
-UNIVALUE_TEST_NO_NUL_INT += %reldir%/test/no_nul.cpp
-
UNIVALUE_TEST_OBJECT_INT =
UNIVALUE_TEST_OBJECT_INT += %reldir%/test/object.cpp
diff --git a/src/univalue/test/.gitignore b/src/univalue/test/.gitignore
index 7b27cf0da2..5812c96b14 100644
--- a/src/univalue/test/.gitignore
+++ b/src/univalue/test/.gitignore
@@ -2,7 +2,6 @@
object
unitester
test_json
-no_nul
*.trs
*.log
diff --git a/src/univalue/test/no_nul.cpp b/src/univalue/test/no_nul.cpp
deleted file mode 100644
index 3a7a727abb..0000000000
--- a/src/univalue/test/no_nul.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <univalue.h>
-
-int main (int argc, char *argv[])
-{
- char buf[] = "___[1,2,3]___";
- UniValue val;
- return val.read(buf + 3, 7) ? 0 : 1;
-}
diff --git a/src/univalue/test/object.cpp b/src/univalue/test/object.cpp
index 196b536164..cf8c29ec67 100644
--- a/src/univalue/test/object.cpp
+++ b/src/univalue/test/object.cpp
@@ -13,9 +13,6 @@
#include <string>
#include <vector>
-#define BOOST_FIXTURE_TEST_SUITE(a, b)
-#define BOOST_AUTO_TEST_CASE(funcName) void funcName()
-#define BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK(expr) assert(expr)
#define BOOST_CHECK_EQUAL(v1, v2) assert((v1) == (v2))
#define BOOST_CHECK_THROW(stmt, excMatch) { \
@@ -35,9 +32,7 @@
} \
}
-BOOST_FIXTURE_TEST_SUITE(univalue_tests, BasicTestingSetup)
-
-BOOST_AUTO_TEST_CASE(univalue_constructor)
+void univalue_constructor()
{
UniValue v1;
BOOST_CHECK(v1.isNull());
@@ -85,7 +80,7 @@ BOOST_AUTO_TEST_CASE(univalue_constructor)
BOOST_CHECK_EQUAL(v9.getValStr(), "zappa");
}
-BOOST_AUTO_TEST_CASE(univalue_push_throw)
+void univalue_push_throw()
{
UniValue j;
BOOST_CHECK_THROW(j.push_back(1), std::runtime_error);
@@ -95,7 +90,7 @@ BOOST_AUTO_TEST_CASE(univalue_push_throw)
BOOST_CHECK_THROW(j.pushKVs({}), std::runtime_error);
}
-BOOST_AUTO_TEST_CASE(univalue_typecheck)
+void univalue_typecheck()
{
UniValue v1;
BOOST_CHECK(v1.setNumStr("1"));
@@ -144,7 +139,7 @@ BOOST_AUTO_TEST_CASE(univalue_typecheck)
BOOST_CHECK_THROW(vals[1].get_bool(), std::runtime_error);
}
-BOOST_AUTO_TEST_CASE(univalue_set)
+void univalue_set()
{
UniValue v(UniValue::VSTR, "foo");
v.clear();
@@ -203,7 +198,7 @@ BOOST_AUTO_TEST_CASE(univalue_set)
BOOST_CHECK(v.isNull());
}
-BOOST_AUTO_TEST_CASE(univalue_array)
+void univalue_array()
{
UniValue arr(UniValue::VARR);
@@ -262,7 +257,7 @@ BOOST_AUTO_TEST_CASE(univalue_array)
BOOST_CHECK_EQUAL(arr.size(), 0);
}
-BOOST_AUTO_TEST_CASE(univalue_object)
+void univalue_object()
{
UniValue obj(UniValue::VOBJ);
std::string strKey, strVal;
@@ -381,7 +376,7 @@ BOOST_AUTO_TEST_CASE(univalue_object)
static const char *json1 =
"[1.10000000,{\"key1\":\"str\\u0000\",\"key2\":800,\"key3\":{\"name\":\"martian http://test.com\"}}]";
-BOOST_AUTO_TEST_CASE(univalue_readwrite)
+void univalue_readwrite()
{
UniValue v;
BOOST_CHECK(v.read(json1));
@@ -424,11 +419,10 @@ BOOST_AUTO_TEST_CASE(univalue_readwrite)
BOOST_CHECK(!v.read("{} 42"));
}
-BOOST_AUTO_TEST_SUITE_END()
-
int main (int argc, char *argv[])
{
univalue_constructor();
+ univalue_push_throw();
univalue_typecheck();
univalue_set();
univalue_array();
diff --git a/src/univalue/test/unitester.cpp b/src/univalue/test/unitester.cpp
index 94c149b39f..6344a5a0ab 100644
--- a/src/univalue/test/unitester.cpp
+++ b/src/univalue/test/unitester.cpp
@@ -149,6 +149,13 @@ void unescape_unicode_test()
assert(val[0].get_str() == "\xf0\x9d\x85\xa1");
}
+void no_nul_test()
+{
+ char buf[] = "___[1,2,3]___";
+ UniValue val;
+ assert(val.read(buf + 3, 7));
+}
+
int main (int argc, char *argv[])
{
for (const auto& f: filenames) {
@@ -156,6 +163,7 @@ int main (int argc, char *argv[])
}
unescape_unicode_test();
+ no_nul_test();
return 0;
}
diff --git a/src/wallet/receive.cpp b/src/wallet/receive.cpp
index 8de4017371..d3303c0b1f 100644
--- a/src/wallet/receive.cpp
+++ b/src/wallet/receive.cpp
@@ -130,12 +130,10 @@ CAmount CachedTxGetCredit(const CWallet& wallet, const CWalletTx& wtx, const ism
return 0;
CAmount credit = 0;
- if (filter & ISMINE_SPENDABLE) {
+ const isminefilter get_amount_filter{filter & ISMINE_ALL};
+ if (get_amount_filter) {
// GetBalance can assume transactions in mapWallet won't change
- credit += GetCachableAmount(wallet, wtx, CWalletTx::CREDIT, ISMINE_SPENDABLE);
- }
- if (filter & ISMINE_WATCH_ONLY) {
- credit += GetCachableAmount(wallet, wtx, CWalletTx::CREDIT, ISMINE_WATCH_ONLY);
+ credit += GetCachableAmount(wallet, wtx, CWalletTx::CREDIT, get_amount_filter);
}
return credit;
}
@@ -146,11 +144,9 @@ CAmount CachedTxGetDebit(const CWallet& wallet, const CWalletTx& wtx, const ismi
return 0;
CAmount debit = 0;
- if (filter & ISMINE_SPENDABLE) {
- debit += GetCachableAmount(wallet, wtx, CWalletTx::DEBIT, ISMINE_SPENDABLE);
- }
- if (filter & ISMINE_WATCH_ONLY) {
- debit += GetCachableAmount(wallet, wtx, CWalletTx::DEBIT, ISMINE_WATCH_ONLY);
+ const isminefilter get_amount_filter{filter & ISMINE_ALL};
+ if (get_amount_filter) {
+ debit += GetCachableAmount(wallet, wtx, CWalletTx::DEBIT, get_amount_filter);
}
return debit;
}