@@ -1,348 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
# Wrapper for compilers which do not understand '-c -o'.
|
|
||||||
|
|
||||||
scriptversion=2018-03-07.03; # UTC
|
|
||||||
|
|
||||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
|
||||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
|
||||||
# distribute this file as part of a program that contains a
|
|
||||||
# configuration script generated by Autoconf, you may include it under
|
|
||||||
# the same distribution terms that you use for the rest of that program.
|
|
||||||
|
|
||||||
# This file is maintained in Automake, please report
|
|
||||||
# bugs to <bug-automake@gnu.org> or send patches to
|
|
||||||
# <automake-patches@gnu.org>.
|
|
||||||
|
|
||||||
nl='
|
|
||||||
'
|
|
||||||
|
|
||||||
# We need space, tab and new line, in precisely that order. Quoting is
|
|
||||||
# there to prevent tools from complaining about whitespace usage.
|
|
||||||
IFS=" "" $nl"
|
|
||||||
|
|
||||||
file_conv=
|
|
||||||
|
|
||||||
# func_file_conv build_file lazy
|
|
||||||
# Convert a $build file to $host form and store it in $file
|
|
||||||
# Currently only supports Windows hosts. If the determined conversion
|
|
||||||
# type is listed in (the comma separated) LAZY, no conversion will
|
|
||||||
# take place.
|
|
||||||
func_file_conv ()
|
|
||||||
{
|
|
||||||
file=$1
|
|
||||||
case $file in
|
|
||||||
/ | /[!/]*) # absolute file, and not a UNC file
|
|
||||||
if test -z "$file_conv"; then
|
|
||||||
# lazily determine how to convert abs files
|
|
||||||
case `uname -s` in
|
|
||||||
MINGW*)
|
|
||||||
file_conv=mingw
|
|
||||||
;;
|
|
||||||
CYGWIN*)
|
|
||||||
file_conv=cygwin
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
file_conv=wine
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
case $file_conv/,$2, in
|
|
||||||
*,$file_conv,*)
|
|
||||||
;;
|
|
||||||
mingw/*)
|
|
||||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
|
||||||
;;
|
|
||||||
cygwin/*)
|
|
||||||
file=`cygpath -m "$file" || echo "$file"`
|
|
||||||
;;
|
|
||||||
wine/*)
|
|
||||||
file=`winepath -w "$file" || echo "$file"`
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# func_cl_dashL linkdir
|
|
||||||
# Make cl look for libraries in LINKDIR
|
|
||||||
func_cl_dashL ()
|
|
||||||
{
|
|
||||||
func_file_conv "$1"
|
|
||||||
if test -z "$lib_path"; then
|
|
||||||
lib_path=$file
|
|
||||||
else
|
|
||||||
lib_path="$lib_path;$file"
|
|
||||||
fi
|
|
||||||
linker_opts="$linker_opts -LIBPATH:$file"
|
|
||||||
}
|
|
||||||
|
|
||||||
# func_cl_dashl library
|
|
||||||
# Do a library search-path lookup for cl
|
|
||||||
func_cl_dashl ()
|
|
||||||
{
|
|
||||||
lib=$1
|
|
||||||
found=no
|
|
||||||
save_IFS=$IFS
|
|
||||||
IFS=';'
|
|
||||||
for dir in $lib_path $LIB
|
|
||||||
do
|
|
||||||
IFS=$save_IFS
|
|
||||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
|
||||||
found=yes
|
|
||||||
lib=$dir/$lib.dll.lib
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if test -f "$dir/$lib.lib"; then
|
|
||||||
found=yes
|
|
||||||
lib=$dir/$lib.lib
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if test -f "$dir/lib$lib.a"; then
|
|
||||||
found=yes
|
|
||||||
lib=$dir/lib$lib.a
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS=$save_IFS
|
|
||||||
|
|
||||||
if test "$found" != yes; then
|
|
||||||
lib=$lib.lib
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# func_cl_wrapper cl arg...
|
|
||||||
# Adjust compile command to suit cl
|
|
||||||
func_cl_wrapper ()
|
|
||||||
{
|
|
||||||
# Assume a capable shell
|
|
||||||
lib_path=
|
|
||||||
shared=:
|
|
||||||
linker_opts=
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
if test -n "$eat"; then
|
|
||||||
eat=
|
|
||||||
else
|
|
||||||
case $1 in
|
|
||||||
-o)
|
|
||||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
|
||||||
eat=1
|
|
||||||
case $2 in
|
|
||||||
*.o | *.[oO][bB][jJ])
|
|
||||||
func_file_conv "$2"
|
|
||||||
set x "$@" -Fo"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
func_file_conv "$2"
|
|
||||||
set x "$@" -Fe"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
-I)
|
|
||||||
eat=1
|
|
||||||
func_file_conv "$2" mingw
|
|
||||||
set x "$@" -I"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-I*)
|
|
||||||
func_file_conv "${1#-I}" mingw
|
|
||||||
set x "$@" -I"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-l)
|
|
||||||
eat=1
|
|
||||||
func_cl_dashl "$2"
|
|
||||||
set x "$@" "$lib"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-l*)
|
|
||||||
func_cl_dashl "${1#-l}"
|
|
||||||
set x "$@" "$lib"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-L)
|
|
||||||
eat=1
|
|
||||||
func_cl_dashL "$2"
|
|
||||||
;;
|
|
||||||
-L*)
|
|
||||||
func_cl_dashL "${1#-L}"
|
|
||||||
;;
|
|
||||||
-static)
|
|
||||||
shared=false
|
|
||||||
;;
|
|
||||||
-Wl,*)
|
|
||||||
arg=${1#-Wl,}
|
|
||||||
save_ifs="$IFS"; IFS=','
|
|
||||||
for flag in $arg; do
|
|
||||||
IFS="$save_ifs"
|
|
||||||
linker_opts="$linker_opts $flag"
|
|
||||||
done
|
|
||||||
IFS="$save_ifs"
|
|
||||||
;;
|
|
||||||
-Xlinker)
|
|
||||||
eat=1
|
|
||||||
linker_opts="$linker_opts $2"
|
|
||||||
;;
|
|
||||||
-*)
|
|
||||||
set x "$@" "$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
|
||||||
func_file_conv "$1"
|
|
||||||
set x "$@" -Tp"$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
|
||||||
func_file_conv "$1" mingw
|
|
||||||
set x "$@" "$file"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set x "$@" "$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
if test -n "$linker_opts"; then
|
|
||||||
linker_opts="-link$linker_opts"
|
|
||||||
fi
|
|
||||||
exec "$@" $linker_opts
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
eat=
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
'')
|
|
||||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
-h | --h*)
|
|
||||||
cat <<\EOF
|
|
||||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
|
||||||
|
|
||||||
Wrapper for compilers which do not understand '-c -o'.
|
|
||||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
|
||||||
arguments, and rename the output as expected.
|
|
||||||
|
|
||||||
If you are trying to build a whole package this is not the
|
|
||||||
right script to run: please start by reading the file 'INSTALL'.
|
|
||||||
|
|
||||||
Report bugs to <bug-automake@gnu.org>.
|
|
||||||
EOF
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
-v | --v*)
|
|
||||||
echo "compile $scriptversion"
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
|
||||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
|
||||||
func_cl_wrapper "$@" # Doesn't return...
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
ofile=
|
|
||||||
cfile=
|
|
||||||
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
if test -n "$eat"; then
|
|
||||||
eat=
|
|
||||||
else
|
|
||||||
case $1 in
|
|
||||||
-o)
|
|
||||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
|
||||||
# So we strip '-o arg' only if arg is an object.
|
|
||||||
eat=1
|
|
||||||
case $2 in
|
|
||||||
*.o | *.obj)
|
|
||||||
ofile=$2
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set x "$@" -o "$2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*.c)
|
|
||||||
cfile=$1
|
|
||||||
set x "$@" "$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set x "$@" "$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if test -z "$ofile" || test -z "$cfile"; then
|
|
||||||
# If no '-o' option was seen then we might have been invoked from a
|
|
||||||
# pattern rule where we don't need one. That is ok -- this is a
|
|
||||||
# normal compilation that the losing compiler can handle. If no
|
|
||||||
# '.c' file was seen then we are probably linking. That is also
|
|
||||||
# ok.
|
|
||||||
exec "$@"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Name of file we expect compiler to create.
|
|
||||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
|
||||||
|
|
||||||
# Create the lock directory.
|
|
||||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
|
||||||
# that we are using for the .o file. Also, base the name on the expected
|
|
||||||
# object file name, since that is what matters with a parallel build.
|
|
||||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
|
||||||
while true; do
|
|
||||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
# FIXME: race condition here if user kills between mkdir and trap.
|
|
||||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
|
||||||
|
|
||||||
# Run the compile.
|
|
||||||
"$@"
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
if test -f "$cofile"; then
|
|
||||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
|
||||||
elif test -f "${cofile}bj"; then
|
|
||||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rmdir "$lockdir"
|
|
||||||
exit $ret
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# mode: shell-script
|
|
||||||
# sh-indentation: 2
|
|
||||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
|
||||||
# time-stamp-start: "scriptversion="
|
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
||||||
# time-stamp-time-zone: "UTC0"
|
|
||||||
# time-stamp-end: "; # UTC"
|
|
||||||
# End:
|
|
||||||
@@ -1501,7 +1501,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
fReindex = true;
|
fReindex = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool clearWitnessCaches = false;
|
bool clearWitnessCaches = false;
|
||||||
|
|
||||||
bool fLoaded = false;
|
bool fLoaded = false;
|
||||||
@@ -1874,9 +1874,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
VERUS_MINTBLOCKS = GetBoolArg("-mint", false);
|
VERUS_MINTBLOCKS = GetBoolArg("-mint", false);
|
||||||
|
|
||||||
if (pwalletMain || !GetArg("-mineraddress", "").empty())
|
if (pwalletMain || !GetArg("-mineraddress", "").empty())
|
||||||
GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 0));
|
GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", -1));
|
||||||
#else
|
#else
|
||||||
GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", 0));
|
GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", -1));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1373,7 +1373,7 @@ void komodo_passport_iteration()
|
|||||||
{
|
{
|
||||||
static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime,callcounter,lastinterest;
|
static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime,callcounter,lastinterest;
|
||||||
int32_t maxseconds = 10;
|
int32_t maxseconds = 10;
|
||||||
FILE *fp; uint8_t *filedata; long fpos,datalen,lastfpos; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0;
|
FILE *fp; uint8_t *filedata; long fpos,datalen,lastfpos; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0; //CBlockIndex *pindex;
|
||||||
expired = 0;
|
expired = 0;
|
||||||
while ( KOMODO_INITDONE == 0 )
|
while ( KOMODO_INITDONE == 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1657,11 +1657,9 @@ void komodo_args(char *argv0)
|
|||||||
std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[8192],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,baseid,len,n,extralen = 0;
|
std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[8192],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,baseid,len,n,extralen = 0;
|
||||||
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
||||||
|
|
||||||
if ( GetBoolArg("-gen", false) != 0 )\
|
if ( GetBoolArg("-gen", false) != 0 )
|
||||||
{
|
{
|
||||||
KOMODO_MININGTHREADS = GetArg("-genproclimit",-1);
|
KOMODO_MININGTHREADS = GetArg("-genproclimit",-1);
|
||||||
if (KOMODO_MININGTHREADS == 0)
|
|
||||||
mapArgs["-gen"] = "0";
|
|
||||||
}
|
}
|
||||||
else KOMODO_MININGTHREADS = 0;
|
else KOMODO_MININGTHREADS = 0;
|
||||||
|
|
||||||
@@ -1679,6 +1677,8 @@ void komodo_args(char *argv0)
|
|||||||
if ( strcmp(NOTARY_PUBKEY.c_str(),Notaries_elected1[i][1]) == 0 )
|
if ( strcmp(NOTARY_PUBKEY.c_str(),Notaries_elected1[i][1]) == 0 )
|
||||||
{
|
{
|
||||||
IS_KOMODO_NOTARY = 1;
|
IS_KOMODO_NOTARY = 1;
|
||||||
|
KOMODO_MININGTHREADS = 1;
|
||||||
|
mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS);
|
||||||
fprintf(stderr,"running as notary.%d %s\n",i,Notaries_elected1[i][0]);
|
fprintf(stderr,"running as notary.%d %s\n",i,Notaries_elected1[i][0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1781,8 +1781,9 @@ void komodo_args(char *argv0)
|
|||||||
// for now, we only support 50% PoS due to other parts of the algorithm needing adjustment for
|
// for now, we only support 50% PoS due to other parts of the algorithm needing adjustment for
|
||||||
// other values
|
// other values
|
||||||
if ( (ASSETCHAINS_LWMAPOS = GetArg("-ac_veruspos",0)) != 0 )
|
if ( (ASSETCHAINS_LWMAPOS = GetArg("-ac_veruspos",0)) != 0 )
|
||||||
|
{
|
||||||
ASSETCHAINS_LWMAPOS = 50;
|
ASSETCHAINS_LWMAPOS = 50;
|
||||||
|
}
|
||||||
ASSETCHAINS_SAPLING = GetArg("-ac_sapling", -1);
|
ASSETCHAINS_SAPLING = GetArg("-ac_sapling", -1);
|
||||||
if (ASSETCHAINS_SAPLING == -1)
|
if (ASSETCHAINS_SAPLING == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
13
src/main.cpp
13
src/main.cpp
@@ -5048,6 +5048,19 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C
|
|||||||
auto verifier = libzcash::ProofVerifier::Disabled();
|
auto verifier = libzcash::ProofVerifier::Disabled();
|
||||||
if ((!CheckBlock(futureblockp,pindex->GetHeight(),pindex,block, state, verifier,0)) || !ContextualCheckBlock(block, state, pindex->pprev))
|
if ((!CheckBlock(futureblockp,pindex->GetHeight(),pindex,block, state, verifier,0)) || !ContextualCheckBlock(block, state, pindex->pprev))
|
||||||
{
|
{
|
||||||
|
static int32_t saplinght = -1;
|
||||||
|
CBlockIndex *tmpptr;
|
||||||
|
if ( saplinght == -1 )
|
||||||
|
saplinght = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight;
|
||||||
|
if ( saplinght < 0 )
|
||||||
|
*futureblockp = 1;
|
||||||
|
// the problem is when a future sapling block comes in before we detected saplinght
|
||||||
|
if ( saplinght > 0 && (tmpptr= chainActive.LastTip()) != 0 )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"saplinght.%d tipht.%d blockht.%d cmp.%d\n",saplinght,(int32_t)tmpptr->GetHeight(),pindex->GetHeight(),pindex->GetHeight() < 0 || pindex->GetHeight() >= saplinght || (tmpptr->GetHeight() > saplinght-720 && tmpptr->GetHeight() < saplinght+720));
|
||||||
|
if ( pindex->GetHeight() < 0 || pindex->GetHeight() >= saplinght || (tmpptr->GetHeight() > saplinght-720 && tmpptr->GetHeight() < saplinght+720) )
|
||||||
|
*futureblockp = 1;
|
||||||
|
}
|
||||||
if ( *futureblockp == 0 )
|
if ( *futureblockp == 0 )
|
||||||
{
|
{
|
||||||
if (state.IsInvalid() && !state.CorruptionPossible()) {
|
if (state.IsInvalid() && !state.CorruptionPossible()) {
|
||||||
|
|||||||
117
src/miner.cpp
117
src/miner.cpp
@@ -68,7 +68,7 @@ public:
|
|||||||
set<uint256> setDependsOn;
|
set<uint256> setDependsOn;
|
||||||
CFeeRate feeRate;
|
CFeeRate feeRate;
|
||||||
double dPriority;
|
double dPriority;
|
||||||
|
|
||||||
COrphan(const CTransaction* ptxIn) : ptx(ptxIn), feeRate(0), dPriority(0)
|
COrphan(const CTransaction* ptxIn) : ptx(ptxIn), feeRate(0), dPriority(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -82,10 +82,10 @@ typedef boost::tuple<double, CFeeRate, const CTransaction*> TxPriority;
|
|||||||
class TxPriorityCompare
|
class TxPriorityCompare
|
||||||
{
|
{
|
||||||
bool byFee;
|
bool byFee;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TxPriorityCompare(bool _byFee) : byFee(_byFee) { }
|
TxPriorityCompare(bool _byFee) : byFee(_byFee) { }
|
||||||
|
|
||||||
bool operator()(const TxPriority& a, const TxPriority& b)
|
bool operator()(const TxPriority& a, const TxPriority& b)
|
||||||
{
|
{
|
||||||
if (byFee)
|
if (byFee)
|
||||||
@@ -170,27 +170,27 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
// -blockversion=N to test forking scenarios
|
// -blockversion=N to test forking scenarios
|
||||||
if (Params().MineBlocksOnDemand())
|
if (Params().MineBlocksOnDemand())
|
||||||
pblock->nVersion = GetArg("-blockversion", pblock->nVersion);
|
pblock->nVersion = GetArg("-blockversion", pblock->nVersion);
|
||||||
|
|
||||||
// Add dummy coinbase tx as first transaction
|
// Add dummy coinbase tx as first transaction
|
||||||
pblock->vtx.push_back(CTransaction());
|
pblock->vtx.push_back(CTransaction());
|
||||||
pblocktemplate->vTxFees.push_back(-1); // updated at end
|
pblocktemplate->vTxFees.push_back(-1); // updated at end
|
||||||
pblocktemplate->vTxSigOps.push_back(-1); // updated at end
|
pblocktemplate->vTxSigOps.push_back(-1); // updated at end
|
||||||
|
|
||||||
// Largest block you're willing to create:
|
// 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(chainActive.LastTip()->GetHeight()+1));
|
||||||
// Limit to betweeen 1K and MAX_BLOCK_SIZE-1K for sanity:
|
// 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(chainActive.LastTip()->GetHeight()+1)-1000), nBlockMaxSize));
|
||||||
|
|
||||||
// How much of the block should be dedicated to high-priority transactions,
|
// How much of the block should be dedicated to high-priority transactions,
|
||||||
// included regardless of the fees they pay
|
// included regardless of the fees they pay
|
||||||
unsigned int nBlockPrioritySize = GetArg("-blockprioritysize", DEFAULT_BLOCK_PRIORITY_SIZE);
|
unsigned int nBlockPrioritySize = GetArg("-blockprioritysize", DEFAULT_BLOCK_PRIORITY_SIZE);
|
||||||
nBlockPrioritySize = std::min(nBlockMaxSize, nBlockPrioritySize);
|
nBlockPrioritySize = std::min(nBlockMaxSize, nBlockPrioritySize);
|
||||||
|
|
||||||
// Minimum block size you want to create; block will be filled with free transactions
|
// 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:
|
// until there are no more or the block reaches this size:
|
||||||
unsigned int nBlockMinSize = GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE);
|
unsigned int nBlockMinSize = GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE);
|
||||||
nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize);
|
nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize);
|
||||||
|
|
||||||
// Collect memory pool transactions into the block
|
// Collect memory pool transactions into the block
|
||||||
CAmount nFees = 0;
|
CAmount nFees = 0;
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
|
|
||||||
CCoinsViewCache view(pcoinsTip);
|
CCoinsViewCache view(pcoinsTip);
|
||||||
uint32_t expired; uint64_t commission;
|
uint32_t expired; uint64_t commission;
|
||||||
|
|
||||||
SaplingMerkleTree sapling_tree;
|
SaplingMerkleTree sapling_tree;
|
||||||
assert(view.GetSaplingAnchorAt(view.GetBestAnchor(SAPLING), sapling_tree));
|
assert(view.GetSaplingAnchorAt(view.GetBestAnchor(SAPLING), sapling_tree));
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
list<COrphan> vOrphan; // list memory doesn't move
|
list<COrphan> vOrphan; // list memory doesn't move
|
||||||
map<uint256, vector<COrphan*> > mapDependers;
|
map<uint256, vector<COrphan*> > mapDependers;
|
||||||
bool fPrintPriority = GetBoolArg("-printpriority", false);
|
bool fPrintPriority = GetBoolArg("-printpriority", false);
|
||||||
|
|
||||||
// This vector will be sorted into a priority queue:
|
// This vector will be sorted into a priority queue:
|
||||||
vector<TxPriority> vecPriority;
|
vector<TxPriority> vecPriority;
|
||||||
vecPriority.reserve(mempool.mapTx.size() + 1);
|
vecPriority.reserve(mempool.mapTx.size() + 1);
|
||||||
@@ -243,7 +243,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
mi != mempool.mapTx.end(); ++mi)
|
mi != mempool.mapTx.end(); ++mi)
|
||||||
{
|
{
|
||||||
const CTransaction& tx = mi->GetTx();
|
const CTransaction& tx = mi->GetTx();
|
||||||
|
|
||||||
int64_t nLockTimeCutoff = (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST)
|
int64_t nLockTimeCutoff = (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST)
|
||||||
? nMedianTimePast
|
? nMedianTimePast
|
||||||
: pblock->GetBlockTime();
|
: pblock->GetBlockTime();
|
||||||
@@ -314,16 +314,16 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fMissingInputs) continue;
|
if (fMissingInputs) continue;
|
||||||
|
|
||||||
// Priority is sum(valuein * age) / modified_txsize
|
// Priority is sum(valuein * age) / modified_txsize
|
||||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||||
dPriority = tx.ComputePriority(dPriority, nTxSize);
|
dPriority = tx.ComputePriority(dPriority, nTxSize);
|
||||||
|
|
||||||
uint256 hash = tx.GetHash();
|
uint256 hash = tx.GetHash();
|
||||||
mempool.ApplyDeltas(hash, dPriority, nTotalIn);
|
mempool.ApplyDeltas(hash, dPriority, nTotalIn);
|
||||||
|
|
||||||
CFeeRate feeRate(nTotalIn-tx.GetValueOut(), nTxSize);
|
CFeeRate feeRate(nTotalIn-tx.GetValueOut(), nTxSize);
|
||||||
|
|
||||||
if (porphan)
|
if (porphan)
|
||||||
{
|
{
|
||||||
porphan->dPriority = dPriority;
|
porphan->dPriority = dPriority;
|
||||||
@@ -339,20 +339,20 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
int64_t interest;
|
int64_t interest;
|
||||||
int nBlockSigOps = 100;
|
int nBlockSigOps = 100;
|
||||||
bool fSortedByFee = (nBlockPrioritySize <= 0);
|
bool fSortedByFee = (nBlockPrioritySize <= 0);
|
||||||
|
|
||||||
TxPriorityCompare comparer(fSortedByFee);
|
TxPriorityCompare comparer(fSortedByFee);
|
||||||
std::make_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
std::make_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
||||||
|
|
||||||
while (!vecPriority.empty())
|
while (!vecPriority.empty())
|
||||||
{
|
{
|
||||||
// Take highest priority transaction off the priority queue:
|
// Take highest priority transaction off the priority queue:
|
||||||
double dPriority = vecPriority.front().get<0>();
|
double dPriority = vecPriority.front().get<0>();
|
||||||
CFeeRate feeRate = vecPriority.front().get<1>();
|
CFeeRate feeRate = vecPriority.front().get<1>();
|
||||||
const CTransaction& tx = *(vecPriority.front().get<2>());
|
const CTransaction& tx = *(vecPriority.front().get<2>());
|
||||||
|
|
||||||
std::pop_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
std::pop_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
||||||
vecPriority.pop_back();
|
vecPriority.pop_back();
|
||||||
|
|
||||||
// Size limits
|
// Size limits
|
||||||
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||||
if (nBlockSize + nTxSize >= nBlockMaxSize-512) // room for extra autotx
|
if (nBlockSize + nTxSize >= nBlockMaxSize-512) // room for extra autotx
|
||||||
@@ -360,7 +360,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
//fprintf(stderr,"nBlockSize %d + %d nTxSize >= %d nBlockMaxSize\n",(int32_t)nBlockSize,(int32_t)nTxSize,(int32_t)nBlockMaxSize);
|
//fprintf(stderr,"nBlockSize %d + %d nTxSize >= %d nBlockMaxSize\n",(int32_t)nBlockSize,(int32_t)nTxSize,(int32_t)nBlockMaxSize);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legacy limits on sigOps:
|
// Legacy limits on sigOps:
|
||||||
unsigned int nTxSigOps = GetLegacySigOpCount(tx);
|
unsigned int nTxSigOps = GetLegacySigOpCount(tx);
|
||||||
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1)
|
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1)
|
||||||
@@ -387,14 +387,14 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
comparer = TxPriorityCompare(fSortedByFee);
|
comparer = TxPriorityCompare(fSortedByFee);
|
||||||
std::make_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
std::make_heap(vecPriority.begin(), vecPriority.end(), comparer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!view.HaveInputs(tx))
|
if (!view.HaveInputs(tx))
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"dont have inputs\n");
|
//fprintf(stderr,"dont have inputs\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CAmount nTxFees = view.GetValueIn(chainActive.LastTip()->GetHeight(),&interest,tx,chainActive.LastTip()->nTime)-tx.GetValueOut();
|
CAmount nTxFees = view.GetValueIn(chainActive.LastTip()->GetHeight(),&interest,tx,chainActive.LastTip()->nTime)-tx.GetValueOut();
|
||||||
|
|
||||||
nTxSigOps += GetP2SHSigOpCount(tx, view);
|
nTxSigOps += GetP2SHSigOpCount(tx, view);
|
||||||
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1)
|
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1)
|
||||||
{
|
{
|
||||||
@@ -425,12 +425,12 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
++nBlockTx;
|
++nBlockTx;
|
||||||
nBlockSigOps += nTxSigOps;
|
nBlockSigOps += nTxSigOps;
|
||||||
nFees += nTxFees;
|
nFees += nTxFees;
|
||||||
|
|
||||||
if (fPrintPriority)
|
if (fPrintPriority)
|
||||||
{
|
{
|
||||||
LogPrintf("priority %.1f fee %s txid %s\n",dPriority, feeRate.ToString(), tx.GetHash().ToString());
|
LogPrintf("priority %.1f fee %s txid %s\n",dPriority, feeRate.ToString(), tx.GetHash().ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add transactions that depend on this one to the priority queue
|
// Add transactions that depend on this one to the priority queue
|
||||||
if (mapDependers.count(hash))
|
if (mapDependers.count(hash))
|
||||||
{
|
{
|
||||||
@@ -448,7 +448,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nLastBlockTx = nBlockTx;
|
nLastBlockTx = nBlockTx;
|
||||||
nLastBlockSize = nBlockSize;
|
nLastBlockSize = nBlockSize;
|
||||||
blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||||
@@ -497,7 +497,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
//printf("staking PoS ht.%d t%u lag.%u\n",(int32_t)chainActive.LastTip()->GetHeight()+1,blocktime,(uint32_t)(GetAdjustedTime() - (blocktime-13)));
|
//printf("staking PoS ht.%d t%u lag.%u\n",(int32_t)chainActive.LastTip()->GetHeight()+1,blocktime,(uint32_t)(GetAdjustedTime() - (blocktime-13)));
|
||||||
} else return(0); //fprintf(stderr,"no utxos eligible for staking\n");
|
} else return(0); //fprintf(stderr,"no utxos eligible for staking\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create coinbase tx
|
// Create coinbase tx
|
||||||
CMutableTransaction txNew = CreateNewContextualCMutableTransaction(consensusParams, nHeight);
|
CMutableTransaction txNew = CreateNewContextualCMutableTransaction(consensusParams, nHeight);
|
||||||
txNew.vin.resize(1);
|
txNew.vin.resize(1);
|
||||||
@@ -531,7 +531,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
fprintf(stderr,"CreateNewBlock: attempt to add timelock to pay2sh or pay2cc\n");
|
fprintf(stderr,"CreateNewBlock: attempt to add timelock to pay2sh or pay2cc\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
opretScript += scriptPubKeyIn;
|
opretScript += scriptPubKeyIn;
|
||||||
|
|
||||||
txNew.vout[0].scriptPubKey = CScriptExt().PayToScriptHash(CScriptID(opretScript));
|
txNew.vout[0].scriptPubKey = CScriptExt().PayToScriptHash(CScriptID(opretScript));
|
||||||
@@ -578,7 +578,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
nonce >>= 16;
|
nonce >>= 16;
|
||||||
pblock->nNonce = ArithToUint256(nonce);
|
pblock->nNonce = ArithToUint256(nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in header
|
// Fill in header
|
||||||
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
|
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
|
||||||
pblock->hashFinalSaplingRoot = sapling_tree.root();
|
pblock->hashFinalSaplingRoot = sapling_tree.root();
|
||||||
@@ -638,7 +638,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
//fprintf(stderr,"done new block\n");
|
//fprintf(stderr,"done new block\n");
|
||||||
return pblocktemplate.release();
|
return pblocktemplate.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey)
|
boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey)
|
||||||
@@ -661,11 +661,11 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
return boost::optional<CScript>();
|
return boost::optional<CScript>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CScript scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
|
CScript scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||||
return scriptPubKey;
|
return scriptPubKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
|
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
|
||||||
{
|
{
|
||||||
@@ -675,7 +675,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
{
|
{
|
||||||
boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey();
|
boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!scriptPubKey) {
|
if (!scriptPubKey) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -703,7 +703,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
|
|||||||
CMutableTransaction txCoinbase(pblock->vtx[0]);
|
CMutableTransaction txCoinbase(pblock->vtx[0]);
|
||||||
txCoinbase.vin[0].scriptSig = (CScript() << nHeight << CScriptNum(nExtraNonce)) + COINBASE_FLAGS;
|
txCoinbase.vin[0].scriptSig = (CScript() << nHeight << CScriptNum(nExtraNonce)) + COINBASE_FLAGS;
|
||||||
assert(txCoinbase.vin[0].scriptSig.size() <= 100);
|
assert(txCoinbase.vin[0].scriptSig.size() <= 100);
|
||||||
|
|
||||||
pblock->vtx[0] = txCoinbase;
|
pblock->vtx[0] = txCoinbase;
|
||||||
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
|
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
|
||||||
}
|
}
|
||||||
@@ -783,7 +783,7 @@ static bool ProcessBlockFound(CBlock* pblock)
|
|||||||
{
|
{
|
||||||
LogPrintf("%s\n", pblock->ToString());
|
LogPrintf("%s\n", pblock->ToString());
|
||||||
LogPrintf("generated %s height.%d\n", FormatMoney(pblock->vtx[0].vout[0].nValue),chainActive.LastTip()->GetHeight()+1);
|
LogPrintf("generated %s height.%d\n", FormatMoney(pblock->vtx[0].vout[0].nValue),chainActive.LastTip()->GetHeight()+1);
|
||||||
|
|
||||||
// Found a solution
|
// Found a solution
|
||||||
{
|
{
|
||||||
if (pblock->hashPrevBlock != chainActive.LastTip()->GetBlockHash())
|
if (pblock->hashPrevBlock != chainActive.LastTip()->GetBlockHash())
|
||||||
@@ -797,11 +797,11 @@ static bool ProcessBlockFound(CBlock* pblock)
|
|||||||
for (i=31; i>=0; i--)
|
for (i=31; i>=0; i--)
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
|
fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
|
||||||
fprintf(stderr," <- chainTip (stale)\n");
|
fprintf(stderr," <- chainTip (stale)\n");
|
||||||
|
|
||||||
return error("KomodoMiner: generated block is stale");
|
return error("KomodoMiner: generated block is stale");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
// Remove key from key pool
|
// Remove key from key pool
|
||||||
if ( IS_KOMODO_NOTARY == 0 )
|
if ( IS_KOMODO_NOTARY == 0 )
|
||||||
@@ -825,7 +825,7 @@ static bool ProcessBlockFound(CBlock* pblock)
|
|||||||
CValidationState state;
|
CValidationState state;
|
||||||
if (!ProcessNewBlock(1,chainActive.LastTip()->GetHeight()+1,state, NULL, pblock, true, NULL))
|
if (!ProcessNewBlock(1,chainActive.LastTip()->GetHeight()+1,state, NULL, pblock, true, NULL))
|
||||||
return error("KomodoMiner: ProcessNewBlock, block not accepted");
|
return error("KomodoMiner: ProcessNewBlock, block not accepted");
|
||||||
|
|
||||||
TrackMinedBlock(pblock->GetHash());
|
TrackMinedBlock(pblock->GetHash());
|
||||||
komodo_broadcast(pblock,16);
|
komodo_broadcast(pblock,16);
|
||||||
return true;
|
return true;
|
||||||
@@ -853,7 +853,7 @@ int32_t waitForPeers(const CChainParams &chainparams)
|
|||||||
if (fvNodesEmpty || IsNotInSync())
|
if (fvNodesEmpty || IsNotInSync())
|
||||||
{
|
{
|
||||||
int loops = 0, blockDiff = 0, newDiff = 0;
|
int loops = 0, blockDiff = 0, newDiff = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (fvNodesEmpty)
|
if (fvNodesEmpty)
|
||||||
{
|
{
|
||||||
@@ -1036,7 +1036,7 @@ void static VerusStaker(CWallet *pwallet)
|
|||||||
post.SetCompact(pblock->GetVerusPOSTarget());
|
post.SetCompact(pblock->GetVerusPOSTarget());
|
||||||
pindexPrev = get_chainactive(Mining_height - 100);
|
pindexPrev = get_chainactive(Mining_height - 100);
|
||||||
CTransaction &sTx = pblock->vtx[pblock->vtx.size()-1];
|
CTransaction &sTx = pblock->vtx[pblock->vtx.size()-1];
|
||||||
printf("POS hash: %s \ntarget: %s\n",
|
printf("POS hash: %s \ntarget: %s\n",
|
||||||
CTransaction::_GetVerusPOSHash(&(pblock->nNonce), sTx.vin[0].prevout.hash, sTx.vin[0].prevout.n, Mining_height, pindexPrev->GetBlockHeader().GetVerusEntropyHash(Mining_height - 100), sTx.vout[0].nValue).GetHex().c_str(), ArithToUint256(post).GetHex().c_str());
|
CTransaction::_GetVerusPOSHash(&(pblock->nNonce), sTx.vin[0].prevout.hash, sTx.vin[0].prevout.n, Mining_height, pindexPrev->GetBlockHeader().GetVerusEntropyHash(Mining_height - 100), sTx.vout[0].nValue).GetHex().c_str(), ArithToUint256(post).GetHex().c_str());
|
||||||
if (unlockTime > Mining_height && subsidy >= ASSETCHAINS_TIMELOCKGTE)
|
if (unlockTime > Mining_height && subsidy >= ASSETCHAINS_TIMELOCKGTE)
|
||||||
printf("- timelocked until block %i\n", unlockTime);
|
printf("- timelocked until block %i\n", unlockTime);
|
||||||
@@ -1356,15 +1356,15 @@ void static BitcoinMiner()
|
|||||||
SetThreadPriority(THREAD_PRIORITY_LOWEST);
|
SetThreadPriority(THREAD_PRIORITY_LOWEST);
|
||||||
RenameThread("komodo-miner");
|
RenameThread("komodo-miner");
|
||||||
const CChainParams& chainparams = Params();
|
const CChainParams& chainparams = Params();
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
// Each thread has its own key
|
// Each thread has its own key
|
||||||
CReserveKey reservekey(pwallet);
|
CReserveKey reservekey(pwallet);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Each thread has its own counter
|
// Each thread has its own counter
|
||||||
unsigned int nExtraNonce = 0;
|
unsigned int nExtraNonce = 0;
|
||||||
|
|
||||||
unsigned int n = chainparams.EquihashN();
|
unsigned int n = chainparams.EquihashN();
|
||||||
unsigned int k = chainparams.EquihashK();
|
unsigned int k = chainparams.EquihashK();
|
||||||
uint8_t *script; uint64_t total; int32_t i,j,gpucount=KOMODO_MAXGPUCOUNT,notaryid = -1;
|
uint8_t *script; uint64_t total; int32_t i,j,gpucount=KOMODO_MAXGPUCOUNT,notaryid = -1;
|
||||||
@@ -1395,7 +1395,7 @@ void static BitcoinMiner()
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
miningTimer.start();
|
miningTimer.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str());
|
fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str());
|
||||||
@@ -1418,7 +1418,7 @@ void static BitcoinMiner()
|
|||||||
break;
|
break;
|
||||||
MilliSleep(15000);
|
MilliSleep(15000);
|
||||||
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,ASSETCHAINS_SYMBOL,(int32_t)IsInitialBlockDownload());
|
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,ASSETCHAINS_SYMBOL,(int32_t)IsInitialBlockDownload());
|
||||||
|
|
||||||
} while (true);
|
} while (true);
|
||||||
//fprintf(stderr,"%s Found peers\n",ASSETCHAINS_SYMBOL);
|
//fprintf(stderr,"%s Found peers\n",ASSETCHAINS_SYMBOL);
|
||||||
miningTimer.start();
|
miningTimer.start();
|
||||||
@@ -1567,7 +1567,7 @@ void static BitcoinMiner()
|
|||||||
komodo_longestchain();
|
komodo_longestchain();
|
||||||
// Hash state
|
// Hash state
|
||||||
KOMODO_CHOSEN_ONE = 0;
|
KOMODO_CHOSEN_ONE = 0;
|
||||||
|
|
||||||
crypto_generichash_blake2b_state state;
|
crypto_generichash_blake2b_state state;
|
||||||
EhInitialiseState(n, k, state);
|
EhInitialiseState(n, k, state);
|
||||||
// I = the block header minus nonce and solution.
|
// I = the block header minus nonce and solution.
|
||||||
@@ -1687,13 +1687,13 @@ void static BitcoinMiner()
|
|||||||
std::lock_guard<std::mutex> lock{m_cs};
|
std::lock_guard<std::mutex> lock{m_cs};
|
||||||
return cancelSolver;
|
return cancelSolver;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: factor this out into a function with the same API for each solver.
|
// TODO: factor this out into a function with the same API for each solver.
|
||||||
if (solver == "tromp" ) { //&& notaryid >= 0 ) {
|
if (solver == "tromp" ) { //&& notaryid >= 0 ) {
|
||||||
// Create solver and initialize it.
|
// Create solver and initialize it.
|
||||||
equi eq(1);
|
equi eq(1);
|
||||||
eq.setstate(&curr_state);
|
eq.setstate(&curr_state);
|
||||||
|
|
||||||
// Initialization done, start algo driver.
|
// Initialization done, start algo driver.
|
||||||
eq.digit0(0);
|
eq.digit0(0);
|
||||||
eq.xfull = eq.bfull = eq.hfull = 0;
|
eq.xfull = eq.bfull = eq.hfull = 0;
|
||||||
@@ -1705,7 +1705,7 @@ void static BitcoinMiner()
|
|||||||
}
|
}
|
||||||
eq.digitK(0);
|
eq.digitK(0);
|
||||||
ehSolverRuns.increment();
|
ehSolverRuns.increment();
|
||||||
|
|
||||||
// Convert solution indices to byte array (decompress) and pass it to validBlock method.
|
// Convert solution indices to byte array (decompress) and pass it to validBlock method.
|
||||||
for (size_t s = 0; s < eq.nsols; s++) {
|
for (size_t s = 0; s < eq.nsols; s++) {
|
||||||
LogPrint("pow", "Checking solution %d\n", s+1);
|
LogPrint("pow", "Checking solution %d\n", s+1);
|
||||||
@@ -1714,7 +1714,7 @@ void static BitcoinMiner()
|
|||||||
index_vector[i] = eq.sols[s][i];
|
index_vector[i] = eq.sols[s][i];
|
||||||
}
|
}
|
||||||
std::vector<unsigned char> sol_char = GetMinimalFromIndices(index_vector, DIGITBITS);
|
std::vector<unsigned char> sol_char = GetMinimalFromIndices(index_vector, DIGITBITS);
|
||||||
|
|
||||||
if (validBlock(sol_char)) {
|
if (validBlock(sol_char)) {
|
||||||
// If we find a POW solution, do not try other solutions
|
// If we find a POW solution, do not try other solutions
|
||||||
// because they become invalid as we created a new block in blockchain.
|
// because they become invalid as we created a new block in blockchain.
|
||||||
@@ -1741,7 +1741,7 @@ void static BitcoinMiner()
|
|||||||
cancelSolver = false;
|
cancelSolver = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for stop or if block needs to be rebuilt
|
// Check for stop or if block needs to be rebuilt
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
// Regtest mode doesn't require peers
|
// Regtest mode doesn't require peers
|
||||||
@@ -1811,7 +1811,7 @@ void static BitcoinMiner()
|
|||||||
miningTimer.stop();
|
miningTimer.stop();
|
||||||
c.disconnect();
|
c.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads)
|
void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads)
|
||||||
#else
|
#else
|
||||||
@@ -1819,10 +1819,10 @@ void static BitcoinMiner()
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
static boost::thread_group* minerThreads = NULL;
|
static boost::thread_group* minerThreads = NULL;
|
||||||
|
|
||||||
if (nThreads < 0)
|
if (nThreads < 0)
|
||||||
nThreads = GetNumCores();
|
nThreads = GetNumCores();
|
||||||
|
|
||||||
if (minerThreads != NULL)
|
if (minerThreads != NULL)
|
||||||
{
|
{
|
||||||
minerThreads->interrupt_all();
|
minerThreads->interrupt_all();
|
||||||
@@ -1831,8 +1831,13 @@ void static BitcoinMiner()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//fprintf(stderr,"nThreads.%d fGenerate.%d\n",(int32_t)nThreads,fGenerate);
|
//fprintf(stderr,"nThreads.%d fGenerate.%d\n",(int32_t)nThreads,fGenerate);
|
||||||
if ( nThreads == 0 && ASSETCHAINS_STAKED )
|
if ( ASSETCHAINS_STAKED > 0 && nThreads == 0 )
|
||||||
nThreads = 1;
|
{
|
||||||
|
if ( pwallet != NULL )
|
||||||
|
nThreads = 1;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((nThreads == 0 || !fGenerate) && (VERUS_MINTBLOCKS == 0 || pwallet == NULL))
|
if ((nThreads == 0 || !fGenerate) && (VERUS_MINTBLOCKS == 0 || pwallet == NULL))
|
||||||
return;
|
return;
|
||||||
@@ -1861,5 +1866,5 @@ void static BitcoinMiner()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_MINING
|
#endif // ENABLE_MINING
|
||||||
|
|||||||
@@ -344,7 +344,10 @@ UniValue setgenerate(const UniValue& params, bool fHelp)
|
|||||||
{
|
{
|
||||||
VERUS_MINTBLOCKS = 1;
|
VERUS_MINTBLOCKS = 1;
|
||||||
fGenerate = GetBoolArg("-gen", false);
|
fGenerate = GetBoolArg("-gen", false);
|
||||||
nGenProcLimit = KOMODO_MININGTHREADS;
|
if ( ASSETCHAINS_STAKED == 0 )
|
||||||
|
nGenProcLimit = KOMODO_MININGTHREADS;
|
||||||
|
else
|
||||||
|
KOMODO_MININGTHREADS = nGenProcLimit;
|
||||||
}
|
}
|
||||||
else if (!fGenerate)
|
else if (!fGenerate)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4113,6 +4113,9 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
|||||||
if ( fromSprout || toSprout )
|
if ( fromSprout || toSprout )
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER,"Sprout usage has expired");
|
throw JSONRPCError(RPC_INVALID_PARAMETER,"Sprout usage has expired");
|
||||||
}
|
}
|
||||||
|
if ( toSapling && ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
|
throw JSONRPCError(RPC_INVALID_PARAMETER,"Sprout usage will expire soon");
|
||||||
|
|
||||||
// If we are sending from a shielded address, all recipient
|
// If we are sending from a shielded address, all recipient
|
||||||
// shielded addresses must be of the same type.
|
// shielded addresses must be of the same type.
|
||||||
if ((fromSprout && toSapling) || (fromSapling && toSprout)) {
|
if ((fromSprout && toSapling) || (fromSapling && toSprout)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user