Merge branch 'dev'
This commit is contained in:
30
configure.ac
30
configure.ac
@@ -3,12 +3,12 @@ AC_PREREQ([2.60])
|
||||
define(_CLIENT_VERSION_MAJOR, 3)
|
||||
dnl Must be kept in sync with src/clientversion.h , ugh!
|
||||
define(_CLIENT_VERSION_MINOR, 10)
|
||||
define(_CLIENT_VERSION_REVISION, 3)
|
||||
define(_CLIENT_VERSION_REVISION, 4)
|
||||
define(_CLIENT_VERSION_BUILD, 50)
|
||||
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
|
||||
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))
|
||||
define(_CLIENT_VERSION_IS_RELEASE, true)
|
||||
define(_COPYRIGHT_YEAR, 2024)
|
||||
define(_COPYRIGHT_YEAR, 2025)
|
||||
AC_INIT([Hush],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_SUFFIX(_ZC_BUILD_VAL)],[https://git.hush.is/hush/hush3],[hush])
|
||||
AC_CONFIG_SRCDIR([src/main.cpp])
|
||||
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
|
||||
@@ -644,6 +644,17 @@ AX_BOOST_PROGRAM_OPTIONS
|
||||
AX_BOOST_THREAD
|
||||
AX_BOOST_CHRONO
|
||||
|
||||
dnl Prevent use of std::unary_function, which was removed in C++17,
|
||||
dnl and will generate warnings with newer compilers for Boost
|
||||
dnl older than 1.80.
|
||||
dnl See: https://github.com/boostorg/container_hash/issues/22, https://github.com/boostorg/config/pull/430.
|
||||
|
||||
dnl _HAS_AUTO_PTR_ETC check required only for boost 1.72 and older, for 1.73+ we can use BOOST_NO_CXX98_FUNCTION_BASE
|
||||
AX_CHECK_PREPROC_FLAG([-D_HAS_AUTO_PTR_ETC=0], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -D_HAS_AUTO_PTR_ETC=0"], [], [$CXXFLAG_WERROR],
|
||||
[AC_LANG_PROGRAM([[#include <boost/config.hpp>]])])
|
||||
AX_CHECK_PREPROC_FLAG([-DBOOST_NO_CXX98_FUNCTION_BASE], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"], [], [$CXXFLAG_WERROR],
|
||||
[AC_LANG_PROGRAM([[#include <boost/config.hpp>]])])
|
||||
|
||||
fi
|
||||
|
||||
if test x$use_reduce_exports = xyes; then
|
||||
@@ -947,11 +958,12 @@ echo
|
||||
echo " target os = $TARGET_OS"
|
||||
echo " build os = $BUILD_OS"
|
||||
echo
|
||||
echo " CC = $CC"
|
||||
echo " CFLAGS = $CFLAGS"
|
||||
echo " CPPFLAGS = $CPPFLAGS"
|
||||
echo " CXX = $CXX"
|
||||
echo " CXXFLAGS = $CXXFLAGS"
|
||||
echo " LDFLAGS = $LDFLAGS"
|
||||
echo " ARFLAGS = $ARFLAGS"
|
||||
echo " CC = $CC"
|
||||
echo " CFLAGS = $CFLAGS"
|
||||
echo " CPPFLAGS = $CPPFLAGS"
|
||||
echo " CXX = $CXX"
|
||||
echo " CXXFLAGS = $CXXFLAGS"
|
||||
echo " BOOST_CPPFLAGS = $BOOST_CPPFLAGS"
|
||||
echo " LDFLAGS = $LDFLAGS"
|
||||
echo " ARFLAGS = $ARFLAGS"
|
||||
echo
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
Files relating to -asmap=... feature, to use ASNs
|
||||
|
||||
Originally from https://github.com/sipa/asmap/blob/master/demo.map
|
||||
From https://github.com/asmap/asmap-data/blob/main/1730210400_asmap.dat
|
||||
[Upstream Commit dcce69e48211facdbd52a461cfce333d5800b7de](https://github.com/asmap/asmap-data/commit/dcce69e48211facdbd52a461cfce333d5800b7de)
|
||||
|
||||
Binary file not shown.
57
contrib/avg_blocktime.pl
Executable file
57
contrib/avg_blocktime.pl
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/perl
|
||||
# Copyright (c) 2016-2022 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
my $cli = "./src/hush-cli";
|
||||
my $coin = shift || '';
|
||||
unless (-e $cli) {
|
||||
die "$cli does not exist, aborting";
|
||||
}
|
||||
if ($coin) {
|
||||
$cli .= " -ac_name=$coin";
|
||||
}
|
||||
my $getblock= "$cli getblock";
|
||||
my $start = shift || 1850000;
|
||||
my $end = shift || 1853000;
|
||||
|
||||
my $blocks = qx{$cli getblockcount};
|
||||
if($?) {
|
||||
print "ERROR, is node running? exiting...\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if ($end > $blocks) {
|
||||
print "The block $end is beyond how many blocks this node knows about, exiting...\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if ($start < 1) {
|
||||
print "Invalid start block $start, exiting...\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $block = $start;
|
||||
my $prev_blocktime = 0;
|
||||
my $total_duration = 0;
|
||||
|
||||
while ($block <= $end) {
|
||||
my $blocktime = qx{$getblock $block | grep time};
|
||||
chomp $blocktime;
|
||||
if($blocktime =~ m/(\d+)/) {
|
||||
$blocktime = $1;
|
||||
}
|
||||
my $duration = $blocktime - $prev_blocktime;
|
||||
if($prev_blocktime > 0) {
|
||||
$total_duration += $duration;
|
||||
}
|
||||
#print "$block $blocktime $prev_blocktime $duration\n";
|
||||
print "$block $duration\n";
|
||||
$block++;
|
||||
$prev_blocktime = $blocktime;
|
||||
}
|
||||
my $num_blocks = $end - $start;
|
||||
my $avg_duration = $total_duration / $num_blocks;
|
||||
print "Avg blocktime over $num_blocks blocks = $avg_duration\n";
|
||||
@@ -5,7 +5,7 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
# Given a block time, estimate when it will happen
|
||||
# Given a block height, estimate when it will happen
|
||||
my $block = shift || die "Usage: $0 123";
|
||||
my $coin = shift || '';
|
||||
my $hush = "./src/hush-cli";
|
||||
@@ -30,7 +30,7 @@ if ($block <= $blockcount) {
|
||||
if ($coin eq 'DRAGONX') {
|
||||
$minpb = 0.6; # minutes per block
|
||||
} elsif ($coin) {
|
||||
# TODO: support custom bloctimes
|
||||
# TODO: support custom blocktimes
|
||||
$minpb = 1; # assumes default blocktime of 60s
|
||||
}
|
||||
my $minutes = $diff*$minpb;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
hush (3.10.3) stable; urgency=high
|
||||
|
||||
* Use WolfSSL 4.8.1 which prevents nodes from getting stuck in general and when shutting down
|
||||
* Use WolfSSL 4.8.1 to prevent nodes from getting stuck and when shutting down
|
||||
* Set minimum fee to 0.1 HUSH per 1 KB of data if `OP_RETURN` is used.
|
||||
* A feature in absurd fee that allows sending amount < fee, can be used only in a full node by advanced users.
|
||||
* Absurd fee allows sending amount < fee; used only in a full node.
|
||||
* Fixed various bugs relating to lock ordering and missing locks
|
||||
* Fixed RPC docs for addnode and disconnectnode having the incorrect port for HACs
|
||||
* Fixed RPC docs for addnode and disconnectnode having incorrect port for HACs
|
||||
* Value of DEBUG_LOCKORDER is now logged to debug.log on node startup
|
||||
* New script ./debug-build.sh to make it easier to make debug builds
|
||||
* DragonX nodes now have their own list of seed nodes
|
||||
* Hush nodes now have their own protocol version which is independent from HACs
|
||||
* Hush nodes now have own protocol version independent from HACs
|
||||
* Fixed off-by-one bug in `newSietchRecipient`
|
||||
* Performance improvement to `ActivateBestChainStep` ed86f2dd1d
|
||||
* Improved navigation in README for new users.
|
||||
|
||||
@@ -1 +1 @@
|
||||
9
|
||||
13
|
||||
|
||||
@@ -1 +1 @@
|
||||
DEBIAN/examples/zcash.conf
|
||||
DEBIAN/examples/HUSH3.conf
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
155.138.228.68
|
||||
107.174.70.251
|
||||
# hush_scanner uses nc which cannot deal with these
|
||||
# 56wqzfj6mhxgsv3h3nh3pdocguogxfxud55libqjhjsdh5alfsko2iqd.onion
|
||||
# hushv3h6mbxd2pptj42reko3jcexcgnz5zvp3mqcu6myto3jhhn4yzyd.onion
|
||||
# hushv3xvheqh42ms3ld2nh555muscietkib7gycb7s4psbrjsysfywqd.onion
|
||||
# iljqq7nnmw2ij2ezl334cerwwmgzmmbmoc3n4saditd2xhi3xohq.b32.i2p
|
||||
# [2a0c:b641:6f1:34::2]
|
||||
# [2a0c:b641:6f1:c::2]
|
||||
@@ -28,8 +25,3 @@ node5.hush.is
|
||||
node6.hush.is
|
||||
node7.hush.is
|
||||
node8.hush.is
|
||||
node1.hush.land
|
||||
node2.hush.land
|
||||
node3.hush.land
|
||||
node4.hush.land
|
||||
node5.hush.land
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
# node1.hush.land
|
||||
# node1.hush.is
|
||||
103.69.128.148
|
||||
|
||||
# node2.hush.land
|
||||
194.29.100.208
|
||||
# node2.hush.is
|
||||
194.29.100.179
|
||||
|
||||
# node3.hush.land
|
||||
# node3.hush.is
|
||||
45.132.75.69
|
||||
|
||||
# node4.hush.land
|
||||
# node4.hush.is
|
||||
170.205.39.39
|
||||
|
||||
# node5.hush.land
|
||||
178.250.189.141
|
||||
|
||||
# lite.hushpool.is
|
||||
149.28.102.219
|
||||
|
||||
@@ -22,10 +19,13 @@
|
||||
# wtfistheinternet.hush.is
|
||||
107.174.70.251
|
||||
|
||||
# arrakis.hush.is
|
||||
178.250.189.141
|
||||
|
||||
# torv3
|
||||
56wqzfj6mhxgsv3h3nh3pdocguogxfxud55libqjhjsdh5alfsko2iqd.onion
|
||||
hushv3h6mbxd2pptj42reko3jcexcgnz5zvp3mqcu6myto3jhhn4yzyd.onion
|
||||
hushv3xvheqh42ms3ld2nh555muscietkib7gycb7s4psbrjsysfywqd.onion
|
||||
b2dln7mw7ydnuopls444tuixujhcw5kn5o22cna6gqfmw2fl6drb5nad.onion
|
||||
dslbaa5gut5kapqtd44pbg65tpl5ydsamfy62hjbldhfsvk64qs57pyd.onion
|
||||
vsqdumnh5khjbrzlxoeucbkiuaictdzyc3ezjpxpp2ph3gfwo2ptjmyd.onion
|
||||
|
||||
# ipv6
|
||||
2a0c:b641:6f1:18e::2
|
||||
|
||||
@@ -7,7 +7,7 @@ $(package)_sha256_hash=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417c
|
||||
$(package)_download_path=https://git.hush.is/attachments
|
||||
$(package)_file_name=7b13759e-8623-4e48-ae08-f78502f4b6a5
|
||||
$(package)_download_file=7b13759e-8623-4e48-ae08-f78502f4b6a5
|
||||
$(package)_patches=fix-Solaris.patch
|
||||
$(package)_patches=fix-Solaris.patch ignore_wnonnull_gcc_11.patch range_enums_clang_16.patch
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts_release=variant=release
|
||||
@@ -32,7 +32,9 @@ endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\"$($(package)_cxxflags) $($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$(boost_archiver_$(host_os))\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam&& \
|
||||
patch -p1 < $($(package)_patch_dir)/fix-Solaris.patch
|
||||
patch -p1 < $($(package)_patch_dir)/fix-Solaris.patch &&\
|
||||
patch -p2 < $($(package)_patch_dir)/ignore_wnonnull_gcc_11.patch &&\
|
||||
patch -p2 < $($(package)_patch_dir)/range_enums_clang_16.patch
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
|
||||
@@ -8,22 +8,25 @@ $(package)_sha256_hash=67df06ed50f288bd7b1ec6907973684fb7cf1196f2cb368b59d423e42
|
||||
$(package)_git_commit=42ba95387cdfd67399f7aac52fddb8d6e1258ee6
|
||||
$(package)_dependencies=
|
||||
$(package)_config_opts=--enable-cxx --disable-shared
|
||||
else ifeq ($(build_os),darwin)
|
||||
else
|
||||
#else ifeq ($(build_os),darwin)
|
||||
$(package)_version=6.1.1
|
||||
$(package)_download_path=https://git.hush.is/attachments
|
||||
$(package)_file_name=d613c855-cd92-4efb-b893-658496852019
|
||||
$(package)_download_file=d613c855-cd92-4efb-b893-658496852019
|
||||
$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
|
||||
$(package)_config_opts=--enable-cxx --disable-shared
|
||||
else
|
||||
$(package)_version=6.1.1
|
||||
$(package)_download_path=https://ftp.gnu.org/gnu/gmp
|
||||
$(package)_file_name=gmp-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
|
||||
$(package)_dependencies=
|
||||
$(package)_config_opts=--enable-cxx --disable-shared
|
||||
endif
|
||||
|
||||
#else
|
||||
#$(package)_version=6.1.1
|
||||
#$(package)_download_path=https://ftp.gnu.org/gnu/gmp
|
||||
#$(package)_file_name=gmp-$($(package)_version).tar.bz2
|
||||
#$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
|
||||
#$(package)_dependencies=
|
||||
#$(package)_config_opts=--enable-cxx --disable-shared
|
||||
#endif
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf) --host=$(host) --build=$(build)
|
||||
endef
|
||||
|
||||
68
depends/patches/boost/ignore_wnonnull_gcc_11.patch
Normal file
68
depends/patches/boost/ignore_wnonnull_gcc_11.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
diff --git a/include/boost/concept/detail/general.hpp b/include/boost/concept/detail/general.hpp
|
||||
index eeb08750..8d7d6f69 100644
|
||||
--- a/include/boost/concept/detail/general.hpp
|
||||
+++ b/include/boost/concept/detail/general.hpp
|
||||
@@ -28,7 +28,14 @@ namespace detail
|
||||
template <class Model>
|
||||
struct requirement
|
||||
{
|
||||
+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
|
||||
+# pragma GCC diagnostic push
|
||||
+# pragma GCC diagnostic ignored "-Wnonnull"
|
||||
+# endif
|
||||
static void failed() { ((Model*)0)->~Model(); }
|
||||
+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
|
||||
+# pragma GCC diagnostic pop
|
||||
+# endif
|
||||
};
|
||||
|
||||
struct failed {};
|
||||
@@ -36,7 +43,14 @@ struct failed {};
|
||||
template <class Model>
|
||||
struct requirement<failed ************ Model::************>
|
||||
{
|
||||
+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
|
||||
+# pragma GCC diagnostic push
|
||||
+# pragma GCC diagnostic ignored "-Wnonnull"
|
||||
+# endif
|
||||
static void failed() { ((Model*)0)->~Model(); }
|
||||
+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
|
||||
+# pragma GCC diagnostic pop
|
||||
+# endif
|
||||
};
|
||||
|
||||
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
||||
@@ -44,7 +58,14 @@ struct requirement<failed ************ Model::************>
|
||||
template <class Model>
|
||||
struct constraint
|
||||
{
|
||||
+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
|
||||
+# pragma GCC diagnostic push
|
||||
+# pragma GCC diagnostic ignored "-Wnonnull"
|
||||
+# endif
|
||||
static void failed() { ((Model*)0)->constraints(); }
|
||||
+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
|
||||
+# pragma GCC diagnostic pop
|
||||
+# endif
|
||||
};
|
||||
|
||||
template <class Model>
|
||||
diff --git a/include/boost/concept/usage.hpp b/include/boost/concept/usage.hpp
|
||||
index 373de63a..fe88b5f5 100644
|
||||
--- a/include/boost/concept/usage.hpp
|
||||
+++ b/include/boost/concept/usage.hpp
|
||||
@@ -13,7 +13,14 @@ namespace boost { namespace concepts {
|
||||
template <class Model>
|
||||
struct usage_requirements
|
||||
{
|
||||
+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
|
||||
+# pragma GCC diagnostic push
|
||||
+# pragma GCC diagnostic ignored "-Wnonnull"
|
||||
+# endif
|
||||
~usage_requirements() { ((Model*)0)->~Model(); }
|
||||
+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
|
||||
+# pragma GCC diagnostic pop
|
||||
+# endif
|
||||
};
|
||||
|
||||
# if BOOST_WORKAROUND(__GNUC__, <= 3)
|
||||
75
depends/patches/boost/range_enums_clang_16.patch
Normal file
75
depends/patches/boost/range_enums_clang_16.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
diff --git a/include/boost/numeric/conversion/detail/int_float_mixture.hpp b/include/boost/numeric/conversion/detail/int_float_mixture.hpp
|
||||
index 464e527..7690d07 100644
|
||||
--- a/include/boost/numeric/conversion/detail/int_float_mixture.hpp
|
||||
+++ b/include/boost/numeric/conversion/detail/int_float_mixture.hpp
|
||||
@@ -16,15 +16,15 @@
|
||||
#include "boost/numeric/conversion/int_float_mixture_enum.hpp"
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
|
||||
-#include "boost/mpl/integral_c.hpp"
|
||||
+#include "boost/type_traits/integral_constant.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
// Integral Constants for 'IntFloatMixture'
|
||||
- typedef mpl::integral_c<int_float_mixture_enum, integral_to_integral> int2int_c ;
|
||||
- typedef mpl::integral_c<int_float_mixture_enum, integral_to_float> int2float_c ;
|
||||
- typedef mpl::integral_c<int_float_mixture_enum, float_to_integral> float2int_c ;
|
||||
- typedef mpl::integral_c<int_float_mixture_enum, float_to_float> float2float_c ;
|
||||
+ typedef boost::integral_constant<int_float_mixture_enum, integral_to_integral> int2int_c ;
|
||||
+ typedef boost::integral_constant<int_float_mixture_enum, integral_to_float> int2float_c ;
|
||||
+ typedef boost::integral_constant<int_float_mixture_enum, float_to_integral> float2int_c ;
|
||||
+ typedef boost::integral_constant<int_float_mixture_enum, float_to_float> float2float_c ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
diff --git a/include/boost/numeric/conversion/detail/sign_mixture.hpp b/include/boost/numeric/conversion/detail/sign_mixture.hpp
|
||||
index c7f9e42..fde1584 100644
|
||||
--- a/include/boost/numeric/conversion/detail/sign_mixture.hpp
|
||||
+++ b/include/boost/numeric/conversion/detail/sign_mixture.hpp
|
||||
@@ -16,15 +16,15 @@
|
||||
#include "boost/numeric/conversion/sign_mixture_enum.hpp"
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
|
||||
-#include "boost/mpl/integral_c.hpp"
|
||||
+#include "boost/type_traits/integral_constant.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
// Integral Constants for 'SignMixture'
|
||||
- typedef mpl::integral_c<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
|
||||
- typedef mpl::integral_c<sign_mixture_enum, signed_to_signed> sig2sig_c ;
|
||||
- typedef mpl::integral_c<sign_mixture_enum, signed_to_unsigned> sig2unsig_c ;
|
||||
- typedef mpl::integral_c<sign_mixture_enum, unsigned_to_signed> unsig2sig_c ;
|
||||
+ typedef boost::integral_constant<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
|
||||
+ typedef boost::integral_constant<sign_mixture_enum, signed_to_signed> sig2sig_c ;
|
||||
+ typedef boost::integral_constant<sign_mixture_enum, signed_to_unsigned> sig2unsig_c ;
|
||||
+ typedef boost::integral_constant<sign_mixture_enum, unsigned_to_signed> unsig2sig_c ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
diff --git a/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp b/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp
|
||||
index 36dbc49..a39d29f 100644
|
||||
--- a/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp
|
||||
+++ b/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp
|
||||
@@ -15,15 +15,15 @@
|
||||
#include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp"
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
|
||||
-#include "boost/mpl/integral_c.hpp"
|
||||
+#include "boost/type_traits/integral_constant.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
// Integral Constants for 'UdtMixture'
|
||||
- typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
|
||||
- typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_udt> builtin2udt_c ;
|
||||
- typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_builtin> udt2builtin_c ;
|
||||
- typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_udt> udt2udt_c ;
|
||||
+ typedef boost::integral_constant<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
|
||||
+ typedef boost::integral_constant<udt_builtin_mixture_enum, builtin_to_udt> builtin2udt_c ;
|
||||
+ typedef boost::integral_constant<udt_builtin_mixture_enum, udt_to_builtin> udt2builtin_c ;
|
||||
+ typedef boost::integral_constant<udt_builtin_mixture_enum, udt_to_udt> udt2udt_c ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
@@ -89,6 +89,41 @@ After successfully compiling Hush, you can generate a debian package of these bi
|
||||
This command will not work on Mac OS X. Currently you cannot generate a Debian package
|
||||
from operating systems other than Linux. Oh well.
|
||||
|
||||
## Adding new CLI options that change consensus rules
|
||||
|
||||
If you are adding a new CLI option that changes consensus rules such as
|
||||
`-ac_foo` then make sure to also modify the the `extraptr` variable in
|
||||
`src/hush_utils.h` with the value of the `ASSETCHAINS_FOO` variable. Our
|
||||
convention is that if a CLI option affects consensus, it MUST begin with `-ac_`
|
||||
and if it does not affect consensus (such as -datadir) then it MUST NOT begin
|
||||
with `-ac_`. Originally the `ac` meant "asset chain" but now it means "affects
|
||||
consensus" or "arrakis chain", take your pick.
|
||||
|
||||
The reason for this is the `extraptr` variable is used to deterministically
|
||||
generate the "chain magic" `ASSETCHAINS_MAGIC` as well as the default p2p and
|
||||
rpc ports for a HAC. This means that if two HACs have *exactly* the same
|
||||
consensus options except for `-ac_foo` (even if they have the same `-ac_name`)
|
||||
then they will still get different chain magic values and p2p and rpc ports.
|
||||
This is a way of preventing HACs with different consensus rules from trying to
|
||||
talk with each other when they should not. For instance, if you make a HAC with
|
||||
`-ac_name=MYCOIN` on one machine with one set of consensus rules and then
|
||||
another HAC with the same name on a different machine but with different
|
||||
consensus rules, the chain magic being different (as well as the default p2p
|
||||
port) are ways to prevent them from communicating. This is good because these
|
||||
two HACs will eventually chain fork due to their different consensus rules and
|
||||
ban each other, wasting time, bandwidth and sanity.
|
||||
|
||||
An example of doing this can be seen in the commit
|
||||
https://git.hush.is/hush/hush3/commit/d39503c13b7419620d138050899705ced557eef9
|
||||
which added the `-ac_burn` consensus changing option.
|
||||
|
||||
The chain magic value is the CRC32 checksum of every non-default consensus
|
||||
option the HAC uses.
|
||||
|
||||
Also make sure to actually validate the new consensus option! That is probably
|
||||
going to happen in `src/main.cpp` . If you don't, a malicious node can just
|
||||
modify `src/miner.cpp` to do whatever they want.
|
||||
|
||||
## Updates to this document
|
||||
|
||||
If you think something else should be in this guide, please send your suggestions!
|
||||
|
||||
@@ -106,10 +106,7 @@ details.
|
||||
## CJDNS-related information in Hush
|
||||
|
||||
There are several ways to see your CJDNS address in Hush:
|
||||
- in the "Local addresses" output of CLI `-netinfo`
|
||||
- in the "localaddresses" output of RPC `getnetworkinfo`
|
||||
|
||||
To see which CJDNS peers your node is connected to, use `hush-cli -netinfo 4`
|
||||
or the `getpeerinfo` RPC (i.e. `hush-cli getpeerinfo`).
|
||||
|
||||
You can use the `getnodeaddresses` RPC to fetch a number of CJDNS peers known to your node; run `hush-cli help getnodeaddresses` for details.
|
||||
To see which CJDNS peers your node is connected to, use `hush-cli getpeerinfo`
|
||||
RPC.
|
||||
|
||||
52
doc/help.md
Normal file
52
doc/help.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# How To Fix Various Problems
|
||||
|
||||
This document will document how to recover and fix various issues that users may run into.
|
||||
|
||||
## Database corruption
|
||||
|
||||
The problem: You see an error like
|
||||
|
||||
```
|
||||
EXCEPTION: 15dbwrapper_error
|
||||
Database corrupted
|
||||
```
|
||||
|
||||
This means your blockchain data on disk is corrupted. This is not the same as wallet corruption.
|
||||
The fix to this is to do a fresh sync using the same wallet.dat file. You need to find
|
||||
where this data lives on your computer and then move some files around, then restart the wallet.
|
||||
|
||||
### On Linux
|
||||
|
||||
If you are on Linux, your wallet lives at `~/.hush/HUSH3/wallet.dat` or if you have a really old
|
||||
legacy wallet it could be at `~/.komodo/HUSH3/wallet.dat` . We will assume the first location.
|
||||
|
||||
What we will do is backup your entire `HUSH3` directory, including the blockchain data and wallet,
|
||||
then copy the wallet from there into a new directory. This is a non-destructive process that creates
|
||||
a new backup of your wallet.
|
||||
|
||||
```
|
||||
# Make sure your node is not running before doing any of this!
|
||||
# Doing this while your node is running could corrupt your wallet.dat
|
||||
cd ~/.hush
|
||||
mv HUSH3 HUSH3-backup # backup all data
|
||||
mkdir HUSH3 # make a new dir
|
||||
cp HUSH3-backup/wallet.dat HUSH3/wallet.dat # copy old wallet to new dir
|
||||
```
|
||||
|
||||
At this point if you are GUI user using SilentDragon, you can restart the GUI wallet
|
||||
and it should perform a fresh sync with your wallet. This will likely take at least
|
||||
a few hours or much longer depending on your internet connection.
|
||||
|
||||
### On Windows
|
||||
|
||||
Basically you want to find where your Hush wallet is, move the directory that contains
|
||||
that wallet.dat file to a new name, then create that same directory and then copy wallet.dat into it.
|
||||
Different versions of Windows store things in different locations.
|
||||
|
||||
For example your wallet might be in `C:\Users\Admin\AppData\Roaming\Hush\HUSH3\wallet.dat` .
|
||||
That means you need to
|
||||
|
||||
* Rename the directory `C:\Users\Admin\AppData\Roaming\Hush\HUSH3` to something like `C:\Users\Admin\AppData\Roaming\Hush\HUSH3-backup`
|
||||
* Create a new directory called `C:\Users\Admin\AppData\Roaming\Hush\HUSH3`
|
||||
* Copy the file `C:\Users\Admin\AppData\Roaming\Hush\HUSH3-backup\wallet.dat` to `C:\Users\Admin\AppData\Roaming\Hush\HUSH3`
|
||||
* Now start the SilentDragon GUI wallet
|
||||
@@ -100,15 +100,11 @@ address.
|
||||
|
||||
There are several ways to see your I2P address if accepting
|
||||
incoming I2P connections (`-i2pacceptincoming`):
|
||||
- in the "Local addresses" output of CLI `-netinfo`
|
||||
- in the "localaddresses" output of RPC `getnetworkinfo`
|
||||
- in the debug log (grep for `AddLocal`; the I2P address ends in `.b32.i2p`)
|
||||
- in the i2p/i2pd web console under "SAM Sessions"
|
||||
|
||||
To see which I2P peers your node is connected to, use `hush-cli -netinfo 4`
|
||||
or the `getpeerinfo` RPC (e.g. `hush-cli getpeerinfo`).
|
||||
|
||||
To see which I2P addresses your node knows, use the `getnodeaddresses 0 i2p`
|
||||
To see which I2P peers your node is connected to, use `hush-cli getpeerinfo`
|
||||
RPC.
|
||||
|
||||
## Compatibility
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
|
||||
.TH HUSH-CLI "1" "February 2024" "hush-cli v3.10.2" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH HUSH-CLI "1" "July 2025" "hush-cli v3.10.4" "User Commands"
|
||||
.SH NAME
|
||||
hush-cli \- manual page for hush-cli v3.10.2
|
||||
hush-cli \- manual page for hush-cli v3.10.4
|
||||
.SH DESCRIPTION
|
||||
Hush RPC client version v3.10.2\-138cd7ab6
|
||||
Hush RPC client version v3.10.4\-7e63e2f01\-dirty
|
||||
.PP
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
@@ -75,7 +75,7 @@ Read extra arguments from standard input, one per line until EOF/Ctrl\-D
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
|
||||
Copyright (C) 2016-2024 Duke Leto and The Hush Developers
|
||||
Copyright (C) 2016-2025 Duke Leto and The Hush Developers
|
||||
|
||||
Copyright (C) 2016-2020 jl777 and SuperNET developers
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
|
||||
.TH HUSH-TX "1" "February 2024" "hush-tx v3.10.2" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH HUSH-TX "1" "July 2025" "hush-tx v3.10.4" "User Commands"
|
||||
.SH NAME
|
||||
hush-tx \- manual page for hush-tx v3.10.2
|
||||
hush-tx \- manual page for hush-tx v3.10.4
|
||||
.SH DESCRIPTION
|
||||
hush\-tx utility version v3.10.2\-138cd7ab6
|
||||
hush\-tx utility version v3.10.4\-7e63e2f01\-dirty
|
||||
.SS "Usage:"
|
||||
.TP
|
||||
hush\-tx [options] <hex\-tx> [commands]
|
||||
@@ -89,7 +89,7 @@ Set register NAME to given JSON\-STRING
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
|
||||
Copyright (C) 2016-2024 Duke Leto and The Hush Developers
|
||||
Copyright (C) 2016-2025 Duke Leto and The Hush Developers
|
||||
|
||||
Copyright (C) 2016-2020 jl777 and SuperNET developers
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
|
||||
.TH HUSHD "1" "February 2024" "hushd v3.10.2" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH HUSHD "1" "July 2025" "hushd v3.10.4" "User Commands"
|
||||
.SH NAME
|
||||
hushd \- manual page for hushd v3.10.2
|
||||
hushd \- manual page for hushd v3.10.4
|
||||
.SH DESCRIPTION
|
||||
Hush Daemon version v3.10.2\-138cd7ab6
|
||||
Hush Daemon version v3.10.4\-7e63e2f01\-dirty
|
||||
.PP
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
@@ -78,7 +78,7 @@ applied)
|
||||
.HP
|
||||
\fB\-par=\fR<n>
|
||||
.IP
|
||||
Set the number of script verification threads (\fB\-12\fR to 16, 0 = auto, <0 =
|
||||
Set the number of script verification threads (\fB\-8\fR to 16, 0 = auto, <0 =
|
||||
leave that many cores free, default: 0)
|
||||
.HP
|
||||
\fB\-pid=\fR<file>
|
||||
@@ -245,6 +245,11 @@ Disable Ipv4 network connections (default: 0)
|
||||
.IP
|
||||
Disable Ipv6 network connections (default: 0)
|
||||
.HP
|
||||
\fB\-clearnet\fR
|
||||
.IP
|
||||
Enable clearnet connections. Setting to 0 will disable clearnet and use
|
||||
sane defaults for Tor/i2p (default: 1)
|
||||
.HP
|
||||
\fB\-permitbaremultisig\fR
|
||||
.IP
|
||||
Relay non\-P2SH multisig (default: 1)
|
||||
@@ -395,11 +400,6 @@ Keep the last <n> transactions (default: 200)
|
||||
.IP
|
||||
Keep transactions for at least <n> blocks (default: 10000)
|
||||
.HP
|
||||
\fB\-opretmintxfee=\fR<amt>
|
||||
.IP
|
||||
Minimum fee (in HUSH/kB) to allow for OP_RETURN transactions (default:
|
||||
400000)
|
||||
.HP
|
||||
\fB\-paytxfee=\fR<amt>
|
||||
.IP
|
||||
Fee (in HUSH/kB) to add to transactions you send (default: 0.00)
|
||||
@@ -674,6 +674,14 @@ Block time in seconds, default is 60
|
||||
.IP
|
||||
BEAM integration
|
||||
.HP
|
||||
\fB\-ac_burn\fR
|
||||
.IP
|
||||
Allow sending funds to the transparent burn address when \fB\-ac_private\fR=\fI\,1\/\fR
|
||||
.HP
|
||||
\fB\-ac_minopreturnfee\fR
|
||||
.IP
|
||||
OP_RETURN minimum fee per tx, regardless of tx size, default is 1 coin
|
||||
.HP
|
||||
\fB\-ac_coda\fR
|
||||
.IP
|
||||
CODA integration
|
||||
@@ -751,7 +759,7 @@ Enforce transaction\-rate limit, default 0
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://hush.is/security/>.
|
||||
|
||||
Copyright (C) 2016-2024 Duke Leto and The Hush Developers
|
||||
Copyright (C) 2016-2025 Duke Leto and The Hush Developers
|
||||
|
||||
Copyright (C) 2016-2020 jl777 and SuperNET developers
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ Look for Git issues that should be fixed in the next release. Especially low-ris
|
||||
|
||||
Install deps on Linux:
|
||||
|
||||
apt-get install help2man debchange
|
||||
apt-get install help2man devscripts
|
||||
|
||||
## Release process
|
||||
- If new seeds are being added or seeds are changing:
|
||||
|
||||
@@ -8,7 +8,38 @@ and now are officially part of our Git repo.
|
||||
Hush releases are on our own Gitea at <a href="https://git.hush.is/">git.hush.is</a>
|
||||
and no longer on Github, since they banned Duke Leto and
|
||||
also because they censor many people around the world and work with
|
||||
evil organizations.
|
||||
evil organizations. They also use all your "private" repos to train their AI.
|
||||
|
||||
# Hush 3.10.4 "Hazy Hākuturi"
|
||||
* `z_sendmany` changes:
|
||||
* Now supports UTF8 strings as memos instead of requiring hex
|
||||
* Give a memo as "utf8:this is my memo" and it will automatically be hex encoded
|
||||
* New optional 5th argument to `z_sendmany` allows specifying an `OP_RETURN` for the transaction
|
||||
* `OP_RETURN` can also be specified as a UTF8 string with 'utf8:' prefix or hex encoded
|
||||
* Updated seed node list
|
||||
* New CLI option -clearnet=0 which disables clearnet networking, i.e. only Tor or i2p are allowed
|
||||
* Note that at least one of a Tor or i2p daemon are needed for -clearnet=0, both are not needed but supported
|
||||
* -clearnet=0 is equivalent to the following CLI params:
|
||||
```
|
||||
-disableipv4=1
|
||||
-disableipv6=1
|
||||
-dns=0
|
||||
-dnsseed=0
|
||||
-bind=127.0.0.1
|
||||
-onlynet="onion"
|
||||
-onlynet="i2p"
|
||||
-onion="127.0.0.1:9050
|
||||
-i2psam="127.0.0.1:7656"
|
||||
```
|
||||
* Using -mineraddress with -clearnet=0 is disallowed since it would reduce privacy
|
||||
* Add CLI options `-disableipv4` and `-disableipv6` which can be used to disable IPv4 or IPv6
|
||||
* New HAC CLI consensus option `-ac_minopreturnfee`
|
||||
* `OP_RETURN` minimum fee per tx, regardless of tx size, default is 1 coin, specified in puposhis
|
||||
* Updated ASmap, which maps IP addresses to Autonomous System (AS) numbers
|
||||
* Added ASmap health check, which logs stats about the ASmap once per 24 hours
|
||||
* Improved cjdns/i2p/tor docs
|
||||
* Updated protocol version
|
||||
* Fixed warnings caused by newer compilers
|
||||
|
||||
# Hush 3.10.3 "Persistent Pezoporus"
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ configure Tor.
|
||||
## How to see information about your Tor configuration via Hush
|
||||
|
||||
There are several ways to see your local onion address in Hush:
|
||||
- in the "Local addresses" output of CLI `-netinfo`
|
||||
- in the "localaddresses" output of RPC `getnetworkinfo`
|
||||
- in the debug log (grep for "AddLocal"; the Tor address ends in `.onion`)
|
||||
|
||||
@@ -27,9 +26,6 @@ CLI `-addrinfo` returns the number of addresses known to your node per
|
||||
network. This can be useful to see how many onion peers your node knows,
|
||||
e.g. for `-onlynet=onion`.
|
||||
|
||||
To fetch a number of onion addresses that your node knows, for example seven
|
||||
addresses, use the `getnodeaddresses 7 onion` RPC.
|
||||
|
||||
## 1. Run Hush behind a Tor proxy
|
||||
|
||||
The first step is running Hush behind a Tor proxy. This will already anonymize all
|
||||
|
||||
@@ -87,7 +87,7 @@ static int AppInitRPC(int argc, char* argv[])
|
||||
ParseParameters(argc, argv);
|
||||
std:string name;
|
||||
|
||||
// default HSC is HUSH3 itself, which to the internals, is also an HSC
|
||||
// default HAC is HUSH3 itself, which to the internals, is also a HAC
|
||||
name = GetArg("-ac_name","HUSH3");
|
||||
|
||||
if ( !name.empty() )
|
||||
|
||||
@@ -47,49 +47,6 @@
|
||||
#define SATOSHIDEN ((uint64_t)100000000L)
|
||||
#define dstr(x) ((double)(x) / SATOSHIDEN)
|
||||
#define CCDISABLEALL memset(ASSETCHAINS_CCDISABLES,1,sizeof(ASSETCHAINS_CCDISABLES))
|
||||
#define CCENABLE(x) ASSETCHAINS_CCDISABLES[((uint8_t)x)] = 0
|
||||
|
||||
/* moved to hush_cJSON.h
|
||||
#ifndef _BITS256
|
||||
#define _BITS256
|
||||
union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; };
|
||||
typedef union _bits256 bits256;
|
||||
#endif
|
||||
*/
|
||||
/// \endcond
|
||||
|
||||
/// identifiers of additional data blobs in token opreturn script:
|
||||
/// @see EncodeTokenCreateOpRet(uint8_t funcid, std::vector<uint8_t> origpubkey, std::string name, std::string description, std::vector<std::pair<uint8_t, vscript_t>> oprets)
|
||||
/// @see GetOpretBlob
|
||||
enum opretid : uint8_t {
|
||||
// cc contracts data:
|
||||
OPRETID_NONFUNGIBLEDATA = 0x11, //!< NFT data id
|
||||
OPRETID_ASSETSDATA = 0x12, //!< assets contract data id
|
||||
OPRETID_GATEWAYSDATA = 0x13, //!< gateways contract data id
|
||||
OPRETID_CHANNELSDATA = 0x14, //!< channels contract data id
|
||||
OPRETID_HEIRDATA = 0x15, //!< heir contract data id
|
||||
OPRETID_ROGUEGAMEDATA = 0x16, //!< rogue contract data id
|
||||
OPRETID_PEGSDATA = 0x17, //!< pegs contract data id
|
||||
|
||||
/*! \cond INTERNAL */
|
||||
// non cc contract data:
|
||||
OPRETID_FIRSTNONCCDATA = 0x80,
|
||||
/*! \endcond */
|
||||
OPRETID_BURNDATA = 0x80, //!< burned token data id
|
||||
OPRETID_IMPORTDATA = 0x81 //!< imported token data id
|
||||
};
|
||||
|
||||
/// finds opret blob data by opretid in the vector of oprets
|
||||
/// @param oprets vector of oprets
|
||||
/// @param id opret id to search
|
||||
/// @param vopret found opret blob as byte array
|
||||
/// @returns true if found
|
||||
/// @see opretid
|
||||
inline bool GetOpretBlob(const std::vector<std::pair<uint8_t, std::vector<uint8_t>>> &oprets, uint8_t id, std::vector<uint8_t> &vopret) {
|
||||
vopret.clear();
|
||||
for(auto p : oprets) if (p.first == id) { vopret = p.second; return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \cond INTERNAL
|
||||
struct CC_utxo
|
||||
@@ -100,16 +57,6 @@ struct CC_utxo
|
||||
};
|
||||
/// \endcond
|
||||
|
||||
/// \cond INTERNAL
|
||||
struct CC_meta
|
||||
{
|
||||
std::vector<unsigned char> version;
|
||||
uint8_t evalCode;
|
||||
bool is1of2;
|
||||
uint8_t numDestinations;
|
||||
// followed by address destinations
|
||||
};
|
||||
/// \endcond
|
||||
|
||||
/// CC contract (Antara module) info structure that contains data used for signing and validation of cc contract transactions
|
||||
struct CCcontract_info
|
||||
@@ -184,16 +131,6 @@ struct CCcontract_info
|
||||
/// @returns pointer to the passed CCcontract_info structure, it must not be freed
|
||||
struct CCcontract_info *CCinit(struct CCcontract_info *cp,uint8_t evalcode);
|
||||
|
||||
/// \cond INTERNAL
|
||||
struct oracleprice_info
|
||||
{
|
||||
CPubKey pk;
|
||||
std::vector <uint8_t> data;
|
||||
int32_t height;
|
||||
};
|
||||
/// \endcond
|
||||
|
||||
|
||||
typedef std::vector<uint8_t> vscript_t;
|
||||
extern struct NSPV_CCmtxinfo NSPV_U; //!< global variable with info about mtx object and used utxo
|
||||
|
||||
@@ -258,7 +195,6 @@ bool myIsutxo_spentinmempool(uint256 &spenttxid,int32_t &spentvini,uint256 txid,
|
||||
bool myAddtomempool(CTransaction &tx, CValidationState *pstate = NULL, bool fSkipExpiry = false);
|
||||
bool mytxid_inmempool(uint256 txid);
|
||||
int32_t myIsutxo_spent(uint256 &spenttxid,uint256 txid,int32_t vout);
|
||||
int32_t myGet_mempool_txs(std::vector<CTransaction> &txs,uint8_t evalcode,uint8_t funcid);
|
||||
/// \endcond
|
||||
|
||||
/// \cond INTERNAL
|
||||
@@ -393,52 +329,6 @@ bool getCCopret(const CScript &scriptPubKey, CScript &opret);
|
||||
/// @private
|
||||
bool makeCCopret(CScript &opret, std::vector<std::vector<unsigned char>> &vData);
|
||||
|
||||
/// CCaddr2set sets private key for additional eval code global address.
|
||||
/// This allows to spend from two cc global addresses in one transaction (the first one is set in cp object by @see CCinit function).
|
||||
/// @param cp contract info structure (@see CCcontract_info) where the private key is set
|
||||
/// @param evalcode eval code of the other contract
|
||||
/// @param pk global public key of the other contract
|
||||
/// @param priv private key for the global public key of the other contract
|
||||
/// @param coinaddr cc address obtained for this global pubkey and eval code with _GetCCaddress
|
||||
/// @see CCinit
|
||||
/// @see CCcontract_info
|
||||
/// @see _GetCCaddress
|
||||
void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr);
|
||||
|
||||
/// CCaddr2set sets private key for yet another eval code global address.
|
||||
/// This allows to spend from three cc global addresses in one transaction (the first one is set in cp object by CCinit function, the second is set by CCaddr2set function).
|
||||
/// @param cp contract info structure where the private key is set
|
||||
/// @param evalcode eval code of the other contract
|
||||
/// @param pk global public key of the other contract
|
||||
/// @param priv private key for the global public key of the other contract
|
||||
/// @param coinaddr the cc address obtained for this global pubkey and eval code with _GetCCaddress
|
||||
/// @see CCinit
|
||||
/// @see CCcontract_info
|
||||
/// @see CCaddr2set
|
||||
/// @see _GetCCaddress
|
||||
void CCaddr3set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr);
|
||||
|
||||
/// CCaddr1of2set sets pubkeys, private key and cc addr for spending from 1of2 cryptocondition vout
|
||||
/// @param cp contract info structure where the private key is set
|
||||
/// @param pk1 one of the two public keys of the 1of2 cc
|
||||
/// @param pk2 second of the two public keys of the 1of2 cc
|
||||
/// @param priv private key for one of the two pubkeys
|
||||
/// @param coinaddr the cc address obtained for this 1of2 cc with GetCCaddress1of2
|
||||
/// @see CCinit
|
||||
/// @see CCcontract_info
|
||||
/// @see GetCCaddress1of2
|
||||
void CCaddr1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2,uint8_t *priv,char *coinaddr);
|
||||
|
||||
/// CCaddrTokens1of2set sets pubkeys, private key and cc addr for spending from 1of2 token cryptocondition vout
|
||||
/// @param cp contract info structure where the private key is set
|
||||
/// @param pk1 one of the two public keys of the 1of2 cc
|
||||
/// @param pk2 second of the two public keys of the 1of2 cc
|
||||
/// @param priv private key for one of the two pubkeys
|
||||
/// @param coinaddr the cc address obtained for this 1of2 token cc with GetTokensCCaddress1of2
|
||||
/// @see GetTokensCCaddress
|
||||
/// @see CCcontract_info
|
||||
void CCaddrTokens1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *coinaddr);
|
||||
|
||||
/// IsCCInput checks if scriptSig object contains a cryptocondition
|
||||
/// @param scriptSig scriptSig object with a cryptocondition
|
||||
/// @returns true if the scriptSig object contains a cryptocondition
|
||||
@@ -476,8 +366,6 @@ CPubKey pubkey2pk(std::vector<uint8_t> vpubkey);
|
||||
/// @param tokenid id of token (id of token creation tx)
|
||||
int64_t CCfullsupply(uint256 tokenid);
|
||||
|
||||
/// @private
|
||||
bool ConstrainVout(CTxOut vout,int32_t CCflag,char *cmpaddr,int64_t nValue);
|
||||
|
||||
/// Returns bitcoin address for the scriptPubKey parameter
|
||||
/// @param[out] destaddr the returned address of the scriptPubKey, the buffer should have size of at least 64 chars
|
||||
@@ -485,15 +373,6 @@ bool ConstrainVout(CTxOut vout,int32_t CCflag,char *cmpaddr,int64_t nValue);
|
||||
/// @returns true if success
|
||||
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
|
||||
|
||||
/// Returns custom bitcoin address for the scriptPubKey parameter
|
||||
/// @param[out] destaddr the returned address of the scriptPubKey, the buffer should have size of at least 64 chars
|
||||
/// @param scriptPubKey scriptPubKey object
|
||||
/// @param taddr custom address prefix
|
||||
/// @param prefix custom pubkey prefix
|
||||
/// @param prefix2 custom script prefix
|
||||
/// @returns true if success
|
||||
bool GetCustomscriptaddress(char *destaddr,const CScript &scriptPubKey,uint8_t taddr,uint8_t prefix,uint8_t prefix2);
|
||||
|
||||
/// Returns my pubkey, that is set by -pubkey hushd parameter
|
||||
/// @returns public key as byte array
|
||||
std::vector<uint8_t> Mypubkey();
|
||||
@@ -633,9 +512,6 @@ bits256 bits256_doublesha256(char *deprecated,uint8_t *data,int32_t datalen);
|
||||
// UniValue ValueFromAmount(const CAmount& amount); // defined in server.h
|
||||
/*! \endcond */
|
||||
|
||||
/*! \cond INTERNAL */
|
||||
int64_t TotalPubkeyNormalInputs(const CTransaction &tx, const CPubKey &pubkey);
|
||||
int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey);
|
||||
inline std::string STR_TOLOWER(const std::string &str) { std::string out; for (std::string::const_iterator i = str.begin(); i != str.end(); i++) out += std::tolower(*i); return out; }
|
||||
/*! \endcond */
|
||||
|
||||
@@ -646,60 +522,4 @@ inline std::string STR_TOLOWER(const std::string &str) { std::string out; for (s
|
||||
void AddSigData2UniValue(UniValue &result, int32_t vini, UniValue& ccjson, std::string sscriptpubkey, int64_t amount);
|
||||
|
||||
|
||||
#ifndef LOGSTREAM_DEFINED
|
||||
#define LOGSTREAM_DEFINED
|
||||
// bitcoin LogPrintStr with category "-debug" cmdarg support for C++ ostringstream:
|
||||
|
||||
// log levels:
|
||||
#define CCLOG_ERROR (-1) //!< error level
|
||||
#define CCLOG_INFO 0 //!< info level
|
||||
#define CCLOG_DEBUG1 1 //!< debug level 1
|
||||
#define CCLOG_DEBUG2 2 //!< debug level 2
|
||||
#define CCLOG_DEBUG3 3 //!< debug level 3
|
||||
#define CCLOG_MAXLEVEL 3
|
||||
|
||||
/// @private
|
||||
extern void CCLogPrintStr(const char *category, int level, const std::string &str);
|
||||
|
||||
/// @private
|
||||
template <class T>
|
||||
void CCLogPrintStream(const char *category, int level, const char *functionName, T print_to_stream)
|
||||
{
|
||||
}
|
||||
/// Macro for logging messages using bitcoin LogAcceptCategory and LogPrintStr functions.
|
||||
/// Supports error, info and three levels of debug messages.
|
||||
/// Logging category is set by -debug=category hushd param.
|
||||
/// To set debug level pass -debug=category-1, -debug=category-2 or -debug=category-3 param. If some level is enabled lower level messages also will be printed.
|
||||
/// To print info-level messages pass just -debug=category parameter, with no level.
|
||||
/// Error-level messages will always be printed, even if -debug parameter is not set
|
||||
/// @param category category of message, for example Antara module name
|
||||
/// @param level debug-level, use defines CCLOG_ERROR, CCLOG_INFO, CCLOG_DEBUGN
|
||||
/// @param logoperator to form the log message (the 'stream' name is mandatory)
|
||||
/// usage: LOGSTREAM("category", debug-level, stream << "some log data" << data2 << data3 << ... << std::endl);
|
||||
/// example: LOGSTREAM("heir", CCLOG_INFO, stream << "heir public key is " << HexStr(heirPk) << std::endl);
|
||||
#define LOGSTREAM(category, level, logoperator) CCLogPrintStream( category, level, NULL, [=](std::ostringstream &stream) {logoperator;} )
|
||||
|
||||
/// LOGSTREAMFN is a version of LOGSTREAM macro which adds calling function name with the standard define \_\_func\_\_ at the beginning of the printed string.
|
||||
/// LOGSTREAMFN parameters are the same as in LOGSTREAM
|
||||
/// @see LOGSTREAM
|
||||
#define LOGSTREAMFN(category, level, logoperator) CCLogPrintStream( category, level, __func__, [=](std::ostringstream &stream) {logoperator;} )
|
||||
|
||||
/// @private
|
||||
template <class T>
|
||||
UniValue report_ccerror(const char *category, int level, T print_to_stream)
|
||||
{
|
||||
UniValue err(UniValue::VOBJ);
|
||||
std::ostringstream stream;
|
||||
|
||||
print_to_stream(stream);
|
||||
err.push_back(Pair("result", "error"));
|
||||
err.push_back(Pair("error", stream.str()));
|
||||
stream << std::endl;
|
||||
CCLogPrintStr(category, level, stream.str());
|
||||
return err;
|
||||
}
|
||||
|
||||
/// @private
|
||||
#define CCERR_RESULT(category,level,logoperator) return report_ccerror(category, level, [=](std::ostringstream &stream) {logoperator;})
|
||||
#endif // #ifndef LOGSTREAM_DEFINED
|
||||
#endif
|
||||
|
||||
@@ -102,7 +102,3 @@ CPubKey pubkey2pk(std::vector<uint8_t> vpubkey)
|
||||
pk.Set(vpubkey.begin(), vpubkey.end());
|
||||
return(pk);
|
||||
}
|
||||
|
||||
void CCLogPrintStr(const char *category, int level, const std::string &str)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -100,22 +100,6 @@ uint32_t GetLatestTimestamp(int32_t height)
|
||||
return(hush_heightstamp(height));
|
||||
} // :P
|
||||
|
||||
void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr)
|
||||
{
|
||||
}
|
||||
|
||||
void CCaddr3set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr)
|
||||
{
|
||||
}
|
||||
|
||||
void CCaddr1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *coinaddr)
|
||||
{
|
||||
}
|
||||
|
||||
void CCaddrTokens1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *tokenaddr)
|
||||
{
|
||||
}
|
||||
|
||||
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey)
|
||||
{
|
||||
CTxDestination address; txnouttype whichType;
|
||||
@@ -132,11 +116,6 @@ bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey)
|
||||
return(false);
|
||||
}
|
||||
|
||||
bool GetCustomscriptaddress(char *destaddr,const CScript &scriptPubKey,uint8_t taddr,uint8_t prefix, uint8_t prefix2)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
bool pubkey2addr(char *destaddr,uint8_t *pubkey33)
|
||||
{
|
||||
std::vector<uint8_t>pk; int32_t i;
|
||||
@@ -145,11 +124,6 @@ bool pubkey2addr(char *destaddr,uint8_t *pubkey33)
|
||||
return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG));
|
||||
}
|
||||
|
||||
bool ConstrainVout(CTxOut vout, int32_t CCflag, char *cmpaddr, int64_t nValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool priv2addr(char *coinaddr,uint8_t *buf33,uint8_t priv32[32])
|
||||
{
|
||||
CKey priv; CPubKey pk; int32_t i; uint8_t *src;
|
||||
@@ -189,57 +163,9 @@ CPubKey GetUnspendable(struct CCcontract_info *cp,uint8_t *unspendablepriv)
|
||||
|
||||
int32_t NSPV_coinaddr_inmempool(char const *logcategory,char *coinaddr,uint8_t CCflag);
|
||||
|
||||
int32_t myIs_coinaddr_inmempoolvout(char const *logcategory,char *coinaddr)
|
||||
{
|
||||
int32_t i,n; char destaddr[64];
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
return(NSPV_coinaddr_inmempool(logcategory,coinaddr,1));
|
||||
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
|
||||
{
|
||||
const CTransaction &tx = e.GetTx();
|
||||
if ( (n= tx.vout.size()) > 0 )
|
||||
{
|
||||
const uint256 &txid = tx.GetHash();
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
Getscriptaddress(destaddr,tx.vout[i].scriptPubKey);
|
||||
if ( strcmp(destaddr,coinaddr) == 0 )
|
||||
{
|
||||
LogPrint(logcategory,"found (%s) vout in mempool\n",coinaddr);
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
extern struct NSPV_mempoolresp NSPV_mempoolresult;
|
||||
extern bool NSPV_evalcode_inmempool(uint8_t evalcode,uint8_t funcid);
|
||||
|
||||
int32_t myGet_mempool_txs(std::vector<CTransaction> &txs,uint8_t evalcode,uint8_t funcid)
|
||||
{
|
||||
int i=0;
|
||||
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
{
|
||||
CTransaction tx; uint256 hashBlock;
|
||||
|
||||
NSPV_evalcode_inmempool(evalcode,funcid);
|
||||
for (int i=0;i<NSPV_mempoolresult.numtxids;i++)
|
||||
{
|
||||
if (myGetTransaction(NSPV_mempoolresult.txids[i],tx,hashBlock)!=0) txs.push_back(tx);
|
||||
}
|
||||
return (NSPV_mempoolresult.numtxids);
|
||||
}
|
||||
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
|
||||
{
|
||||
txs.push_back(e.GetTx());
|
||||
i++;
|
||||
}
|
||||
return(i);
|
||||
}
|
||||
|
||||
/* Get the block merkle root for a proof
|
||||
* IN: proofData
|
||||
* OUT: merkle root
|
||||
@@ -327,16 +253,4 @@ bool hush_txnotarizedconfirmed(uint256 txid)
|
||||
return (false);
|
||||
}
|
||||
|
||||
// returns total of normal inputs signed with this pubkey
|
||||
int64_t TotalPubkeyNormalInputs(const CTransaction &tx, const CPubKey &pubkey)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// returns total of CC inputs signed with this pubkey
|
||||
int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern std::string MYCCLIBNAME;
|
||||
|
||||
@@ -4,7 +4,7 @@ CC_DARWIN = g++-8
|
||||
CC_WIN = x86_64-w64-mingw32-gcc-posix
|
||||
CC_AARCH64 = aarch64-linux-gnu-g++
|
||||
CFLAGS_DARWIN = -DBUILD_CUSTOMCC -std=c++11 -arch x86_64 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../leveldb/include -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib
|
||||
CFLAGS = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../leveldb/include -I.. -I. -fPIC -shared
|
||||
CFLAGS = -D_HAS_AUTO_PTR_ETC=0 -DBOOST_NO_CXX98_FUNCTION_BASE -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../leveldb/include -I.. -I. -fPIC -shared
|
||||
CFLAGS_WIN = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/x86_64-w64-mingw32/include -I../univalue/include -I../leveldb/include -I.. -I. -fPIC -shared
|
||||
DEBUGFLAGS = -O0 -D _DEBUG
|
||||
RELEASEFLAGS = -O2 -D NDEBUG -combine -fwhole-program
|
||||
|
||||
1027
src/chainparams.cpp
1027
src/chainparams.cpp
File diff suppressed because it is too large
Load Diff
@@ -12,16 +12,16 @@
|
||||
//
|
||||
static const uint8_t chainparams_seed_main[] = {
|
||||
0x01,0x04,0x67,0x45,0x80,0x94,0x00,0x00, // 103.69.128.148
|
||||
0x01,0x04,0xc2,0x1d,0x64,0xd0,0x00,0x00, // 194.29.100.208
|
||||
0x01,0x04,0xc2,0x1d,0x64,0xb3,0x00,0x00, // 194.29.100.179
|
||||
0x01,0x04,0x2d,0x84,0x4b,0x45,0x00,0x00, // 45.132.75.69
|
||||
0x01,0x04,0xaa,0xcd,0x27,0x27,0x00,0x00, // 170.205.39.39
|
||||
0x01,0x04,0xb2,0xfa,0xbd,0x8d,0x00,0x00, // 178.250.189.141
|
||||
0x01,0x04,0x95,0x1c,0x66,0xdb,0x00,0x00, // 149.28.102.219
|
||||
0x01,0x04,0x9b,0x8a,0xe4,0x44,0x00,0x00, // 155.138.228.68
|
||||
0x01,0x04,0x6b,0xae,0x46,0xfb,0x00,0x00, // 107.174.70.251
|
||||
0x04,0x20,0xef,0xad,0x0c,0x95,0x3e,0x61,0xee,0x69,0x57,0x67,0xdb,0x4f,0xb7,0x8d,0xc2,0x35,0x1c,0x6b,0x96,0xf4,0x1f,0x7a,0xb4,0x06,0x09,0x3a,0x64,0x33,0xf4,0x0b,0x2c,0x94,0x00,0x00, // 56wqzfj6mhxgsv3h3nh3pdocguogxfxud55libqjhjsdh5alfsko2iqd.onion
|
||||
0x04,0x20,0x3d,0x24,0x7a,0xec,0xfe,0x60,0x6e,0x3d,0x3d,0xf3,0x4f,0x35,0x12,0x29,0xdb,0x48,0x89,0x71,0x19,0xb9,0xee,0x6a,0xfd,0xb2,0x02,0xa7,0x99,0x89,0xbb,0x69,0x39,0xdb,0x00,0x00, // hushv3h6mbxd2pptj42reko3jcexcgnz5zvp3mqcu6myto3jhhn4yzyd.onion
|
||||
0x04,0x20,0x3d,0x24,0x7a,0xee,0xf5,0x39,0x20,0x7e,0x69,0x92,0xda,0xc7,0xa6,0x9f,0xbd,0xeb,0x29,0x21,0x20,0x93,0x52,0x03,0xf3,0x60,0x41,0xfc,0xb8,0xf9,0x06,0x29,0x96,0x24,0x00,0x00, // hushv3xvheqh42ms3ld2nh555muscietkib7gycb7s4psbrjsysfywqd.onion
|
||||
0x01,0x04,0xb2,0xfa,0xbd,0x8d,0x00,0x00, // 178.250.189.141
|
||||
0x04,0x20,0x0e,0x86,0xb6,0xfd,0x96,0xfe,0x06,0xda,0x39,0xeb,0x97,0x39,0xc9,0xd1,0x17,0xa2,0x4e,0x2b,0x75,0x4d,0xeb,0xb5,0xa1,0x34,0x1e,0x34,0x0a,0xcb,0x68,0xab,0xf0,0xe2,0x00,0x00, // b2dln7mw7ydnuopls444tuixujhcw5kn5o22cna6gqfmw2fl6drb5nad.onion
|
||||
0x04,0x20,0x1c,0x96,0x10,0x03,0xa6,0xa4,0xfa,0xa0,0x3e,0x13,0x1f,0x38,0xf0,0x9b,0xdd,0x9b,0xd7,0xdc,0x0e,0x40,0x61,0x71,0xed,0x1d,0x21,0x58,0xce,0x59,0x55,0x5e,0xe4,0x25,0x00,0x00, // dslbaa5gut5kapqtd44pbg65tpl5ydsamfy62hjbldhfsvk64qs57pyd.onion
|
||||
0x04,0x20,0xac,0xa0,0x3a,0x31,0xa7,0xea,0x8e,0x90,0xc7,0x2b,0xbb,0x89,0x41,0x05,0x48,0xa0,0x10,0x29,0x8f,0x38,0x16,0xc9,0x94,0xbe,0xef,0x7e,0x9e,0x7d,0x98,0xb6,0x76,0x9f,0x00,0x00, // vsqdumnh5khjbrzlxoeucbkiuaictdzyc3ezjpxpp2ph3gfwo2ptjmyd.onion
|
||||
0x02,0x10,0x2a,0x0c,0xb6,0x41,0x06,0xf1,0x01,0x8e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00, // 2a0c:b641:6f1:18e::2
|
||||
0x02,0x10,0x24,0x06,0xef,0x80,0x00,0x03,0x12,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, // 2406:ef80:3:1269::1
|
||||
0x02,0x10,0x24,0x06,0xef,0x80,0x00,0x02,0x3b,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, // 2406:ef80:2:3b59::1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2016-2017 The Zcash developers
|
||||
// Copyright (c) 2016-2024 The Hush developers
|
||||
// Copyright (c) 2016-2025 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
// What happened to the SuperNET developers, who cared about privacy?
|
||||
@@ -30,7 +30,7 @@
|
||||
// Must be kept in sync with configure.ac , ugh!
|
||||
#define CLIENT_VERSION_MAJOR 3
|
||||
#define CLIENT_VERSION_MINOR 10
|
||||
#define CLIENT_VERSION_REVISION 3
|
||||
#define CLIENT_VERSION_REVISION 4
|
||||
#define CLIENT_VERSION_BUILD 50
|
||||
|
||||
//! Set to true for release, false for prerelease or test build
|
||||
|
||||
@@ -557,8 +557,6 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
|
||||
CAmount value,nResult = 0;
|
||||
if ( interestp != 0 )
|
||||
*interestp = 0;
|
||||
//if ( tx.IsCoinImport() )
|
||||
// return GetCoinImportValue(tx);
|
||||
if ( tx.IsCoinBase() != 0 )
|
||||
return 0;
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
@@ -616,7 +614,7 @@ double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight) const
|
||||
// use the maximum priority for all (partially or fully) shielded transactions.
|
||||
// (Note that coinbase transactions cannot contain Sapling shielded Spends or Outputs.)
|
||||
|
||||
if (tx.vShieldedSpend.size() > 0 || tx.vShieldedOutput.size() > 0 || tx.IsCoinImport() ) { // || tx.IsPegsImport()) {
|
||||
if (tx.vShieldedSpend.size() > 0 || tx.vShieldedOutput.size() > 0 ) {
|
||||
return MAX_PRIORITY;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ const uint32_t nHushHardforkHeight4 = 1605555;
|
||||
const uint32_t nHushHardforkTimestamp = 1580303652; // Jan 29nd 1pm GMT
|
||||
const uint32_t nHushHardforkTimestamp2 = 1594425600; // Jul 11th 12a GMT
|
||||
|
||||
// Used by HSCs
|
||||
// Used by HACs
|
||||
static const uint32_t HUSH_SEASON_TIMESTAMPS[NUM_HUSH_SEASONS] = {1525132800, 1563148800, nHushHardforkTimestamp, nHushHardforkTimestamp2, nHushHardforkTimestamp2*5, nHushHardforkTimestamp2*6, nHushHardforkTimestamp2*7};
|
||||
|
||||
// Used by HUSH3+TUSH
|
||||
|
||||
@@ -50,6 +50,8 @@ int32_t HUSH_INSYNC,HUSH_LASTMINED,prevHUSH_LASTMINED,HUSH_CCACTIVATE;
|
||||
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB;
|
||||
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA;
|
||||
int8_t ASSETCHAINS_ADAPTIVEPOW;
|
||||
uint8_t ASSETCHAINS_BURN = 0;
|
||||
uint32_t ASSETCHAINS_MINOPRETURNFEE = 0;
|
||||
std::vector<uint8_t> Mineropret;
|
||||
std::vector<std::string> vAllowListAddress;
|
||||
char NOTARYADDRS[64][64];
|
||||
|
||||
@@ -233,64 +233,6 @@ public:
|
||||
DefaultCCChecker() { }
|
||||
virtual bool checkCC(uint256 txid, const std::vector<CTxOut> &vouts, int32_t nvout, uint8_t evalcode, std::string funcids, uint256 filtertxid)
|
||||
{
|
||||
CScript opret, dummy;
|
||||
std::vector< vscript_t > vParams;
|
||||
vscript_t vopret;
|
||||
|
||||
if (nvout < vouts.size())
|
||||
{
|
||||
// first check if it is cc vout
|
||||
if (vouts[nvout].scriptPubKey.IsPayToCryptoCondition(&dummy, vParams))
|
||||
{
|
||||
// try to find cc opret
|
||||
if (vParams.size() > 0)
|
||||
{
|
||||
COptCCParams p(vParams[0]); // parse vout data
|
||||
if (p.vData.size() > 0)
|
||||
{
|
||||
vopret = p.vData[0]; // get opret data
|
||||
}
|
||||
}
|
||||
// if no cc opret check last vout opret
|
||||
if (vopret.size() == 0)
|
||||
{
|
||||
GetOpReturnData(vouts.back().scriptPubKey, vopret);
|
||||
}
|
||||
if (vopret.size() > 2)
|
||||
{
|
||||
uint8_t opretEvalcode, opretFuncid;
|
||||
uint256 opretTxid;
|
||||
bool isEof = true;
|
||||
bool isCreateTx = false;
|
||||
|
||||
// parse opret first 3 fields:
|
||||
bool parseOk = E_UNMARSHAL(vopret,
|
||||
ss >> opretEvalcode;
|
||||
ss >> opretFuncid;
|
||||
if (funcids.size() > 0 && opretFuncid == funcids[0]) // this means that we check txid only for second+ funcid in array (considering that the first funcid is the creation txid itself like tokens)
|
||||
{
|
||||
isCreateTx = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss >> opretTxid;
|
||||
isCreateTx = false;
|
||||
}
|
||||
isEof = ss.eof(); );
|
||||
|
||||
opretTxid = revuint256(opretTxid);
|
||||
std::cerr << __func__ << " " << "opretEvalcode=" << opretEvalcode << " opretFuncid=" << (char)opretFuncid << " isCreateTx=" << isCreateTx << " opretTxid=" << opretTxid.GetHex() << std::endl;
|
||||
if( parseOk /*parseOk=true if eof reached*/|| !isEof /*more data means okay*/)
|
||||
{
|
||||
if (evalcode == opretEvalcode && std::find(funcids.begin(), funcids.end(), (char)opretFuncid) != funcids.end() &&
|
||||
(isCreateTx && filtertxid == txid || !isCreateTx && filtertxid == opretTxid))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -352,69 +294,9 @@ int32_t NSPV_mempoolfuncs(bits256 *satoshisp,int32_t *vindexp,std::vector<uint25
|
||||
int32_t num = 0,vini = 0,vouti = 0; uint8_t evalcode=0,func=0; std::vector<uint8_t> vopret; char destaddr[64];
|
||||
*vindexp = -1;
|
||||
memset(satoshisp,0,sizeof(*satoshisp));
|
||||
/*
|
||||
if ( funcid == NSPV_CC_TXIDS)
|
||||
{
|
||||
std::vector<std::pair<CAddressIndexKey, CAmount> > tmp_txids; uint256 tmp_txid,hashBlock;
|
||||
int32_t n=0,skipcount=vout>>16; uint8_t eval=(vout>>8)&0xFF, func=vout&0xFF;
|
||||
|
||||
CTransaction tx;
|
||||
SetCCtxids(tmp_txids,coinaddr,isCC);
|
||||
if ( skipcount < 0 ) skipcount = 0;
|
||||
if ( skipcount >= tmp_txids.size() )
|
||||
skipcount = tmp_txids.size()-1;
|
||||
if ( tmp_txids.size()-skipcount > 0 )
|
||||
{
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=tmp_txids.begin(); it!=tmp_txids.end(); it++)
|
||||
{
|
||||
if (txid!=zeroid || func!=0)
|
||||
{
|
||||
myGetTransaction(it->first.txhash,tx,hashBlock);
|
||||
std::vector<std::pair<uint8_t, vscript_t>> oprets; uint256 tokenid,txid;
|
||||
std::vector<uint8_t> vopret,vOpretExtra; uint8_t *script,e,f,tokenevalcode;
|
||||
std::vector<CPubKey> pubkeys;
|
||||
|
||||
if (DecodeTokenOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,tokenevalcode,tokenid,pubkeys,oprets)!=0 && GetOpretBlob(oprets, OPRETID_CHANNELSDATA, vOpretExtra) && tokenevalcode==EVAL_TOKENS && vOpretExtra.size()>0)
|
||||
{
|
||||
vopret=vOpretExtra;
|
||||
}
|
||||
else GetOpReturnData(tx.vout[tx.vout.size()-1].scriptPubKey, vopret);
|
||||
script = (uint8_t *)vopret.data();
|
||||
if ( vopret.size() > 2 && script[0]==eval )
|
||||
{
|
||||
switch (eval)
|
||||
{
|
||||
case EVAL_CHANNELS:EVAL_PEGS:EVAL_ORACLES:EVAL_GAMES:EVAL_IMPORTGATEWAY:EVAL_ROGUE:
|
||||
E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> tmp_txid;);
|
||||
if (e!=eval || (txid!=zeroid && txid!=tmp_txid) || (func!=0 && f!=func)) continue;
|
||||
break;
|
||||
case EVAL_TOKENS:EVAL_DICE:EVAL_DILITHIUM:EVAL_FAUCET:EVAL_LOTO:EVAL_PAYMENTS:EVAL_REWARDS:
|
||||
E_UNMARSHAL(vopret,ss >> e; ss >> f;);
|
||||
if (e!=eval || (func!=0 && f!=func)) continue;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( n >= skipcount ) txids.push_back(it->first.txhash);
|
||||
n++;
|
||||
}
|
||||
return (n-skipcount);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
*/
|
||||
if ( mempool.size() == 0 )
|
||||
return(0);
|
||||
/*
|
||||
if ( funcid == NSPV_MEMPOOL_CCEVALCODE )
|
||||
{
|
||||
isCC = true;
|
||||
evalcode = vout & 0xff;
|
||||
func = (vout >> 8) & 0xff;
|
||||
}
|
||||
*/
|
||||
|
||||
LOCK(mempool.cs);
|
||||
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
|
||||
{
|
||||
|
||||
@@ -322,31 +322,14 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
|
||||
}
|
||||
else if ( bitcoin_base58decode(rmd160,destaddr) != 25 )
|
||||
{
|
||||
if ( (len= is_hexstr(destaddr,0)) > 0 )
|
||||
{
|
||||
len >>= 1;
|
||||
data.resize(len);
|
||||
decode_hex(&data[0],len,destaddr);
|
||||
if ( data[len-1] == OP_CHECKCRYPTOCONDITION )
|
||||
{
|
||||
data.resize(--len);
|
||||
scriptPubKey = CScript() << data << OP_CHECKCRYPTOCONDITION;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error","only CC hex allowed for now"));
|
||||
return(result); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (len= is_hexstr(destaddr,0)) > 0 ) {
|
||||
result.push_back(Pair("result","error"));
|
||||
return(result);
|
||||
} else {
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error","invalid destaddr/CCvout hex"));
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
data.resize(20);
|
||||
memcpy(&data[0],&rmd160[1],20);
|
||||
scriptPubKey = (CScript() << OP_DUP << OP_HASH160 << ParseHex(HexStr(data)) << OP_EQUALVERIFY << OP_CHECKSIG);
|
||||
|
||||
@@ -102,7 +102,7 @@ int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp)
|
||||
int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp;
|
||||
static uint8_t hush_pubkeys[NUM_HUSH_SEASONS][64][33],didinit[NUM_HUSH_SEASONS];
|
||||
|
||||
//HUSH3+TUSH use block heights, HSCs use timestamps
|
||||
//HUSH3+TUSH use block heights, HACs use timestamps
|
||||
if ( timestamp == 0 && SMART_CHAIN_SYMBOL[0] != 0 ) {
|
||||
timestamp = hush_heightstamp(height);
|
||||
} else if ( SMART_CHAIN_SYMBOL[0] == 0 ) {
|
||||
@@ -113,7 +113,7 @@ int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp)
|
||||
int32_t hush_season = 0;
|
||||
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
||||
bool istush = strncmp(SMART_CHAIN_SYMBOL, "TUSH",4) == 0 ? true : false;
|
||||
// TUSH uses height activation like HUSH3, other HSCs use timestamps
|
||||
// TUSH uses height activation like HUSH3, other HACs use timestamps
|
||||
hush_season = (ishush3 || istush) ? gethushseason(height) : getacseason(timestamp);
|
||||
|
||||
if(IS_HUSH_NOTARY) {
|
||||
|
||||
@@ -1805,14 +1805,23 @@ void hush_args(char *argv0)
|
||||
if (ishush3) {
|
||||
HUSH_nodes = {"node1.hush.is","node2.hush.is","node3.hush.is",
|
||||
"node4.hush.is","node5.hush.is","node6.hush.is",
|
||||
"node7.hush.is","node8.hush.is","node1.hush.land",
|
||||
"node2.hush.land","node3.hush.land","node4.hush.land",
|
||||
"node5.hush.land","node6.hush.land","node7.hush.land"};
|
||||
"node7.hush.is","node8.hush.is",
|
||||
"178.250.189.141",
|
||||
"31.202.19.157",
|
||||
"45.132.75.69",
|
||||
"45.63.58.167",
|
||||
"b2dln7mw7ydnuopls444tuixujhcw5kn5o22cna6gqfmw2fl6drb5nad.onion",
|
||||
"dslbaa5gut5kapqtd44pbg65tpl5ydsamfy62hjbldhfsvk64qs57pyd.onion",
|
||||
"vsqdumnh5khjbrzlxoeucbkiuaictdzyc3ezjpxpp2ph3gfwo2ptjmyd.onion",
|
||||
"plrobkepqjxs2cmig273mxnqh3qhuhdaioyb2n5kafn264ramb7tqxid.onion"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
if (isdragonx) {
|
||||
DRAGONX_nodes = {"node1.dragonx.is","node2.dragonx.is","node3.dragonx.is",
|
||||
"node4.dragonx.is","node5.dragonx.is","node6.dragonx.is"};
|
||||
"node4.dragonx.is","node5.dragonx.is","node6.dragonx.is"
|
||||
};
|
||||
}
|
||||
|
||||
vector<string> more_nodes = mapMultiArgs["-addnode"];
|
||||
@@ -1843,7 +1852,9 @@ void hush_args(char *argv0)
|
||||
HUSH_SNAPSHOT_INTERVAL = GetArg("-ac_snapshot",0);
|
||||
Split(GetArg("-ac_nk",""), sizeof(ASSETCHAINS_NK)/sizeof(*ASSETCHAINS_NK), ASSETCHAINS_NK, 0);
|
||||
|
||||
|
||||
ASSETCHAINS_BURN = GetArg("-ac_burn", 0);
|
||||
ASSETCHAINS_MINOPRETURNFEE = GetArg("-ac_minopreturnfee", 0);
|
||||
|
||||
// -ac_ccactivateht=evalcode,height,evalcode,height,evalcode,height....
|
||||
Split(GetArg("-ac_ccactivateht",""), sizeof(ccEnablesHeight)/sizeof(*ccEnablesHeight), ccEnablesHeight, 0);
|
||||
// fill map with all eval codes and activation height of 0.
|
||||
@@ -1859,7 +1870,7 @@ void hush_args(char *argv0)
|
||||
fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode);
|
||||
else if ( ht > 0 )
|
||||
{
|
||||
// update global map.
|
||||
// update global map.
|
||||
mapHeightEvalActivate[ecode] = ht;
|
||||
fprintf(stderr, "ac_ccactivateht: ecode.%i activates at height.%i\n", ecode, mapHeightEvalActivate[ecode]);
|
||||
}
|
||||
@@ -2169,7 +2180,7 @@ void hush_args(char *argv0)
|
||||
}
|
||||
}
|
||||
|
||||
if ( ASSETCHAINS_ENDSUBSIDY[0] != 0 || ASSETCHAINS_REWARD[0] != 0 || ASSETCHAINS_HALVING[0] != 0 || ASSETCHAINS_DECAY[0] != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 || ASSETCHAINS_TXPOW != 0 || ASSETCHAINS_FOUNDERS != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1 || ASSETCHAINS_SELFIMPORT.size() > 0 || ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_TIMELOCKGTE != _ASSETCHAINS_TIMELOCKOFF|| ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH || ASSETCHAINS_LWMAPOS != 0 || ASSETCHAINS_LASTERA > 0 || ASSETCHAINS_BEAMPORT != 0 || ASSETCHAINS_CODAPORT != 0 || ASSETCHAINS_MARMARA != 0 || nonz > 0 || ASSETCHAINS_CCLIB.size() > 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 || ASSETCHAINS_NOTARY_PAY[0] != 0 || ASSETCHAINS_BLOCKTIME != 60 || ASSETCHAINS_CBOPRET != 0 || Mineropret.size() != 0 || (ASSETCHAINS_NK[0] != 0 && ASSETCHAINS_NK[1] != 0) || HUSH_SNAPSHOT_INTERVAL != 0 || ASSETCHAINS_EARLYTXIDCONTRACT != 0 || ASSETCHAINS_CBMATURITY != 0 || ASSETCHAINS_ADAPTIVEPOW != 0 )
|
||||
if ( ASSETCHAINS_ENDSUBSIDY[0] != 0 || ASSETCHAINS_REWARD[0] != 0 || ASSETCHAINS_HALVING[0] != 0 || ASSETCHAINS_DECAY[0] != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 || ASSETCHAINS_TXPOW != 0 || ASSETCHAINS_FOUNDERS != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1 || ASSETCHAINS_SELFIMPORT.size() > 0 || ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_TIMELOCKGTE != _ASSETCHAINS_TIMELOCKOFF|| ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH || ASSETCHAINS_LWMAPOS != 0 || ASSETCHAINS_LASTERA > 0 || ASSETCHAINS_BEAMPORT != 0 || ASSETCHAINS_CODAPORT != 0 || ASSETCHAINS_MARMARA != 0 || nonz > 0 || ASSETCHAINS_CCLIB.size() > 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 || ASSETCHAINS_NOTARY_PAY[0] != 0 || ASSETCHAINS_BLOCKTIME != 60 || ASSETCHAINS_CBOPRET != 0 || Mineropret.size() != 0 || (ASSETCHAINS_NK[0] != 0 && ASSETCHAINS_NK[1] != 0) || HUSH_SNAPSHOT_INTERVAL != 0 || ASSETCHAINS_EARLYTXIDCONTRACT != 0 || ASSETCHAINS_CBMATURITY != 0 || ASSETCHAINS_ADAPTIVEPOW != 0 || ASSETCHAINS_BURN != 0 || ASSETCHAINS_MINOPRETURNFEE)
|
||||
{
|
||||
if(fDebug)
|
||||
fprintf(stderr,"perc %.4f%% ac_pub=[%02x%02x%02x...] acsize.%d\n",dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0],ASSETCHAINS_OVERRIDE_PUBKEY33[1],ASSETCHAINS_OVERRIDE_PUBKEY33[2],(int32_t)ASSETCHAINS_SCRIPTPUB.size());
|
||||
@@ -2329,6 +2340,16 @@ void hush_args(char *argv0)
|
||||
}
|
||||
if ( ASSETCHAINS_ADAPTIVEPOW != 0 )
|
||||
extraptr[extralen++] = ASSETCHAINS_ADAPTIVEPOW;
|
||||
|
||||
if ( ASSETCHAINS_BURN != 0 )
|
||||
{
|
||||
extralen += dragon_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_BURN),(void *)&ASSETCHAINS_BURN);
|
||||
}
|
||||
|
||||
if ( ASSETCHAINS_MINOPRETURNFEE != 0 )
|
||||
{
|
||||
extralen += dragon_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_MINOPRETURNFEE),(void *)&ASSETCHAINS_MINOPRETURNFEE);
|
||||
}
|
||||
}
|
||||
|
||||
addn = GetArg("-seednode","");
|
||||
|
||||
52
src/init.cpp
52
src/init.cpp
@@ -429,8 +429,10 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-i2psam=<ip:port>", strprintf(_("I2P SAM proxy to reach I2P peers and accept I2P connections (default: none)")));
|
||||
strUsage += HelpMessageOpt("-i2pacceptincoming", strprintf(_("If set and -i2psam is also set then incoming I2P connections are accepted via the SAM proxy. If this is not set but -i2psam is set then only outgoing connections will be made to the I2P network. Ignored if -i2psam is not set. Listening for incoming I2P connections is done through the SAM proxy, not by binding to a local address and port (default: 1)")));
|
||||
strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6, onion or i2p)"));
|
||||
strUsage += HelpMessageOpt("-disableipv4", _("Disable Ipv4 network connections") + " " + _("(default: 0)"));
|
||||
strUsage += HelpMessageOpt("-disableipv6", _("Disable Ipv6 network connections") + " " + _("(default: 0)"));
|
||||
strUsage += HelpMessageOpt("-disableipv4", _("Disable Ipv4 network connections") + " " + strprintf(_("(default: %u)"), DEFAULT_DISABLE_IPV4));
|
||||
strUsage += HelpMessageOpt("-disableipv6", _("Disable Ipv6 network connections") + " " + strprintf(_("(default: %u)"), DEFAULT_DISABLE_IPV6));
|
||||
|
||||
strUsage += HelpMessageOpt("-clearnet", _("Enable clearnet connections. Setting to 0 will disable clearnet and use sane defaults for Tor/i2p") + " " + strprintf(_("(default: %u)"), DEFAULT_CLEARNET));
|
||||
|
||||
strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), 1));
|
||||
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with Bloom filters (default: %u)"), 1));
|
||||
@@ -601,6 +603,8 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-ac_algo", _("Choose PoW mining algorithm, either 'equihash' or 'randomx'. default is Equihash (200,9)"));
|
||||
strUsage += HelpMessageOpt("-ac_blocktime", _("Block time in seconds, default is 60"));
|
||||
strUsage += HelpMessageOpt("-ac_beam", _("BEAM integration"));
|
||||
strUsage += HelpMessageOpt("-ac_burn", _("Allow sending funds to the transparent burn address when -ac_private=1"));
|
||||
strUsage += HelpMessageOpt("-ac_minopreturnfee", _("OP_RETURN minimum fee per tx, regardless of tx size, default is 1 coin"));
|
||||
strUsage += HelpMessageOpt("-ac_coda", _("CODA integration"));
|
||||
strUsage += HelpMessageOpt("-ac_decay", _("Percentage of block reward decrease at each halving"));
|
||||
strUsage += HelpMessageOpt("-ac_end", _("Block height at which block rewards will end"));
|
||||
@@ -1643,12 +1647,38 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
//fprintf(stderr,"%s tik18\n", __FUNCTION__);
|
||||
|
||||
// Disable clearnet peers if -clearnet=0
|
||||
if (!GetBoolArg("-clearnet", DEFAULT_CLEARNET)) {
|
||||
#ifdef ENABLE_MINING
|
||||
// mining to the same taddr links different txs together as from the same owner
|
||||
// and if using -clearnet=0 that can be used to link together different .onions
|
||||
// as being the same entity, because they are mining to the same taddr
|
||||
if (mapArgs.count("-mineraddress")) {
|
||||
return InitError(_("-mineraddress and -clearnet=0 cannot be used together because it would reduce your privacy!"));
|
||||
}
|
||||
#endif
|
||||
SoftSetBoolArg("-disableipv4", true);
|
||||
SoftSetBoolArg("-disableipv6", true);
|
||||
SoftSetBoolArg("-dns", false);
|
||||
SoftSetBoolArg("-dnsseed", false);
|
||||
SoftSetArg("-bind", "127.0.0.1");
|
||||
SoftSetArg("-onlynet", "onion");
|
||||
SoftSetArg("-onlynet", "i2p");
|
||||
SoftSetArg("-onion", "127.0.0.1:9050");
|
||||
SoftSetArg("-i2psam", "127.0.0.1:7656");
|
||||
}
|
||||
|
||||
if (mapArgs.count("-onlynet")) {
|
||||
std::set<enum Network> nets;
|
||||
BOOST_FOREACH(const std::string& snet, mapMultiArgs["-onlynet"]) {
|
||||
enum Network net = ParseNetwork(snet);
|
||||
if (net == NET_UNROUTABLE)
|
||||
if (net == NET_UNROUTABLE) {
|
||||
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
|
||||
} else if (net == NET_IPV4 && GetBoolArg("-disableipv4", DEFAULT_DISABLE_IPV4)) {
|
||||
return InitError(strprintf(_("-onlynet=ipv4 is incompatible with -disableipv4 !")));
|
||||
} else if (net == NET_IPV6 && GetBoolArg("-disableipv6", DEFAULT_DISABLE_IPV4)) {
|
||||
return InitError(strprintf(_("-onlynet=ipv6 is incompatible with -disableipv6 !")));
|
||||
}
|
||||
nets.insert(net);
|
||||
}
|
||||
for (int n = 0; n < NET_MAX; n++) {
|
||||
@@ -1658,6 +1688,22 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
}
|
||||
|
||||
if(mapMultiArgs["-disableipv6"].size() > 1) {
|
||||
return InitError("-disableipv6 can only be used once");
|
||||
}
|
||||
|
||||
if(mapMultiArgs["-disableipv4"].size() > 1) {
|
||||
return InitError("-disableipv4 can only be used once");
|
||||
}
|
||||
|
||||
if (GetBoolArg("-disableipv6", DEFAULT_DISABLE_IPV6)) {
|
||||
SetReachable(NET_IPV6, false);
|
||||
}
|
||||
|
||||
if (GetBoolArg("-disableipv4", DEFAULT_DISABLE_IPV4)) {
|
||||
SetReachable(NET_IPV4, false);
|
||||
}
|
||||
|
||||
//fprintf(stderr,"%s tik19\n", __FUNCTION__);
|
||||
if (mapArgs.count("-allowlist")) {
|
||||
BOOST_FOREACH(const std::string& net, mapMultiArgs["-allowlist"]) {
|
||||
|
||||
105
src/main.cpp
105
src/main.cpp
@@ -817,7 +817,7 @@ bool hush_dailysnapshot(int32_t height)
|
||||
{
|
||||
uint256 blockhash; CTransaction txin;
|
||||
//if (tx.IsPegsImport() && j==0) continue;
|
||||
if ( !tx.IsCoinImport() && !tx.IsCoinBase() && myGetTransaction(tx.vin[j].prevout.hash,txin,blockhash) )
|
||||
if ( !tx.IsCoinBase() && myGetTransaction(tx.vin[j].prevout.hash,txin,blockhash) )
|
||||
{
|
||||
int vout = tx.vin[j].prevout.n;
|
||||
if ( ExtractDestination(txin.vout[vout].scriptPubKey, vDest) )
|
||||
@@ -994,11 +994,10 @@ bool IsStandardTx(const CTransaction& tx, string& reason, const int nHeight)
|
||||
}
|
||||
nDataOut++;
|
||||
//fprintf(stderr,"is OP_RETURN\n");
|
||||
}
|
||||
else if ((whichType == TX_MULTISIG) && (!fIsBareMultisigStd)) {
|
||||
} else if ((whichType == TX_MULTISIG) && (!fIsBareMultisigStd)) {
|
||||
reason = "bare-multisig";
|
||||
return false;
|
||||
} else if (whichType != TX_CRYPTOCONDITION && txout.IsDust(::minRelayTxFee)) {
|
||||
} else if (txout.IsDust(::minRelayTxFee)) {
|
||||
reason = "dust";
|
||||
return false;
|
||||
}
|
||||
@@ -1103,8 +1102,8 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs,
|
||||
if (tx.IsCoinBase())
|
||||
return true; // Coinbases don't use vin normally
|
||||
|
||||
if (tx.IsCoinImport())
|
||||
return tx.vin[0].scriptSig.IsCoinImport();
|
||||
//if (tx.IsCoinImport())
|
||||
// return tx.vin[0].scriptSig.IsCoinImport();
|
||||
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
@@ -1180,7 +1179,7 @@ unsigned int GetLegacySigOpCount(const CTransaction& tx)
|
||||
|
||||
unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& inputs)
|
||||
{
|
||||
if (tx.IsCoinBase() || tx.IsCoinImport())
|
||||
if (tx.IsCoinBase())
|
||||
return 0;
|
||||
|
||||
unsigned int nSigOps = 0;
|
||||
@@ -1223,16 +1222,6 @@ bool ContextualCheckTransaction(int32_t slowflag,const CBlock *block, CBlockInde
|
||||
{
|
||||
const bool overwinterActive = nHeight >=1 ? true : false; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
|
||||
const bool saplingActive = nHeight >=1 ? true : false; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
|
||||
const bool isSprout = false; //!overwinterActive;
|
||||
|
||||
/*
|
||||
// If Sprout rules apply, reject transactions which are intended for Overwinter and beyond
|
||||
if (isSprout && tx.fOverwintered) {
|
||||
int32_t ht = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight;
|
||||
return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active");
|
||||
//return state.DoS(isInitBlockDownload() ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active");
|
||||
}
|
||||
*/
|
||||
|
||||
if (saplingActive) {
|
||||
// Reject transactions with valid version but missing overwintered flag
|
||||
@@ -1531,11 +1520,20 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
||||
{
|
||||
char destaddr[65];
|
||||
Getscriptaddress(destaddr,txout.scriptPubKey);
|
||||
|
||||
if ( hush_isnotaryvout(destaddr,tiptime) == 0 )
|
||||
{
|
||||
invalid_private_taddr = 1;
|
||||
fprintf(stderr,"%s: invalid taddr %s on private chain!\n", __func__, destaddr);
|
||||
//return state.DoS(100, error("CheckTransaction(): this is a private chain, no public allowed"),REJECT_INVALID, "bad-txns-acprivacy-chain");
|
||||
const bool isburn = (strcmp(destaddr,BURN_ADDRESS) == 0);
|
||||
if ((ASSETCHAINS_BURN == 1) && isburn && tx.vin.empty()) {
|
||||
// -ac_burn=1 means only zaddrs can send to the burn address
|
||||
fprintf(stderr,"%s: allowing zaddr to send to burn address %s on private chain because ac_burn=1\n", __func__, destaddr);
|
||||
} else if ((ASSETCHAINS_BURN == 2) && isburn) {
|
||||
// -ac_burn=2 allows notary taddrs to send directly to the burn address
|
||||
fprintf(stderr,"%s: allowing burn address %s on private chain because ac_burn=2\n", __func__, destaddr);
|
||||
} else {
|
||||
invalid_private_taddr = 1;
|
||||
fprintf(stderr,"%s: invalid taddr %s on private chain!\n", __func__, destaddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1899,13 +1897,11 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
// Keep track of transactions that spend a coinbase, which we re-scan
|
||||
// during reorgs to ensure COINBASE_MATURITY is still met.
|
||||
bool fSpendsCoinbase = false;
|
||||
if (!tx.IsCoinImport()) { // && !tx.IsPegsImport()) {
|
||||
BOOST_FOREACH(const CTxIn &txin, tx.vin) {
|
||||
const CCoins *coins = view.AccessCoins(txin.prevout.hash);
|
||||
if (coins->IsCoinBase()) {
|
||||
fSpendsCoinbase = true;
|
||||
break;
|
||||
}
|
||||
BOOST_FOREACH(const CTxIn &txin, tx.vin) {
|
||||
const CCoins *coins = view.AccessCoins(txin.prevout.hash);
|
||||
if (coins->IsCoinBase()) {
|
||||
fSpendsCoinbase = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Grab the branch ID we expect this transaction to commit to. We don't
|
||||
@@ -1937,7 +1933,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
// Continuously rate-limit free (really, very-low-fee) transactions
|
||||
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to
|
||||
// be annoying or make others' transactions take longer to confirm.
|
||||
if (fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) && !tx.IsCoinImport() )
|
||||
if (fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) )
|
||||
{
|
||||
static CCriticalSection csFreeLimiter;
|
||||
static double dFreeCount;
|
||||
@@ -1960,6 +1956,9 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
dFreeCount += nSize;
|
||||
}
|
||||
|
||||
fRejectAbsurdFee = false;
|
||||
|
||||
if ( fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000 && nFees > nValueOut/19)
|
||||
// Disable checks for absurd fees when adding to the mempool. Instead, this check is done
|
||||
// when a user attempts to make a transaction with an absurd fee and only rejects absurd
|
||||
// fees when OP_RETURN data is NOT being used. This means users making normal financial
|
||||
@@ -1968,9 +1967,6 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
// It would be nice to detect the use of OP_RETURN right here but it seems to only be known
|
||||
// inside of IsStandard() inside of IsStandardTx() and we want to avoid doing expensive checks
|
||||
// multiple times.
|
||||
fRejectAbsurdFee = false;
|
||||
|
||||
if (fRejectAbsurdFee && !tx.IsCoinImport() && nFees > ::minRelayTxFee.GetFee(nSize) * 10000 && nFees > nValueOut/19)
|
||||
{
|
||||
string errmsg = strprintf("absurdly high fees %s, %d > %d",
|
||||
hash.ToString(),
|
||||
@@ -2018,17 +2014,15 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
LOCK(pool.cs);
|
||||
// Store transaction in memory
|
||||
pool.addUnchecked(hash, entry, !IsInitialBlockDownload());
|
||||
if (!tx.IsCoinImport())
|
||||
{
|
||||
// Add memory address index
|
||||
if (fAddressIndex) {
|
||||
pool.addAddressIndex(entry, view);
|
||||
}
|
||||
|
||||
// Add memory spent index
|
||||
if (fSpentIndex) {
|
||||
pool.addSpentIndex(entry, view);
|
||||
}
|
||||
// Add memory address index
|
||||
if (fAddressIndex) {
|
||||
pool.addAddressIndex(entry, view);
|
||||
}
|
||||
|
||||
// Add memory spent index
|
||||
if (fSpentIndex) {
|
||||
pool.addSpentIndex(entry, view);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2684,6 +2678,31 @@ namespace Consensus {
|
||||
if (!MoneyRange(nFees))
|
||||
return state.DoS(100, error("CheckInputs(): nFees out of range"),
|
||||
REJECT_INVALID, "bad-txns-fee-outofrange");
|
||||
|
||||
//NOTE: Since we have access to fee here, verify that opreturn pays
|
||||
//required minimum fee, even though this is a check on outputs not
|
||||
//inputs. If we don't do it here we would need to duplicate already
|
||||
//done work somewhere else
|
||||
|
||||
if ( ASSETCHAINS_MINOPRETURNFEE > 0 ) {
|
||||
BOOST_FOREACH(const CTxOut& txout, tx.vout) {
|
||||
const bool isopret = txout.scriptPubKey.IsOpReturn();
|
||||
|
||||
// HUSH+DRGX do not use -ac_minopreturnfee so this does not (yet)
|
||||
// affect those chains, they will need a height activated consensus
|
||||
// change
|
||||
|
||||
if ( isopret ) {
|
||||
// Is there any difference between nTxFee and nFees ?
|
||||
// They seem to be 2 vars with the same value
|
||||
fprintf(stderr,"%s: opreturn=1 nFees=%ld nTxFee=%ld\n", __func__, nFees, nTxFee);
|
||||
if (nTxFee < ASSETCHAINS_MINOPRETURNFEE) {
|
||||
return state.DoS(100,error("CheckInputs(): tx does not have required mininum fee for OP_RETURN"), REJECT_INVALID, "bad-txns-minopreturnfee");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}// namespace Consensus
|
||||
@@ -2909,10 +2928,6 @@ int8_t GetAddressType(const CScript &scriptPubKey, CTxDestination &vDest, txnout
|
||||
{
|
||||
keyType = 2;
|
||||
}
|
||||
else if (txType == TX_CRYPTOCONDITION )
|
||||
{
|
||||
keyType = 3;
|
||||
}
|
||||
}
|
||||
return keyType;
|
||||
}
|
||||
|
||||
111
src/miner.cpp
111
src/miner.cpp
@@ -118,6 +118,7 @@ public:
|
||||
|
||||
extern int8_t ASSETCHAINS_ADAPTIVEPOW;
|
||||
extern uint32_t ASSETCHAINS_RANDOMX;
|
||||
extern uint32_t ASSETCHAINS_MINOPRETURNFEE;
|
||||
extern bool fRandomXDebug;
|
||||
extern std::string devtax_scriptpub_for_height(uint32_t nHeight);
|
||||
|
||||
@@ -200,19 +201,20 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
//fprintf(stderr,"%s: added dummy coinbase\n", __func__);
|
||||
|
||||
// Largest block you're willing to create:
|
||||
unsigned int nBlockMaxSize = GetArg("-blockmaxsize", MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1));
|
||||
unsigned int nBlockMaxSize = GetArg("-blockmaxsize", MAX_BLOCK_SIZE(1)); // MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1));
|
||||
// Limit to betweeen 1K and MAX_BLOCK_SIZE-1K for sanity:
|
||||
nBlockMaxSize = std::max((unsigned int)1000, std::min((unsigned int)(MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1)-1000), nBlockMaxSize));
|
||||
nBlockMaxSize = std::max((unsigned int)1000, std::min((unsigned int)(MAX_BLOCK_SIZE(1)-1000), nBlockMaxSize));
|
||||
//nBlockMaxSize = std::max((unsigned int)1000, std::min((unsigned int)(MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1)-1000), nBlockMaxSize));
|
||||
|
||||
// How much of the block should be dedicated to high-priority transactions,
|
||||
// included regardless of the fees they pay
|
||||
unsigned int nBlockPrioritySize = GetArg("-blockprioritysize", DEFAULT_BLOCK_PRIORITY_SIZE);
|
||||
nBlockPrioritySize = std::min(nBlockMaxSize, nBlockPrioritySize);
|
||||
const unsigned int nBlockPrioritySize = std::min( nBlockMaxSize, (unsigned int) GetArg("-blockprioritysize", DEFAULT_BLOCK_PRIORITY_SIZE) );
|
||||
// nBlockPrioritySize = std::min(nBlockMaxSize, nBlockPrioritySize);
|
||||
|
||||
// Minimum block size you want to create; block will be filled with free transactions
|
||||
// until there are no more or the block reaches this size:
|
||||
unsigned int nBlockMinSize = GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE);
|
||||
nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize);
|
||||
const unsigned int nBlockMinSize = std::min(nBlockMaxSize, (unsigned int) GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE));
|
||||
// nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize);
|
||||
//fprintf(stderr,"%s: nBlockMaxSize=%u, nBlockPrioritySize=%u, nBlockMinSize=%u\n", __func__, nBlockMaxSize, nBlockPrioritySize, nBlockMinSize);
|
||||
|
||||
|
||||
@@ -474,38 +476,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
// fprintf(stderr,"%s: nTxSize = %u\n", __func__, nTxSize);
|
||||
|
||||
// Opret spam limits
|
||||
const bool opretminfee = true;
|
||||
if (opretminfee)
|
||||
{
|
||||
CFeeRate opretMinFeeRate = CFeeRate(10000000); // default opretMinFeeRate 0.1 HUSH
|
||||
|
||||
bool fSpamTx = false;
|
||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
unsigned int nTxOpretSize = 0;
|
||||
|
||||
// calc total oprets size
|
||||
BOOST_FOREACH(const CTxOut& txout, tx.vout) {
|
||||
if (txout.scriptPubKey.IsOpReturn()) {
|
||||
CScript::const_iterator it = txout.scriptPubKey.begin() + 1;
|
||||
opcodetype op;
|
||||
std::vector<uint8_t> opretData;
|
||||
if (txout.scriptPubKey.GetOp(it, op, opretData)) {
|
||||
//std::cerr << HexStr(opretData.begin(), opretData.end()) << std::endl;
|
||||
nTxOpretSize += opretData.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// opreturns of this size or smaller get amnesty and do not have to pay increased fees
|
||||
int amnestySize = 128;
|
||||
if ((nTxOpretSize > amnestySize) && (feeRate < opretMinFeeRate)) {
|
||||
fSpamTx = true;
|
||||
std::cerr << __func__ << ": " << tx.GetHash().ToString() << " nTxSize=" << nTxSize << " nTxOpretSize=" << nTxOpretSize << " feeRate=" << feeRate.ToString() << " opretMinFeeRate=" << opretMinFeeRate.ToString() << " fSpamTx=" << fSpamTx << std::endl;
|
||||
continue;
|
||||
}
|
||||
// std::cerr << tx.GetHash().ToString() << " vecPriority.size() = " << vecPriority.size() << std::endl;
|
||||
}
|
||||
|
||||
if (nBlockSize + nTxSize >= nBlockMaxSize-512) // room for extra autotx
|
||||
{
|
||||
@@ -549,6 +519,40 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
}
|
||||
CAmount nTxFees = view.GetValueIn(chainActive.LastTip()->GetHeight(),&interest,tx,chainActive.LastTip()->nTime)-tx.GetValueOut();
|
||||
|
||||
// Opret spam limits
|
||||
CAmount opretMinFee = 1 * COIN;
|
||||
|
||||
// Set with -ac_minopreturnfee
|
||||
if (ASSETCHAINS_MINOPRETURNFEE > 0) {
|
||||
opretMinFee = ASSETCHAINS_MINOPRETURNFEE;
|
||||
}
|
||||
|
||||
{
|
||||
bool fSpamTx = false;
|
||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
unsigned int nTxOpretSize = 0;
|
||||
|
||||
// calc total oprets size
|
||||
BOOST_FOREACH(const CTxOut& txout, tx.vout) {
|
||||
if (txout.scriptPubKey.IsOpReturn()) {
|
||||
CScript::const_iterator it = txout.scriptPubKey.begin() + 1;
|
||||
opcodetype op;
|
||||
std::vector<uint8_t> opretData;
|
||||
if (txout.scriptPubKey.GetOp(it, op, opretData)) {
|
||||
//std::cerr << HexStr(opretData.begin(), opretData.end()) << std::endl;
|
||||
nTxOpretSize += opretData.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nTxOpretSize > 0 && nTxFees < opretMinFee) {
|
||||
fSpamTx = true;
|
||||
std::cerr << __func__ << ": " << tx.GetHash().ToString() << " nTxSize=" << nTxSize << " nTxOpretSize=" << nTxOpretSize << " feeRate=" << feeRate.ToString() << " opretMinFee=" << opretMinFee << " nTxFees=" << nTxFees <<" fSpamTx=" << fSpamTx << std::endl;
|
||||
continue;
|
||||
}
|
||||
// std::cerr << tx.GetHash().ToString() << " vecPriority.size() = " << vecPriority.size() << std::endl;
|
||||
}
|
||||
|
||||
nTxSigOps += GetP2SHSigOpCount(tx, view);
|
||||
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1)
|
||||
{
|
||||
@@ -735,7 +739,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
pblock->hashFinalSaplingRoot = sapling_tree.root();
|
||||
|
||||
// all PoS chains need this data in the block at all times
|
||||
if ( ASSETCHAINS_LWMAPOS || ASSETCHAINS_STAKED == 0 || HUSH_MININGTHREADS > 0 )
|
||||
if ( ASSETCHAINS_LWMAPOS || HUSH_MININGTHREADS > 0 )
|
||||
{
|
||||
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
|
||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||
@@ -743,7 +747,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
pblock->nSolution.clear();
|
||||
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
||||
|
||||
if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (IS_HUSH_NOTARY == 0 || My_notaryid < 0) )
|
||||
if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && (IS_HUSH_NOTARY == 0 || My_notaryid < 0) )
|
||||
{
|
||||
CValidationState state;
|
||||
//fprintf(stderr,"%s: check validity\n", __func__);
|
||||
@@ -761,11 +765,10 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
//fprintf(stderr,"valid\n");
|
||||
}
|
||||
}
|
||||
if ( !isStake )
|
||||
{
|
||||
LEAVE_CRITICAL_SECTION(cs_main);
|
||||
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||
}
|
||||
|
||||
LEAVE_CRITICAL_SECTION(cs_main);
|
||||
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||
|
||||
// fprintf(stderr,"%s: done\n", __func__);
|
||||
return pblocktemplate.release();
|
||||
}
|
||||
@@ -785,7 +788,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
|
||||
hashPrevBlock = pblock->hashPrevBlock;
|
||||
}
|
||||
++nExtraNonce;
|
||||
unsigned int nHeight = pindexPrev->GetHeight()+1; // Height first in coinbase required for block.version=2
|
||||
const unsigned int nHeight = pindexPrev->GetHeight()+1; // Height first in coinbase required for block.version=2
|
||||
CMutableTransaction txCoinbase(pblock->vtx[0]);
|
||||
txCoinbase.vin[0].scriptSig = (CScript() << nHeight << CScriptNum(nExtraNonce)) + COINBASE_FLAGS;
|
||||
assert(txCoinbase.vin[0].scriptSig.size() <= 100);
|
||||
@@ -1083,9 +1086,9 @@ void static RandomXMiner()
|
||||
|
||||
// With the defaults of 1024 and 64
|
||||
// the key block will change every ~21.3 hours with a 75s block time
|
||||
// and every ~17 hours with the default 60s block time for HSCs
|
||||
// and every ~17 hours with the default 60s block time for HACs
|
||||
static int randomxInterval = GetRandomXInterval();
|
||||
// This lag is 80 mins for 75s blocktime and 64 mins for 60s (default) blocktime for HSCs
|
||||
// This lag is 80 mins for 75s blocktime and 64 mins for 60s (default) blocktime for HACs
|
||||
static int randomxBlockLag = GetRandomXBlockLag();
|
||||
randomx_vm *myVM = nullptr;
|
||||
|
||||
@@ -1151,7 +1154,7 @@ void static RandomXMiner()
|
||||
} else {
|
||||
rxdebug("%s: calculating keyHeight with randomxInterval=%d\n", randomxInterval);
|
||||
// At heights between intervals, we use the same block key and wait randomxBlockLag blocks until changing
|
||||
int keyHeight = ((Mining_height - randomxBlockLag) / randomxInterval) * randomxInterval;
|
||||
const int keyHeight = ((Mining_height - randomxBlockLag) / randomxInterval) * randomxInterval;
|
||||
uint256 randomxBlockKey = chainActive[keyHeight]->GetBlockHash();
|
||||
|
||||
randomx_init_cache(randomxCache, &randomxBlockKey, sizeof randomxBlockKey);
|
||||
@@ -1163,10 +1166,10 @@ void static RandomXMiner()
|
||||
rxdebug("%s: initializing dataset with %d threads\n", initThreadCount);
|
||||
std::vector<std::thread> threads;
|
||||
uint32_t startItem = 0;
|
||||
auto perThread = datasetItemCount / initThreadCount;
|
||||
auto remainder = datasetItemCount % initThreadCount;
|
||||
const auto perThread = datasetItemCount / initThreadCount;
|
||||
const auto remainder = datasetItemCount % initThreadCount;
|
||||
for (int i = 0; i < initThreadCount; ++i) {
|
||||
auto count = perThread + (i == initThreadCount - 1 ? remainder : 0);
|
||||
const auto count = perThread + (i == initThreadCount - 1 ? remainder : 0);
|
||||
threads.push_back(std::thread(&randomx_init_dataset, randomxDataset, randomxCache, startItem, count));
|
||||
startItem += count;
|
||||
}
|
||||
@@ -1205,7 +1208,7 @@ void static RandomXMiner()
|
||||
return;
|
||||
}
|
||||
static uint32_t counter;
|
||||
if ( counter++ < 10 && ASSETCHAINS_STAKED == 0 )
|
||||
if ( counter++ < 10 )
|
||||
fprintf(stderr,"RandomXMiner: created illegal blockB, retry with counter=%u\n", counter);
|
||||
sleep(1);
|
||||
continue;
|
||||
@@ -1399,10 +1402,8 @@ void static RandomXMiner()
|
||||
rxdebug("%s: going to destroy rx VM\n");
|
||||
randomx_destroy_vm(myVM);
|
||||
rxdebug("%s: destroyed VM\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (const boost::thread_interrupted&) {
|
||||
miningTimer.stop();
|
||||
c.disconnect();
|
||||
|
||||
48
src/net.cpp
48
src/net.cpp
@@ -50,6 +50,9 @@ extern int32_t HUSH_TESTNODE;
|
||||
// Satoshi originally used 10 seconds(!), did they know something Peter Wuille didn't?
|
||||
#define DUMP_ADDRESSES_INTERVAL 300
|
||||
|
||||
// Run asmap health check every 24hr by default
|
||||
#define ASMAP_HEALTHCHECK_INTERVAL 24*60*60
|
||||
|
||||
// This is every 2 blocks, on avg, on HUSH3
|
||||
#define DUMP_ZINDEX_INTERVAL 150
|
||||
|
||||
@@ -1648,6 +1651,35 @@ int64_t PoissonNextSend(int64_t now, int average_interval_seconds)
|
||||
return now + (int64_t)(log1p(GetRand(1ULL << 48) * -0.0000000000000035527136788 /* -1/2^48 */) * average_interval_seconds * -1000000.0 + 0.5);
|
||||
}
|
||||
|
||||
void ASMapHealthCheck() {
|
||||
// No health check if clearnet is disabled
|
||||
if (!GetBoolArg("-clearnet", DEFAULT_CLEARNET)) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::set<uint32_t> clearnet_asns{};
|
||||
int unmapped_count{0};
|
||||
LOCK(cs_vNodes);
|
||||
|
||||
for (const auto& pnode : vNodes) {
|
||||
auto address = pnode->addr;
|
||||
if(address.IsTor() || address.IsI2P() || address.IsCJDNS()) {
|
||||
// These networks do not have ASNs, skip them
|
||||
continue;
|
||||
}
|
||||
uint32_t asn = address.GetMappedAS(addrman.m_asmap);
|
||||
if (asn == 0) {
|
||||
++unmapped_count;
|
||||
continue;
|
||||
}
|
||||
clearnet_asns.insert(asn);
|
||||
}
|
||||
|
||||
LogPrintf("ASMap Health Check: %i clearnet peers are mapped to %i ASNs with %i peers being unmapped\n", vNodes.size(), clearnet_asns.size(), unmapped_count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ThreadOpenConnections()
|
||||
{
|
||||
// Connect to specific addresses
|
||||
@@ -1753,7 +1785,7 @@ void ThreadOpenConnections()
|
||||
int64_t nNow = GetTime();
|
||||
int nTries = 0;
|
||||
|
||||
LogPrint("net", "Resolving addrman collisions\n");
|
||||
LogPrint("net", "Resolving addrman collisions\n");
|
||||
addrman.ResolveCollisions();
|
||||
|
||||
while (true) {
|
||||
@@ -2378,10 +2410,14 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
scheduler.scheduleEvery(&DumpZindexStats, DUMP_ZINDEX_INTERVAL);
|
||||
}
|
||||
|
||||
// Dump network addresses
|
||||
scheduler.scheduleEvery(&DumpAddresses, DUMP_ADDRESSES_INTERVAL);
|
||||
|
||||
// Look for ~/.hush/AC_NAME/plz_stop
|
||||
scheduler.scheduleEvery(&CheckIfWeShouldStop, CHECK_PLZ_STOP_INTERVAL);
|
||||
|
||||
// Schedule ASMap Health check to run regularly
|
||||
scheduler.scheduleEvery(&ASMapHealthCheck, ASMAP_HEALTHCHECK_INTERVAL);
|
||||
|
||||
// and schedule it to run once in 5 mins when we hopefully have peers connected
|
||||
scheduler.scheduleFromNow(&ASMapHealthCheck, 300);
|
||||
}
|
||||
|
||||
bool StopNode()
|
||||
@@ -2470,7 +2506,9 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
|
||||
|
||||
// If we have no nodes to relay to, there is nothing to do
|
||||
if(vNodes.size() == 0) {
|
||||
fprintf(stderr, "%s: No nodes to relay to!\n", __func__ );
|
||||
if (HUSH_TESTNODE==0) {
|
||||
fprintf(stderr, "%s: No nodes to relay to!\n", __func__ );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,15 @@ static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = (_MAX_BLOCK_SIZE + 24);
|
||||
static const unsigned int MAX_SUBVERSION_LENGTH = 256;
|
||||
/** -listen default */
|
||||
static const bool DEFAULT_LISTEN = true;
|
||||
|
||||
/** -clearnet default */
|
||||
static const bool DEFAULT_CLEARNET = true;
|
||||
|
||||
/** -disableipv4 default */
|
||||
static const bool DEFAULT_DISABLE_IPV4 = false;
|
||||
/** -disableipv6 default */
|
||||
static const bool DEFAULT_DISABLE_IPV6 = false;
|
||||
|
||||
/** The maximum number of entries in mapAskFor */
|
||||
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
|
||||
/** The maximum number of entries in setAskFor (larger due to getdata latency)*/
|
||||
|
||||
@@ -511,7 +511,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
|
||||
// Changing this requires changing many other things and
|
||||
// might change consensus. Have fun -- Duke
|
||||
// NOTE: Ony HUSH3 mainnet should use this function, all HSC's should use params.AveragigWindowTimespan()
|
||||
// NOTE: Ony HUSH3 mainnet should use this function, all HAC's should use params.AveragigWindowTimespan()
|
||||
int64_t AveragingWindowTimespan() {
|
||||
// used in const methods, beware!
|
||||
// This is the correct AWT for 75s blocktime, before block 340k
|
||||
|
||||
@@ -693,7 +693,7 @@ public:
|
||||
|
||||
bool IsMint() const
|
||||
{
|
||||
return IsCoinImport() || IsCoinBase();
|
||||
return IsCoinBase(); // || IsCoinImport();
|
||||
}
|
||||
|
||||
bool IsCoinBase() const
|
||||
@@ -705,7 +705,8 @@ public:
|
||||
|
||||
bool IsCoinImport() const
|
||||
{
|
||||
return (vin.size() == 1 && vin[0].prevout.n == 10e8);
|
||||
return false;
|
||||
//return (vin.size() == 1 && vin[0].prevout.n == 10e8);
|
||||
}
|
||||
|
||||
bool IsPegsImport() const
|
||||
|
||||
@@ -242,7 +242,7 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex)
|
||||
vector<unsigned char> hashBytes(out.scriptPubKey.begin()+3, out.scriptPubKey.begin()+23);
|
||||
delta.push_back(Pair("address", CBitcoinAddress(CKeyID(uint160(hashBytes))).ToString()));
|
||||
}
|
||||
else if (out.scriptPubKey.IsPayToPublicKey() || out.scriptPubKey.IsPayToCryptoCondition()) {
|
||||
else if (out.scriptPubKey.IsPayToPublicKey()) {
|
||||
CTxDestination address;
|
||||
if (ExtractDestination(out.scriptPubKey, address))
|
||||
{
|
||||
@@ -862,7 +862,7 @@ UniValue getblockmerkletree(const UniValue& params, bool fHelp, const CPubKey& m
|
||||
if (fHelp || params.size() != 1 )
|
||||
throw runtime_error(
|
||||
"getblockmerkletree height\n"
|
||||
"\nGet full merkletree for a given Hush or HSC block height.\n"
|
||||
"\nGet full merkletree for a given Hush or HAC block height.\n"
|
||||
"\nArguments:\n"
|
||||
"1. height (int, required) block height\n"
|
||||
"\nResult:\n"
|
||||
@@ -877,7 +877,7 @@ UniValue getblockmerkletree(const UniValue& params, bool fHelp, const CPubKey& m
|
||||
|
||||
int nHeight = params[0].get_int();
|
||||
if ( (nHeight < 1) || (nHeight > chainActive.LastTip()->GetHeight()) ) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid Hush or HSC block height parameter");
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid Hush or HAC block height parameter");
|
||||
}
|
||||
|
||||
phushblockindex = chainActive[nHeight];
|
||||
|
||||
@@ -489,7 +489,7 @@ UniValue validateaddress(const UniValue& params, bool fHelp, const CPubKey& mypk
|
||||
"\nResult:\n"
|
||||
"{\n"
|
||||
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
|
||||
" \"address\" : \"addr\", (string) The Hush or HSC address validated\n"
|
||||
" \"address\" : \"addr\", (string) The Hush or HAC address validated\n"
|
||||
" \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n"
|
||||
" \"ismine\" : true|false, (boolean) If the address is yours or not\n"
|
||||
" \"isscript\" : true|false, (boolean) If the key is a script\n"
|
||||
|
||||
@@ -146,31 +146,7 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue&
|
||||
UniValue in(UniValue::VOBJ);
|
||||
if (tx.IsCoinBase()) {
|
||||
in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
|
||||
}
|
||||
/* else if (tx.IsCoinImport() && txin.prevout.n==10e8) {
|
||||
in.push_back(Pair("is_import", "1"));
|
||||
ImportProof proof; CTransaction burnTx; std::vector<CTxOut> payouts; CTxDestination importaddress;
|
||||
if (UnmarshalImportTx(tx, proof, burnTx, payouts))
|
||||
{
|
||||
if (burnTx.vout.size() == 0)
|
||||
continue;
|
||||
in.push_back(Pair("txid", burnTx.GetHash().ToString()));
|
||||
in.push_back(Pair("value", ValueFromAmount(burnTx.vout.back().nValue)));
|
||||
in.push_back(Pair("valueSat", burnTx.vout.back().nValue));
|
||||
// extract op_return to get burn source chain.
|
||||
std::vector<uint8_t> burnOpret; std::string targetSymbol; uint32_t targetCCid; uint256 payoutsHash; std::vector<uint8_t>rawproof;
|
||||
if (UnmarshalBurnTx(burnTx, targetSymbol, &targetCCid, payoutsHash, rawproof))
|
||||
{
|
||||
if (rawproof.size() > 0)
|
||||
{
|
||||
std::string sourceSymbol;
|
||||
E_UNMARSHAL(rawproof, ss >> sourceSymbol);
|
||||
in.push_back(Pair("address", "IMP-" + sourceSymbol + "-" + burnTx.GetHash().ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
else {
|
||||
} else {
|
||||
in.push_back(Pair("txid", txin.prevout.hash.GetHex()));
|
||||
in.push_back(Pair("vout", (int64_t)txin.prevout.n));
|
||||
{
|
||||
|
||||
@@ -957,37 +957,6 @@ bool EvalScript(
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
case OP_CHECKCRYPTOCONDITION:
|
||||
case OP_CHECKCRYPTOCONDITIONVERIFY:
|
||||
{
|
||||
if (!IsCryptoConditionsEnabled()) {
|
||||
goto INTERPRETER_DEFAULT;
|
||||
}
|
||||
|
||||
if (stack.size() < 2)
|
||||
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
||||
//fprintf(stderr,"check cryptocondition\n");
|
||||
int fResult = checker.CheckCryptoCondition(stacktop(-1), stacktop(-2), script, consensusBranchId);
|
||||
if (fResult == -1) {
|
||||
return set_error(serror, SCRIPT_ERR_CRYPTOCONDITION_INVALID_FULFILLMENT);
|
||||
}
|
||||
|
||||
popstack(stack);
|
||||
popstack(stack);
|
||||
|
||||
stack.push_back(fResult == 1 ? vchTrue : vchFalse);
|
||||
|
||||
if (opcode == OP_CHECKCRYPTOCONDITIONVERIFY)
|
||||
{
|
||||
if (fResult == 1)
|
||||
popstack(stack);
|
||||
else
|
||||
return set_error(serror, SCRIPT_ERR_CRYPTOCONDITION_VERIFY);
|
||||
}
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
INTERPRETER_DEFAULT:
|
||||
default:
|
||||
@@ -1356,15 +1325,6 @@ bool TransactionSignatureChecker::CheckSig(
|
||||
}
|
||||
|
||||
|
||||
int TransactionSignatureChecker::CheckCryptoCondition(
|
||||
const std::vector<unsigned char>& condBin,
|
||||
const std::vector<unsigned char>& ffillBin,
|
||||
const CScript& scriptCode,
|
||||
uint32_t consensusBranchId) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) const
|
||||
{
|
||||
// There are two times of nLockTime: lock-by-blockheight
|
||||
@@ -1407,38 +1367,6 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allow larger opcode in case of crypto condition scriptSig
|
||||
*/
|
||||
bool EvalCryptoConditionSig(
|
||||
vector<vector<unsigned char> >& stack,
|
||||
const CScript& scriptSig,
|
||||
ScriptError* serror)
|
||||
{
|
||||
CScript::const_iterator pc = scriptSig.begin();
|
||||
opcodetype opcode;
|
||||
valtype vchPushValue;
|
||||
set_error(serror, SCRIPT_ERR_UNKNOWN_ERROR);
|
||||
|
||||
if (!scriptSig.GetOp(pc, opcode, vchPushValue))
|
||||
return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
|
||||
|
||||
if (opcode == 0 || opcode > OP_PUSHDATA4)
|
||||
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
||||
|
||||
if (pc != scriptSig.end())
|
||||
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
||||
|
||||
if (vchPushValue.size() > MAX_SCRIPT_CRYPTOCONDITION_FULFILLMENT_SIZE)
|
||||
return set_error(serror, SCRIPT_ERR_PUSH_SIZE);
|
||||
|
||||
stack.push_back(vchPushValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool VerifyScript(
|
||||
const CScript& scriptSig,
|
||||
const CScript& scriptPubKey,
|
||||
@@ -1454,12 +1382,7 @@ bool VerifyScript(
|
||||
}
|
||||
|
||||
vector<vector<unsigned char> > stack, stackCopy;
|
||||
if (IsCryptoConditionsEnabled() && scriptPubKey.IsPayToCryptoCondition()) {
|
||||
if (!EvalCryptoConditionSig(stack, scriptSig, serror))
|
||||
// serror is set
|
||||
return false;
|
||||
}
|
||||
else if (!EvalScript(stack, scriptSig, flags, checker, consensusBranchId, serror))
|
||||
if (!EvalScript(stack, scriptSig, flags, checker, consensusBranchId, serror))
|
||||
// serror is set
|
||||
return false;
|
||||
if (flags & SCRIPT_VERIFY_P2SH)
|
||||
|
||||
@@ -147,15 +147,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int CheckCryptoCondition(
|
||||
const std::vector<unsigned char>& condBin,
|
||||
const std::vector<unsigned char>& ffillBin,
|
||||
const CScript& scriptCode,
|
||||
uint32_t consensusBranchId) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual ~BaseSignatureChecker() {}
|
||||
};
|
||||
|
||||
@@ -174,11 +165,6 @@ public:
|
||||
TransactionSignatureChecker(const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, const PrecomputedTransactionData& txdataIn) : txTo(txToIn), nIn(nInIn), amount(amountIn), txdata(&txdataIn) {}
|
||||
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, uint32_t consensusBranchId) const;
|
||||
bool CheckLockTime(const CScriptNum& nLockTime) const;
|
||||
int CheckCryptoCondition(
|
||||
const std::vector<unsigned char>& condBin,
|
||||
const std::vector<unsigned char>& ffillBin,
|
||||
const CScript& scriptCode,
|
||||
uint32_t consensusBranchId) const;
|
||||
};
|
||||
|
||||
class MutableTransactionSignatureChecker : public TransactionSignatureChecker
|
||||
|
||||
@@ -156,9 +156,6 @@ const char* GetOpName(opcodetype opcode)
|
||||
case OP_CHECKSIGVERIFY : return "OP_CHECKSIGVERIFY";
|
||||
case OP_CHECKMULTISIG : return "OP_CHECKMULTISIG";
|
||||
case OP_CHECKMULTISIGVERIFY : return "OP_CHECKMULTISIGVERIFY";
|
||||
case OP_CHECKCRYPTOCONDITION : return "OP_CHECKCRYPTOCONDITION";
|
||||
case OP_CHECKCRYPTOCONDITIONVERIFY
|
||||
: return "OP_CHECKCRYPTOCONDITIONVERIFY";
|
||||
|
||||
// expansion
|
||||
case OP_NOP1 : return "OP_NOP1";
|
||||
@@ -382,12 +379,6 @@ bool CScript::MayAcceptCryptoCondition() const
|
||||
|
||||
bool CScript::IsCoinImport() const
|
||||
{
|
||||
const_iterator pc = this->begin();
|
||||
vector<unsigned char> data;
|
||||
opcodetype opcode;
|
||||
if (this->GetOp(pc, opcode, data))
|
||||
if (opcode > OP_0 && opcode <= OP_PUSHDATA4)
|
||||
return data.begin()[0] == EVAL_IMPORTCOIN;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,6 @@
|
||||
|
||||
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
|
||||
|
||||
// Max size of pushdata in a CC sig in bytes
|
||||
static const unsigned int MAX_SCRIPT_CRYPTOCONDITION_FULFILLMENT_SIZE = 2048;
|
||||
|
||||
// Maximum script length in bytes
|
||||
static const int MAX_SCRIPT_SIZE = 10000;
|
||||
|
||||
@@ -178,8 +175,6 @@ enum opcodetype
|
||||
OP_CHECKSIGVERIFY = 0xad,
|
||||
OP_CHECKMULTISIG = 0xae,
|
||||
OP_CHECKMULTISIGVERIFY = 0xaf,
|
||||
OP_CHECKCRYPTOCONDITION = 0xcc,
|
||||
OP_CHECKCRYPTOCONDITIONVERIFY = 0xcd,
|
||||
|
||||
// expansion
|
||||
OP_NOP1 = 0xb0,
|
||||
@@ -200,7 +195,6 @@ enum opcodetype
|
||||
OP_PUBKEYS = 0xfb,
|
||||
OP_PUBKEYHASH = 0xfd,
|
||||
OP_PUBKEY = 0xfe,
|
||||
OP_CRYPTOCONDITION = 0xfc,
|
||||
|
||||
OP_INVALIDOPCODE = 0xff,
|
||||
};
|
||||
|
||||
@@ -83,8 +83,6 @@ const char* ScriptErrorString(const ScriptError serror)
|
||||
return "NOPx reserved for soft-fork upgrades";
|
||||
case SCRIPT_ERR_PUBKEYTYPE:
|
||||
return "Public key is neither compressed or uncompressed";
|
||||
case SCRIPT_ERR_CRYPTOCONDITION_INVALID_FULFILLMENT:
|
||||
return "Crypto-Condition payload is invalid";
|
||||
case SCRIPT_ERR_UNKNOWN_ERROR:
|
||||
case SCRIPT_ERR_ERROR_COUNT:
|
||||
default: break;
|
||||
|
||||
@@ -70,9 +70,6 @@ typedef enum ScriptError_t
|
||||
|
||||
SCRIPT_ERR_ERROR_COUNT,
|
||||
|
||||
/* crypto-condition script errors */
|
||||
SCRIPT_ERR_CRYPTOCONDITION_VERIFY,
|
||||
SCRIPT_ERR_CRYPTOCONDITION_INVALID_FULFILLMENT
|
||||
} ScriptError;
|
||||
|
||||
#define SCRIPT_ERR_LAST SCRIPT_ERR_ERROR_COUNT
|
||||
|
||||
@@ -128,29 +128,6 @@ static bool SignN(const vector<valtype>& multisigdata, const BaseSignatureCreato
|
||||
return nSigned==nRequired;
|
||||
}
|
||||
|
||||
std::vector<CCcontract_info> &GetCryptoConditions()
|
||||
{
|
||||
static bool initialized = false;
|
||||
static std::vector<CCcontract_info> vCC = std::vector<CCcontract_info>();
|
||||
CCcontract_info C;
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
// this should initialize any desired auto-signed crypto-conditions
|
||||
}
|
||||
return vCC;
|
||||
}
|
||||
|
||||
bool GetCCByUnspendableAddress(struct CCcontract_info *cp, char *addrstr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCinitLite(struct CCcontract_info *cp, uint8_t evalcode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool _Getscriptaddress(char *destaddr, const CScript &scriptPubKey)
|
||||
{
|
||||
CTxDestination address;
|
||||
@@ -239,9 +216,6 @@ static bool SignStep(const BaseSignatureCreator& creator, const CScript& scriptP
|
||||
}
|
||||
return false;
|
||||
|
||||
case TX_CRYPTOCONDITION:
|
||||
return SignStepCC(creator, scriptPubKey, vSolutions, ret, consensusBranchId);
|
||||
|
||||
case TX_MULTISIG:
|
||||
ret.push_back(valtype()); // workaround CHECKMULTISIG bug
|
||||
return (SignN(vSolutions, creator, scriptPubKey, ret, consensusBranchId));
|
||||
@@ -429,11 +403,6 @@ static Stacks CombineSignatures(const CScript& scriptPubKey, const BaseSignature
|
||||
return sigs2;
|
||||
case TX_PUBKEY:
|
||||
case TX_PUBKEYHASH:
|
||||
case TX_CRYPTOCONDITION:
|
||||
// Signatures are bigger than placeholders or empty scripts:
|
||||
if (sigs1.script.empty() || sigs1.script[0].empty())
|
||||
return sigs2;
|
||||
return sigs1;
|
||||
case TX_SCRIPTHASH:
|
||||
if (sigs1.script.empty() || sigs1.script.back().empty())
|
||||
return sigs2;
|
||||
|
||||
@@ -143,7 +143,6 @@ const char* GetTxnOutputType(txnouttype t)
|
||||
case TX_SCRIPTHASH: return "scripthash";
|
||||
case TX_MULTISIG: return "multisig";
|
||||
case TX_NULL_DATA: return "nulldata";
|
||||
case TX_CRYPTOCONDITION: return "cryptocondition";
|
||||
default: return "invalid";
|
||||
}
|
||||
return NULL;
|
||||
@@ -183,40 +182,6 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsCryptoConditionsEnabled()) {
|
||||
// Shortcut for pay-to-crypto-condition
|
||||
CScript ccSubScript = CScript();
|
||||
std::vector<std::vector<unsigned char>> vParams;
|
||||
if (scriptPubKey.IsPayToCryptoCondition(&ccSubScript, vParams))
|
||||
{
|
||||
if (scriptPubKey.MayAcceptCryptoCondition())
|
||||
{
|
||||
typeRet = TX_CRYPTOCONDITION;
|
||||
vector<unsigned char> hashBytes; uint160 x; int32_t i; uint8_t hash20[20],*ptr;;
|
||||
x = Hash160(ccSubScript);
|
||||
memcpy(hash20,&x,20);
|
||||
hashBytes.resize(20);
|
||||
ptr = hashBytes.data();
|
||||
for (i=0; i<20; i++)
|
||||
ptr[i] = hash20[i];
|
||||
vSolutionsRet.push_back(hashBytes);
|
||||
if (vParams.size())
|
||||
{
|
||||
COptCCParams cp = COptCCParams(vParams[0]);
|
||||
if (cp.IsValid())
|
||||
{
|
||||
for (auto k : cp.vKeys)
|
||||
{
|
||||
vSolutionsRet.push_back(std::vector<unsigned char>(k.begin(), k.end()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Scan templates
|
||||
const CScript& script1 = scriptPubKey;
|
||||
BOOST_FOREACH(const PAIRTYPE(txnouttype, CScript)& tplate, mTemplates)
|
||||
@@ -328,8 +293,6 @@ int ScriptSigArgsExpected(txnouttype t, const std::vector<std::vector<unsigned c
|
||||
return vSolutions[0][0] + 1;
|
||||
case TX_SCRIPTHASH:
|
||||
return 1; // doesn't include args needed by the script
|
||||
case TX_CRYPTOCONDITION:
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -404,21 +367,6 @@ bool ExtractDestination(const CScript& _scriptPubKey, CTxDestination& addressRet
|
||||
addressRet = CScriptID(uint160(vSolutions[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (IsCryptoConditionsEnabled() != 0 && whichType == TX_CRYPTOCONDITION)
|
||||
{
|
||||
if (vSolutions.size() > 1)
|
||||
{
|
||||
CPubKey pk = CPubKey((vSolutions[1]));
|
||||
addressRet = pk;
|
||||
return pk.IsValid();
|
||||
}
|
||||
else
|
||||
{
|
||||
addressRet = CKeyID(uint160(vSolutions[0]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Multisig txns have more than one address...
|
||||
return false;
|
||||
}
|
||||
@@ -464,30 +412,7 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto
|
||||
|
||||
if (addressRet.empty())
|
||||
return false;
|
||||
}
|
||||
// Removed to get CC address printed in getrawtransaction and decoderawtransaction
|
||||
// else if (IsCryptoConditionsEnabled() != 0 && typeRet == TX_CRYPTOCONDITION)
|
||||
// {
|
||||
// nRequiredRet = vSolutions.front()[0];
|
||||
// for (unsigned int i = 1; i < vSolutions.size()-1; i++)
|
||||
// {
|
||||
// CTxDestination address;
|
||||
// if (vSolutions[i].size() == 20)
|
||||
// {
|
||||
// address = CKeyID(uint160(vSolutions[i]));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// address = CPubKey(vSolutions[i]);
|
||||
// }
|
||||
// addressRet.push_back(address);
|
||||
// }
|
||||
|
||||
// if (addressRet.empty())
|
||||
// return false;
|
||||
// }
|
||||
else
|
||||
{
|
||||
} else {
|
||||
nRequiredRet = 1;
|
||||
CTxDestination address;
|
||||
if (!ExtractDestination(scriptPubKey, address))
|
||||
|
||||
@@ -75,7 +75,6 @@ enum txnouttype
|
||||
TX_PUBKEYHASH,
|
||||
TX_SCRIPTHASH,
|
||||
TX_MULTISIG,
|
||||
TX_CRYPTOCONDITION,
|
||||
TX_NULL_DATA,
|
||||
};
|
||||
|
||||
|
||||
@@ -71,11 +71,11 @@ void CTimeWarning::Warn(size_t peersAhead, size_t peersBehind)
|
||||
{
|
||||
std::string strMessage;
|
||||
if (peersBehind >= TIMEDATA_WARNING_MAJORITY) {
|
||||
strMessage = _("Warning: Your computer's date and time may be ahead of the rest of the network! If your clock is wrong Hush will not work properly.");
|
||||
strMessage = _("Warning: Your computer's date and time may be ahead of the rest of the network! If your clock is wrong this node will not work properly.");
|
||||
} else if (peersAhead >= TIMEDATA_WARNING_MAJORITY) {
|
||||
strMessage = _("Warning: Your computer's date and time may be behind the rest of the network! If your clock is wrong Hush will not work properly.");
|
||||
strMessage = _("Warning: Your computer's date and time may be behind the rest of the network! If your clock is wrong this node will not work properly.");
|
||||
} else {
|
||||
strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong Hush will not work properly.");
|
||||
strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong this node will not work properly.");
|
||||
}
|
||||
LogPrintf("*** %s\n", strMessage);
|
||||
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING);
|
||||
|
||||
16
src/txdb.cpp
16
src/txdb.cpp
@@ -456,7 +456,7 @@ uint32_t hush_segid32(char *coinaddr);
|
||||
bool CBlockTreeDB::Snapshot2(std::map <std::string, CAmount> &addressAmounts, UniValue *ret)
|
||||
{
|
||||
int64_t total = 0; int64_t totalAddresses = 0; std::string address;
|
||||
int64_t utxos = 0; int64_t ignoredAddresses = 0, cryptoConditionsUTXOs = 0, cryptoConditionsTotals = 0;
|
||||
int64_t utxos = 0; int64_t ignoredAddresses = 0;
|
||||
DECLARE_IGNORELIST
|
||||
boost::scoped_ptr<CDBIterator> iter(NewIterator());
|
||||
//std::map <std::string, CAmount> addressAmounts;
|
||||
@@ -479,13 +479,7 @@ bool CBlockTreeDB::Snapshot2(std::map <std::string, CAmount> &addressAmounts, Un
|
||||
if ( nValue == 0 )
|
||||
continue;
|
||||
getAddressFromIndex(indexKey.type, indexKey.hashBytes, address);
|
||||
if ( indexKey.type == 3 )
|
||||
{
|
||||
cryptoConditionsUTXOs++;
|
||||
cryptoConditionsTotals += nValue;
|
||||
total += nValue;
|
||||
continue;
|
||||
}
|
||||
|
||||
std::map <std::string, int>::iterator ignored = ignoredMap.find(address);
|
||||
if (ignored != ignoredMap.end())
|
||||
{
|
||||
@@ -540,12 +534,6 @@ bool CBlockTreeDB::Snapshot2(std::map <std::string, CAmount> &addressAmounts, Un
|
||||
ret->push_back(make_pair("total_addresses", totalAddresses ));
|
||||
// Total number of ignored addresses in this snaphot
|
||||
ret->push_back(make_pair("ignored_addresses", ignoredAddresses));
|
||||
// Total number of crypto condition utxos we skipped
|
||||
ret->push_back(make_pair("skipped_cc_utxos", cryptoConditionsUTXOs));
|
||||
// Total value of skipped crypto condition utxos
|
||||
ret->push_back(make_pair("cc_utxo_value", (double) cryptoConditionsTotals / COIN));
|
||||
// total of all the address's, does not count coins in CC vouts.
|
||||
ret->push_back(make_pair("total_includeCCvouts", (double) (total+cryptoConditionsTotals)/ COIN ));
|
||||
// The snapshot finished at this block height
|
||||
ret->push_back(make_pair("ending_height", chainActive.Height()));
|
||||
}
|
||||
|
||||
@@ -120,13 +120,12 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry,
|
||||
const CTransaction& tx = mapTx.find(hash)->GetTx();
|
||||
mapRecentlyAddedTx[tx.GetHash()] = &tx;
|
||||
nRecentlyAddedSequence += 1;
|
||||
if (!tx.IsCoinImport()) {
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
//if (tx.IsPegsImport() && i==0) continue;
|
||||
mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i);
|
||||
}
|
||||
|
||||
for (const SpendDescription &spendDescription : tx.vShieldedSpend) {
|
||||
mapSaplingNullifiers[spendDescription.nullifier] = &tx;
|
||||
}
|
||||
@@ -157,14 +156,6 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
|
||||
CTxDestination vDest;
|
||||
if (Solver(prevout.scriptPubKey, txType, vSols) || ExtractDestination(prevout.scriptPubKey, vDest))
|
||||
{
|
||||
if (vDest.which())
|
||||
{
|
||||
uint160 hashBytes;
|
||||
if (CBitcoinAddress(vDest).GetIndexKey(hashBytes, keyType, prevout.scriptPubKey.IsPayToCryptoCondition()))
|
||||
{
|
||||
vSols.push_back(vector<unsigned char>(hashBytes.begin(), hashBytes.end()));
|
||||
}
|
||||
}
|
||||
if (txType == TX_SCRIPTHASH)
|
||||
{
|
||||
keyType = 2;
|
||||
@@ -191,11 +182,6 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
|
||||
// if we failed to solve, and got a vDest, assume P2PKH or P2PK address returned
|
||||
if (vDest.which())
|
||||
{
|
||||
uint160 hashBytes;
|
||||
if (CBitcoinAddress(vDest).GetIndexKey(hashBytes, keyType, out.scriptPubKey.IsPayToCryptoCondition()))
|
||||
{
|
||||
vSols.push_back(vector<unsigned char>(hashBytes.begin(), hashBytes.end()));
|
||||
}
|
||||
}
|
||||
else if (txType == TX_SCRIPTHASH)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2016-2024 The Hush developers
|
||||
// Copyright (c) 2016-2025 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -438,6 +438,7 @@ bool SoftSetArg(const std::string& strArg, const std::string& strValue)
|
||||
if (mapArgs.count(strArg))
|
||||
return false;
|
||||
mapArgs[strArg] = strValue;
|
||||
mapMultiArgs[strArg].push_back(strValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2012-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2016-2024 The Hush developers
|
||||
// Copyright (c) 2016-2025 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
/******************************************************************************
|
||||
@@ -21,7 +21,7 @@
|
||||
#define HUSH_VERSION_H
|
||||
|
||||
// network protocol versioning
|
||||
static const int PROTOCOL_VERSION = 1987427;
|
||||
static const int PROTOCOL_VERSION = 1987428;
|
||||
//! initial proto version, to be increased after version/verack negotiation
|
||||
static const int INIT_PROTO_VERSION = 209;
|
||||
//! In this version, 'getheaders' was introduced.
|
||||
|
||||
@@ -5003,9 +5003,9 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (fHelp || params.size() < 2 || params.size() > 4)
|
||||
if (fHelp || params.size() < 2 || params.size() > 5)
|
||||
throw runtime_error(
|
||||
"z_sendmany \"fromaddress\" [{\"address\":... ,\"amount\":...},...] ( minconf ) ( fee )\n"
|
||||
"z_sendmany \"fromaddress\" [{\"address\":... ,\"amount\":...},...] ( minconf ) ( fee ) (opreturn)\n"
|
||||
"\nSend multiple times. Amounts are decimal numbers with at most 8 digits of precision."
|
||||
"\nChange generated from a taddr flows to a new taddr address, while change generated from a zaddr returns to itself."
|
||||
"\nWhen sending coinbase UTXOs to a zaddr, change is not allowed. The entire value of the UTXO(s) must be consumed."
|
||||
@@ -5021,6 +5021,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
"3. minconf (numeric, optional, default=1) Only use funds confirmed at least this many times.\n"
|
||||
"4. fee (numeric, optional, default="
|
||||
+ strprintf("%s", FormatMoney(ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE)) + ") The fee amount to attach to this transaction.\n"
|
||||
"5. opreturn (string, optional) Hex encoded data for OP_RETURN. Or a utf8 string prefixed with 'utf8:' which will be automatically converted to hex\n"
|
||||
"\nResult:\n"
|
||||
"\"operationid\" (string) An operationid to pass to z_getoperationstatus to get the result of the operation.\n"
|
||||
"\nExamples:\n"
|
||||
@@ -5028,6 +5029,8 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
+ HelpExampleRpc("z_sendmany", "\"RD6GgnrMpPaTSMn8vai6yiGA7mN4QGPV\", [{\"address\": \"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\" ,\"amount\": 5.0}]")
|
||||
+ HelpExampleCli("z_sendmany", "\"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\" '[{\"address\": \"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\" ,\"amount\": 3.14}]'")
|
||||
+ HelpExampleRpc("z_sendmany", "\"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\", [{\"address\": \"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\" ,\"amount\": 3.14}]")
|
||||
+ HelpExampleCli("z_sendmany", "\"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\" '[{\"address\": \"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\" ,\"amount\": 3.14}]' 1 0.0001 \"utf8: this will be converted to hex")
|
||||
+ HelpExampleRpc("z_sendmany", "\"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\" '[{\"address\": \"zs14d8tc0hl9q0vg5l28uec5vk6sk34fkj2n8s7jalvw5fxpy6v39yn4s2ga082lymrkjk0x2nqg37\" ,\"amount\": 3.14}]' 1 0.0001 \"utf8: this will be converted to hex")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
@@ -5146,20 +5149,34 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
}
|
||||
}
|
||||
|
||||
// Keep track of addresses to spot duplicates
|
||||
set<std::string> setAddress;
|
||||
|
||||
// Recipients
|
||||
std::vector<SendManyRecipient> taddrRecipients;
|
||||
std::vector<SendManyRecipient> zaddrRecipients;
|
||||
CAmount nTotalOut = 0;
|
||||
// Optional OP_RETURN data
|
||||
CScript opret;
|
||||
// TODO: enforce that only a single opreturn exists
|
||||
UniValue opretValue;
|
||||
if(params.size() == 5) {
|
||||
opretValue = params[4].get_str();
|
||||
|
||||
// Support a prefix "utf8:" which allows giving utf8 text instead of hex
|
||||
if(opretValue.get_str().substr(0,5) == "utf8:") {
|
||||
auto str = opretValue.get_str().substr(5);
|
||||
if (utf8::is_valid(str)) {
|
||||
opretValue = HexStr(str);
|
||||
} else {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid utf8 in opreturn");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool containsSaplingOutput = false;
|
||||
|
||||
// Create the CScript representation of the OP_RETURN
|
||||
if (!opretValue.isNull()) {
|
||||
opret << OP_RETURN << ParseHex(opretValue.get_str().c_str());
|
||||
}
|
||||
|
||||
for (const UniValue& o : outputs.getValues()) {
|
||||
if (!o.isObject())
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object");
|
||||
@@ -5167,7 +5184,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
// sanity check, report error if unknown key-value pairs
|
||||
for (const string& name_ : o.getKeys()) {
|
||||
std::string s = name_;
|
||||
if (s != "address" && s != "amount" && s!="memo" && s!="opreturn") {
|
||||
if (s != "address" && s != "amount" && s!="memo") {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, unknown key: ")+s);
|
||||
}
|
||||
}
|
||||
@@ -5186,29 +5203,22 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
// throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Extreme Privacy! You must send to a zaddr");
|
||||
//}
|
||||
|
||||
// Allowing duplicate receivers helps various HushList protocol operations
|
||||
//if (setAddress.count(address))
|
||||
// throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+address);
|
||||
setAddress.insert(address);
|
||||
|
||||
UniValue this_opret = find_value(o, "opreturn");
|
||||
if (!this_opret.isNull()) {
|
||||
opretValue = this_opret;
|
||||
}
|
||||
|
||||
// Create the CScript representation of the OP_RETURN
|
||||
if (!opretValue.isNull()) {
|
||||
opret << OP_RETURN << ParseHex(opretValue.get_str().c_str());
|
||||
}
|
||||
|
||||
UniValue memoValue = find_value(o, "memo");
|
||||
string memo;
|
||||
if (!memoValue.isNull()) {
|
||||
memo = memoValue.get_str();
|
||||
if (!isZaddr) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Memo cannot be used with a taddr. It can only be used with a zaddr.");
|
||||
} else if(memo.substr(0,5) == "utf8:") {
|
||||
// Support a prefix "utf8:" which allows giving utf8 text instead of hex
|
||||
auto str = memo.substr(5);
|
||||
if (utf8::is_valid(str)) {
|
||||
memo = HexStr(str);
|
||||
} else {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid utf8 in memo");
|
||||
}
|
||||
} else if (!IsHex(memo)) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected memo data in hexadecimal format.");
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected memo data in hexadecimal format or to use 'utf8:' prefix.");
|
||||
}
|
||||
if (memo.length() > HUSH_MEMO_SIZE*2) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, size of memo is larger than maximum allowed %d", HUSH_MEMO_SIZE ));
|
||||
|
||||
@@ -507,7 +507,7 @@ void CWallet::ChainTip(const CBlockIndex *pindex,
|
||||
}
|
||||
|
||||
void CWallet::RunSaplingSweep(int blockHeight) {
|
||||
// Sapling is always active since height=1 of HUSH+HSCs
|
||||
// Sapling is always active since height=1 of HUSH+HACs
|
||||
// if (!NetworkUpgradeActive(blockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
||||
// return;
|
||||
// }
|
||||
@@ -551,7 +551,7 @@ void CWallet::RunSaplingSweep(int blockHeight) {
|
||||
}
|
||||
|
||||
void CWallet::RunSaplingConsolidation(int blockHeight) {
|
||||
// Sapling is always active on HUSH+HSCs
|
||||
// Sapling is always active on HUSH+HACs
|
||||
//if (!NetworkUpgradeActive(blockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
||||
// return;
|
||||
//}
|
||||
@@ -1977,17 +1977,6 @@ isminetype CWallet::IsMine(const CTransaction& tx, uint32_t voutNum)
|
||||
case TX_NULL_DATA:
|
||||
break;
|
||||
|
||||
case TX_CRYPTOCONDITION:
|
||||
// for now, default is that the first value returned will be the script, subsequent values will be
|
||||
// pubkeys. if we have the first pub key in our wallet, we consider this spendable
|
||||
if (vSolutions.size() > 1)
|
||||
{
|
||||
keyID = CPubKey(vSolutions[1]).GetID();
|
||||
if (this->HaveKey(keyID))
|
||||
return ISMINE_SPENDABLE;
|
||||
}
|
||||
break;
|
||||
|
||||
case TX_PUBKEY:
|
||||
keyID = CPubKey(vSolutions[0]).GetID();
|
||||
if (this->HaveKey(keyID))
|
||||
|
||||
@@ -78,16 +78,6 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& _scriptPubKey)
|
||||
case TX_NONSTANDARD:
|
||||
case TX_NULL_DATA:
|
||||
break;
|
||||
case TX_CRYPTOCONDITION:
|
||||
// for now, default is that the first value returned will be the script, subsequent values will be
|
||||
// pubkeys. if we have the first pub key in our wallet, we consider this spendable
|
||||
if (vSolutions.size() > 1)
|
||||
{
|
||||
keyID = CPubKey(vSolutions[1]).GetID();
|
||||
if (keystore.HaveKey(keyID))
|
||||
return ISMINE_SPENDABLE;
|
||||
}
|
||||
break;
|
||||
case TX_PUBKEY:
|
||||
keyID = CPubKey(vSolutions[0]).GetID();
|
||||
if (keystore.HaveKey(keyID))
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
## ./util/build-debian-package.sh # build amd64 package
|
||||
## ./util/build-debian-package.sh aarch64 # build package for specific archiecture
|
||||
|
||||
# Check if running on Debian and exit if it is not
|
||||
if grep -qi "Debian" /etc/os-release; then
|
||||
:
|
||||
else
|
||||
echo -e "NOT RUNNING THIS SCRIPT ON DEBIAN! Try again with Debian." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCH=${1:-amd64}
|
||||
echo "Let There Be Hush Debian Packages"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user