Browse Source

Merge branch 'danger' into dev

pull/71/head
Duke Leto 3 years ago
parent
commit
0502b3c219
  1. 4
      configure.ac
  2. 6
      contrib/checkpoints.pl
  3. 32
      doc/developer-notes.md
  4. 2
      doc/man/Makefile.am
  5. 90
      doc/man/komodo-cli.1
  6. 103
      doc/man/komodo-tx.1
  7. 637
      doc/man/komodod.1
  8. 2
      doc/wallet-backup.md
  9. 2
      src/bitcoind.cpp
  10. 2
      src/cc/CCPrices.h
  11. 4
      src/cc/CC_made_easy.md
  12. 2
      src/cc/cclib.cpp
  13. 6
      src/cc/dapps/dappstd.c
  14. 6
      src/cc/gamescc.cpp
  15. 86
      src/chainparams.cpp
  16. 2
      src/clientversion.cpp
  17. 2
      src/clientversion.h
  18. 18
      src/hush.h
  19. 24
      src/hush_bitcoind.h
  20. 4
      src/hush_cJSON.h
  21. 46
      src/hush_ccdata.h
  22. 99
      src/hush_defs.h
  23. 26
      src/hush_events.h
  24. 398
      src/hush_gateway.h
  25. 10
      src/hush_globals.h
  26. 2
      src/hush_nSPV_fullnode.h
  27. 8
      src/hush_nSPV_superlite.h
  28. 44
      src/hush_notary.h
  29. 18
      src/hush_pax.h
  30. 8
      src/hush_structs.h
  31. 8
      src/hush_utils.h
  32. 21
      src/main.cpp
  33. 20
      src/miner.cpp
  34. 22
      src/rpc/blockchain.cpp
  35. 53
      src/rpc/crosschain.cpp
  36. 2
      src/rpc/mining.cpp
  37. 4
      src/rpc/server.cpp
  38. 5
      src/stratum.cpp
  39. 3
      src/sync.cpp
  40. 17
      src/tush-cli
  41. 15
      src/tushd
  42. 2
      src/version.h
  43. 11
      src/wallet/crypter.cpp
  44. 24
      src/wallet/rpcwallet.cpp
  45. 2
      src/zcash/JoinSplit.cpp

4
configure.ac

@ -1,8 +1,8 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 8)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_MINOR, 9)
define(_CLIENT_VERSION_REVISION, 0)
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)))

6
contrib/checkpoints.pl

@ -37,9 +37,9 @@ while (1) {
}
my $time = qx{$hush getblock $last |grep time|cut -d: -f2| sed 's/,//g'};
chomp($time);
# TODO: This is Linux-only
my $line1 = qx{grep --text height=$prev ~/.komodo/HUSH3/debug.log};
my $line2 = qx{grep --text height=$blocks ~/.komodo/HUSH3/debug.log};
# TODO: This is Linux-only and assumes new (not legacy) dir
my $line1 = qx{grep --text height=$prev ~/.hush/HUSH3/debug.log};
my $line2 = qx{grep --text height=$blocks ~/.hush/HUSH3/debug.log};
my $txs_per_day = 2 * $perday; # default estimate is 2 txs per block, on average
my $total_txs = 0;
#print "line1: $line1\n";

32
doc/developer-notes.md

@ -9,19 +9,30 @@ A fresh sync preserves peers.dat, so it will always be faster than a "fresh clon
One way to do a fresh sync is:
```
cd ~/.komodo/HUSH3
cd ~/.hush/HUSH3
rm blocks chainstate database notarizations hushstate
```
NOTE: The legacy directory is ~/.komodo/HUSH3 and hushd will use data from either, or ~/.hush/HUSH3 if both exist.
If you are using `zindex=1` then you need to also delete zindex.dat
```
cd ~/.komodo/HUSH3
cd ~/.hush/HUSH3
rm zindex.dat blocks chainstate database notarizations hushstate
```
It's possible to confused hush if you ran old code, stop, restart, and then write out zindex.dat that is incorrect, with later hushds will load from disk and believe.
# Making a new release of Hush
* Update version in configure.ac and src/clientversion.h
* Run ./contrib/devtools/gen-manpages.sh, commit + push results
* Update checkpoints
* Update protocol version in src/version.h if necessary
* Make Gitea release
* Make Git Tag (Gitea can do this)
# Testing a Branch
@ -37,17 +48,17 @@ git checkout zindexdb
# we want to test a fresh sync, so backup current data
TIME=`perl -e "print time"`
mv ~/.komodo/{HUSH3,HUSH3-backup-$TIME}
mkdir ~/.komodo/HUSH3
mv ~/.hush/{HUSH3,HUSH3-backup-$TIME}
mkdir ~/.hush/HUSH3
# Use your previous config as a base
cp ~/.komodo/{HUSH3-backup-$TIME,HUSH3}/HUSH3.conf
cp ~/.hush/{HUSH3-backup-$TIME,HUSH3}/HUSH3.conf
# Add zindex to your node
echo "zindex=1" >> ~/.komodo/HUSH3/HUSH3.conf
echo "zindex=1" >> ~/.hush/HUSH3/HUSH3.conf
# This is optional but will likely speed up sync time greatly
cp ~/.komodo/{HUSH3-backup,HUSH3}/peers.dat
cp ~/.hush/{HUSH3-backup,HUSH3}/peers.dat
# This log file is helpful for debugging more and will contain a history of the
# size of the anonset at every block height
@ -77,7 +88,7 @@ These values should match on all nodes:
We should also check a recent block height to verify it's working correctly. The big "test" for this `zindexdb` branch is:
* If you stop a node, and restart, are the stats from `getchaintxtstats` correct, i.e. the anonset stats? For instance, `shielded_pool_size` should be close to 500000, if it's close to or exactly 0, something is wrong.
* Is there a new file called `zindex.dat` in `~/.komodo/HUSH3/` ?
* Is there a new file called `zindex.dat` in `~/.hush/HUSH3/` ?
* Is `zindex.dat` 149 bytes ?
# Coding
@ -135,8 +146,9 @@ on all categories (and give you a very large debug.log file).
**testnet and regtest modes**
Run with the -testnet option to run with "play zcash" on the test network, if you
are testing multi-machine code that needs to operate across the internet.
Run with the -testnet option to run with "play HUSH" on the test network, if you
are testing multi-machine code that needs to operate across the internet. You can
also make a Hush Smart Chain "testcoin" with a single command: `hushd -ac_name=COIN ...`
If you are testing something that can run on one machine, run with the -regtest option.
In regression test mode, blocks can be created on-demand; see qa/rpc-tests/ for tests

2
doc/man/Makefile.am

@ -1 +1 @@
dist_man1_MANS=komodod.1 komodo-cli.1 komodo-tx.1
dist_man1_MANS=hushd.1 hush-cli.1 hush-tx.1

90
doc/man/komodo-cli.1

@ -1,90 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH KOMODO-CLI "1" "December 2019" "komodo-cli v3.3.0" "User Commands"
.SH NAME
komodo-cli \- manual page for komodo-cli v3.3.0
.SH DESCRIPTION
Komodo RPC client version v3.3.0\-bde7744d9
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.
.SS "Usage:"
.TP
komodo\-cli [options] <command> [params]
Send command to Komodo
.TP
komodo\-cli [options] help
List commands
.TP
komodo\-cli [options] help <command>
Get help for a command
.SH OPTIONS
.HP
\-?
.IP
This help message
.HP
\fB\-conf=\fR<file>
.IP
Specify configuration file (default: komodo.conf)
.HP
\fB\-datadir=\fR<dir>
.IP
Specify data directory
.HP
\fB\-testnet\fR
.IP
Use the test network
.HP
\fB\-regtest\fR
.IP
Enter regression test mode, which uses a special chain in which blocks
can be solved instantly. This is intended for regression testing tools
and app development.
.HP
\fB\-rpcconnect=\fR<ip>
.IP
Send commands to node running on <ip> (default: 127.0.0.1)
.HP
\fB\-rpcport=\fR<port>
.IP
Connect to JSON\-RPC on <port> (default: 8232 or testnet: 18232)
.HP
\fB\-rpcwait\fR
.IP
Wait for RPC server to start
.HP
\fB\-rpcuser=\fR<user>
.IP
Username for JSON\-RPC connections
.HP
\fB\-rpcpassword=\fR<pw>
.IP
Password for JSON\-RPC connections
.HP
\fB\-rpcclienttimeout=\fR<n>
.IP
Timeout in seconds during HTTP requests, or 0 for no timeout. (default:
900)
.HP
\fB\-stdin\fR
.IP
Read extra arguments from standard input, one per line until EOF/Ctrl\-D
(recommended for sensitive information such as passphrases)
.SH COPYRIGHT
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.
Copyright (C) 2009-2019 The Bitcoin Core Developers
Copyright (C) 2015-2019 The Zcash Developers
Copyright (C) 2015-2019 jl777 and SuperNET developers
Copyright (C) 2018-2019 The Hush developers
This is experimental software!!!
Distributed under the MIT software license, see the accompanying file COPYING
or <http://www.opensource.org/licenses/mit-license.php>.
This product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software written
by Eric Young.

103
doc/man/komodo-tx.1

@ -1,103 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH KOMODO-TX "1" "December 2019" "komodo-tx v3.3.0" "User Commands"
.SH NAME
komodo-tx \- manual page for komodo-tx v3.3.0
.SH DESCRIPTION
Hush komodo\-tx utility version v3.3.0\-bde7744d9
.SS "Usage:"
.TP
komodo\-tx [options] <hex\-tx> [commands]
Update hex\-encoded zcash transaction
.TP
komodo\-tx [options] \fB\-create\fR [commands]
Create hex\-encoded zcash transaction
.SH OPTIONS
.HP
\-?
.IP
This help message
.HP
\fB\-create\fR
.IP
Create new, empty TX.
.HP
\fB\-json\fR
.IP
Select JSON output
.HP
\fB\-txid\fR
.IP
Output only the hex\-encoded transaction id of the resultant transaction.
.HP
\fB\-regtest\fR
.IP
Enter regression test mode, which uses a special chain in which blocks
can be solved instantly.
.HP
\fB\-testnet\fR
.IP
Use the test network
.PP
Commands:
.IP
delin=N
.IP
Delete input N from TX
.IP
delout=N
.IP
Delete output N from TX
.IP
in=TXID:VOUT(:SEQUENCE_NUMBER)
.IP
Add input to TX
.IP
locktime=N
.IP
Set TX lock time to N
.IP
nversion=N
.IP
Set TX version to N
.IP
outaddr=VALUE:ADDRESS
.IP
Add address\-based output to TX
.IP
outscript=VALUE:SCRIPT
.IP
Add raw script output to TX
.IP
sign=HEIGHT:SIGHASH\-FLAGS
.IP
Add zero or more signatures to transaction. This command requires JSON
registers:prevtxs=JSON object, privatekeys=JSON object. See
signrawtransaction docs for format of sighash flags, JSON objects.
.PP
Register Commands:
.IP
load=NAME:FILENAME
.IP
Load JSON file FILENAME into register NAME
.IP
set=NAME:JSON\-STRING
.IP
Set register NAME to given JSON\-STRING
.SH COPYRIGHT
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.
Copyright (C) 2009-2019 The Bitcoin Core Developers
Copyright (C) 2015-2019 The Zcash Developers
Copyright (C) 2015-2019 jl777 and SuperNET developers
Copyright (C) 2018-2019 The Hush developers
This is experimental software!!!
Distributed under the MIT software license, see the accompanying file COPYING
or <http://www.opensource.org/licenses/mit-license.php>.
This product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software written
by Eric Young.

637
doc/man/komodod.1

@ -1,637 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH KOMODOD "1" "December 2019" "komodod v3.3.0" "User Commands"
.SH NAME
komodod \- manual page for komodod v3.3.0
.SH DESCRIPTION
Hush Daemon version v3.3.0\-bde7744d9
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.
.SS "Usage:"
.TP
komodod [options]
Start Hush\-flavored Komodo Daemon
.SH OPTIONS
.HP
\-?
.IP
This help message
.HP
\fB\-alerts\fR
.IP
Receive and display P2P network alerts (default: 1)
.HP
\fB\-alertnotify=\fR<cmd>
.IP
Execute command when a relevant alert is received or we see a really
long fork (%s in cmd is replaced by message)
.HP
\fB\-blocknotify=\fR<cmd>
.IP
Execute command when the best block changes (%s in cmd is replaced by
block hash)
.HP
\fB\-checkblocks=\fR<n>
.IP
How many blocks to check at startup (default: 288, 0 = all)
.HP
\fB\-checklevel=\fR<n>
.IP
How thorough the block verification of \fB\-checkblocks\fR is (0\-4, default: 3)
.HP
\fB\-clientname=\fR<SomeName>
.IP
Full node client name, default 'MagicBean'
.HP
\fB\-conf=\fR<file>
.IP
Specify configuration file (default: komodo.conf)
.HP
\fB\-daemon\fR
.IP
Run in the background as a daemon and accept commands
.HP
\fB\-datadir=\fR<dir>
.IP
Specify data directory
.HP
\fB\-exportdir=\fR<dir>
.IP
Specify directory to be used when exporting data
.HP
\fB\-dbcache=\fR<n>
.IP
Set database cache size in megabytes (4 to 16384, default: 450)
.HP
\fB\-loadblock=\fR<file>
.IP
Imports blocks from external blk000??.dat file on startup
.HP
\fB\-maxorphantx=\fR<n>
.IP
Keep at most <n> unconnectable transactions in memory (default: 100)
.HP
\fB\-mempooltxinputlimit=\fR<n>
.IP
[DEPRECATED FROM OVERWINTER] Set the maximum number of transparent
inputs in a transaction that the mempool will accept (default: 0 = no
limit applied)
.HP
\fB\-par=\fR<n>
.IP
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>
.IP
Specify pid file (default: komodod.pid)
.HP
\fB\-prune=\fR<n>
.IP
Reduce storage requirements by pruning (deleting) old blocks. This mode
disables wallet support and is incompatible with \fB\-txindex\fR. Warning:
Reverting this setting requires re\-downloading the entire blockchain.
(default: 0 = disable pruning blocks, >550 = target size in MiB to use
for block files)
.HP
\fB\-reindex\fR
.IP
Rebuild block chain index from current blk000??.dat files on startup
.HP
\fB\-sysperms\fR
.IP
Create new files with system default permissions, instead of umask 077
(only effective with disabled wallet functionality)
.HP
\fB\-txindex\fR
.IP
Maintain a full transaction index, used by the getrawtransaction rpc
call (default: 0)
.HP
\fB\-addressindex\fR
.IP
Maintain a full address index, used to query for the balance, txids and
unspent outputs for addresses (default: 0)
.HP
\fB\-timestampindex\fR
.IP
Maintain a timestamp index for block hashes, used to query blocks hashes
by a range of timestamps (default: 0)
.HP
\fB\-spentindex\fR
.IP
Maintain a full spent index, used to query the spending txid and input
index for an outpoint (default: 0)
.HP
\fB\-zindex\fR
.IP
Maintain extra statistics about shielded transactions and payments
(default: 0)
.PP
Connection options:
.HP
\fB\-addnode=\fR<ip>
.IP
Add a node to connect to and attempt to keep the connection open
.HP
\fB\-banscore=\fR<n>
.IP
Threshold for disconnecting misbehaving peers (default: 100)
.HP
\fB\-bantime=\fR<n>
.IP
Number of seconds to keep misbehaving peers from reconnecting (default:
86400)
.HP
\fB\-bind=\fR<addr>
.IP
Bind to given address and always listen on it. Use [host]:port notation
for IPv6
.HP
\fB\-connect=\fR<ip>
.IP
Connect only to the specified node(s)
.HP
\fB\-discover\fR
.IP
Discover own IP addresses (default: 1 when listening and no \fB\-externalip\fR
or \fB\-proxy\fR)
.HP
\fB\-dns\fR
.IP
Allow DNS lookups for \fB\-addnode\fR, \fB\-seednode\fR and \fB\-connect\fR (default: 1)
.HP
\fB\-dnsseed\fR
.IP
Query for peer addresses via DNS lookup, if low on addresses (default: 1
unless \fB\-connect\fR)
.HP
\fB\-externalip=\fR<ip>
.IP
Specify your own public address
.HP
\fB\-forcednsseed\fR
.IP
Always query for peer addresses via DNS lookup (default: 0)
.HP
\fB\-listen\fR
.IP
Accept connections from outside (default: 1 if no \fB\-proxy\fR or \fB\-connect\fR)
.HP
\fB\-listenonion\fR
.IP
Automatically create Tor hidden service (default: 1)
.HP
\fB\-maxconnections=\fR<n>
.IP
Maintain at most <n> connections to peers (default: 384)
.HP
\fB\-maxreceivebuffer=\fR<n>
.IP
Maximum per\-connection receive buffer, <n>*1000 bytes (default: 5000)
.HP
\fB\-maxsendbuffer=\fR<n>
.IP
Maximum per\-connection send buffer, <n>*1000 bytes (default: 1000)
.HP
\fB\-onion=\fR<ip:port>
.IP
Use separate SOCKS5 proxy to reach peers via Tor hidden services
(default: \fB\-proxy\fR)
.HP
\fB\-onlynet=\fR<net>
.IP
Only connect to nodes in network <net> (ipv4, ipv6 or onion)
.HP
\fB\-permitbaremultisig\fR
.IP
Relay non\-P2SH multisig (default: 1)
.HP
\fB\-peerbloomfilters\fR
.IP
Support filtering of blocks and transaction with Bloom filters (default:
1)
.HP
\fB\-port=\fR<port>
.IP
Listen for connections on <port> (default: 7770 or testnet: 17770)
.HP
\fB\-proxy=\fR<ip:port>
.IP
Connect through SOCKS5 proxy
.HP
\fB\-proxyrandomize\fR
.IP
Randomize credentials for every proxy connection. This enables Tor
stream isolation (default: 1)
.HP
\fB\-seednode=\fR<ip>
.IP
Connect to a node to retrieve peer addresses, and disconnect
.HP
\fB\-timeout=\fR<n>
.IP
Specify connection timeout in milliseconds (minimum: 1, default: 5000)
.HP
\fB\-torcontrol=\fR<ip>:<port>
.IP
Tor control port to use if onion listening enabled (default:
127.0.0.1:9051)
.HP
\fB\-torpassword=\fR<pass>
.IP
Tor control port password (default: empty)
.HP
\fB\-whitebind=\fR<addr>
.IP
Bind to given address and whitelist peers connecting to it. Use
[host]:port notation for IPv6
.HP
\fB\-whitelist=\fR<netmask>
.IP
Whitelist peers connecting from the given netmask or IP address. Can be
specified multiple times. Whitelisted peers cannot be DoS banned and
their transactions are always relayed, even if they are already in the
mempool, useful e.g. for a gateway
.PP
Wallet options:
.HP
\fB\-disablewallet\fR
.IP
Do not load the wallet and disable wallet RPC calls
.HP
\fB\-keypool=\fR<n>
.IP
Set key pool size to <n> (default: 100)
.HP
\fB\-paytxfee=\fR<amt>
.IP
Fee (in KMD/kB) to add to transactions you send (default: 0.00)
.HP
\fB\-rescan\fR
.IP
Rescan the block chain for missing wallet transactions on startup
.HP
\fB\-salvagewallet\fR
.IP
Attempt to recover private keys from a corrupt wallet.dat on startup
.HP
\fB\-sendfreetransactions\fR
.IP
Send transactions as zero\-fee transactions if possible (default: 0)
.HP
\fB\-spendzeroconfchange\fR
.IP
Spend unconfirmed change when sending transactions (default: 1)
.HP
\fB\-txconfirmtarget=\fR<n>
.IP
If paytxfee is not set, include enough fee so transactions begin
confirmation on average within n blocks (default: 2)
.HP
\fB\-txexpirydelta\fR
.IP
Set the number of blocks after which a transaction that has not been
mined will become invalid (default: 200)
.HP
\fB\-maxtxfee=\fR<amt>
.IP
Maximum total fees (in KMD) to use in a single wallet transaction;
setting this too low may abort large transactions (default: 0.10)
.HP
\fB\-upgradewallet\fR
.IP
Upgrade wallet to latest format on startup
.HP
\fB\-wallet=\fR<file>
.IP
Specify wallet file (within data directory) (default: wallet.dat)
.HP
\fB\-walletbroadcast\fR
.IP
Make the wallet broadcast transactions (default: 1)
.HP
\fB\-walletnotify=\fR<cmd>
.IP
Execute command when a wallet transaction changes (%s in cmd is replaced
by TxID)
.HP
\fB\-whitelistaddress=\fR<Raddress>
.IP
Enable the wallet filter for notary nodes and add one Raddress to the
whitelist of the wallet filter. If \fB\-whitelistaddress=\fR is used, then the
wallet filter is automatically activated. Several Raddresses can be
defined using several \fB\-whitelistaddress=\fR (similar to \fB\-addnode\fR). The
wallet filter will filter the utxo to only ones coming from my own
Raddress (derived from pubkey) and each Raddress defined using
\fB\-whitelistaddress=\fR this option is mostly for Notary Nodes).
.HP
\fB\-zapwallettxes=\fR<mode>
.IP
Delete all wallet transactions and only recover those parts of the
blockchain through \fB\-rescan\fR on startup (1 = keep tx meta data e.g.
account owner and payment request information, 2 = drop tx meta data)
.PP
ZeroMQ notification options:
.HP
\fB\-zmqpubhashblock=\fR<address>
.IP
Enable publish hash block in <address>
.HP
\fB\-zmqpubhashtx=\fR<address>
.IP
Enable publish hash transaction in <address>
.HP
\fB\-zmqpubrawblock=\fR<address>
.IP
Enable publish raw block in <address>
.HP
\fB\-zmqpubrawtx=\fR<address>
.IP
Enable publish raw transaction in <address>
.PP
Debugging/Testing options:
.HP
\fB\-debug=\fR<category>
.IP
Output debugging information (default: 0, supplying <category> is
optional). If <category> is not supplied or if <category> = 1, output
all debugging information. <category> can be: addrman, alert, bench,
coindb, db, estimatefee, http, libevent, lock, mempool, net,
partitioncheck, pow, proxy, prune, rand, reindex, rpc, selectcoins, tor,
zmq, zrpc, zrpcunsafe (implies zrpc).
.HP
\fB\-experimentalfeatures\fR
.IP
Enable use of experimental features
.HP
\fB\-help\-debug\fR
.IP
Show all debugging options (usage: \fB\-\-help\fR \fB\-help\-debug\fR)
.HP
\fB\-logips\fR
.IP
Include IP addresses in debug output (default: 0)
.HP
\fB\-logtimestamps\fR
.IP
Prepend debug output with timestamp (default: 1)
.HP
\fB\-minrelaytxfee=\fR<amt>
.IP
Fees (in KMD/kB) smaller than this are considered zero fee for relaying
(default: 0.000001)
.HP
\fB\-printtoconsole\fR
.IP
Send trace/debug info to console instead of debug.log file
.HP
\fB\-shrinkdebugfile\fR
.IP
Shrink debug.log file on client startup (default: 1 when no \fB\-debug\fR)
.HP
\fB\-testnet\fR
.IP
Use the test network
.PP
Node relay options:
.HP
\fB\-datacarrier\fR
.IP
Relay and mine data carrier transactions (default: 1)
.HP
\fB\-datacarriersize\fR
.IP
Maximum size of data in data carrier transactions we relay and mine
(default: 8192)
.PP
Block creation options:
.HP
\fB\-blockminsize=\fR<n>
.IP
Set minimum block size in bytes (default: 0)
.HP
\fB\-blockmaxsize=\fR<n>
.IP
Set maximum block size in bytes (default: 2000000)
.HP
\fB\-blockprioritysize=\fR<n>
.IP
Set maximum size of high\-priority/low\-fee transactions in bytes
(default: 1000000)
.PP
Mining options:
.HP
\fB\-mint\fR
.IP
Mint/stake coins automatically (default: 0)
.HP
\fB\-gen\fR
.IP
Mine/generate coins (default: 0)
.HP
\fB\-genproclimit=\fR<n>
.IP
Set the number of threads for coin mining if enabled (\fB\-1\fR = all cores,
default: 0)
.HP
\fB\-equihashsolver=\fR<name>
.IP
Specify the Equihash solver to be used if enabled (default: "default")
.HP
\fB\-mineraddress=\fR<addr>
.IP
Send mined coins to a specific single address
.HP
\fB\-minetolocalwallet\fR
.IP
Require that mined blocks use a coinbase address in the local wallet
(default: 1)
.PP
RPC server options:
.HP
\fB\-server\fR
.IP
Accept command line and JSON\-RPC commands
.HP
\fB\-rest\fR
.IP
Accept public REST requests (default: 0)
.HP
\fB\-rpcbind=\fR<addr>
.IP
Bind to given address to listen for JSON\-RPC connections. Use
[host]:port notation for IPv6. This option can be specified multiple
times (default: bind to all interfaces)
.HP
\fB\-rpcuser=\fR<user>
.IP
Username for JSON\-RPC connections
.HP
\fB\-rpcpassword=\fR<pw>
.IP
Password for JSON\-RPC connections
.HP
\fB\-rpcport=\fR<port>
.IP
Listen for JSON\-RPC connections on <port> (default: 7771 or testnet:
17771)
.HP
\fB\-rpcallowip=\fR<ip>
.IP
Allow JSON\-RPC connections from specified source. Valid for <ip> are a
single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0)
or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified
multiple times
.HP
\fB\-rpcthreads=\fR<n>
.IP
Set the number of threads to service RPC calls (default: 4)
.PP
Metrics Options (only if \fB\-daemon\fR and \fB\-printtoconsole\fR are not set):
.HP
\fB\-showmetrics\fR
.IP
Show metrics on stdout (default: 1 if running in a console, 0 otherwise)
.HP
\fB\-metricsui\fR
.IP
Set to 1 for a persistent metrics screen, 0 for sequential metrics
output (default: 1 if running in a console, 0 otherwise)
.HP
\fB\-metricsrefreshtime\fR
.IP
Number of seconds between metrics refreshes (default: 1 if running in a
console, 600 otherwise)
.PP
Komodo Asset Chain options:
.HP
\fB\-ac_algo\fR
.IP
Choose PoW mining algorithm, default is Equihash
.HP
\fB\-ac_blocktime\fR
.IP
Block time in seconds, default is 60
.HP
\fB\-ac_cc\fR
.IP
Cryptoconditions, default 0
.HP
\fB\-ac_beam\fR
.IP
BEAM integration
.HP
\fB\-ac_coda\fR
.IP
CODA integration
.HP
\fB\-ac_cclib\fR
.IP
Cryptoconditions dynamicly loadable library
.HP
\fB\-ac_ccenable\fR
.IP
Cryptoconditions to enable
.HP
\fB\-ac_ccactivate\fR
.IP
Block height to enable Cryptoconditions
.HP
\fB\-ac_decay\fR
.IP
Percentage of block reward decrease at each halving
.HP
\fB\-ac_end\fR
.IP
Block height at which block rewards will end
.HP
\fB\-ac_eras\fR
.IP
Block reward eras
.HP
\fB\-ac_founders\fR
.IP
Number of blocks between founders reward payouts
.HP
\fB\-ac_halving\fR
.IP
Number of blocks between each block reward halving
.HP
\fB\-ac_name\fR
.IP
Name of asset chain
.HP
\fB\-ac_notarypay\fR
.IP
Pay notaries, default 0
.HP
\fB\-ac_perc\fR
.IP
Percentage of block rewards paid to the founder
.HP
\fB\-ac_private\fR
.IP
Shielded transactions only (except coinbase + notaries), default is 0
.HP
\fB\-ac_pubkey\fR
.IP
Public key for receiving payments on the network
.HP
\fB\-ac_public\fR
.IP
Transparent transactions only, default 0
.HP
\fB\-ac_reward\fR
.IP
Block reward in satoshis, default is 0
.HP
\fB\-ac_sapling\fR
.IP
Sapling activation block height
.HP
\fB\-ac_script\fR
.IP
P2SH/multisig address to receive founders rewards
.HP
\fB\-ac_staked\fR
.IP
Percentage of blocks that are Proof\-Of\-Stake, default 0
.HP
\fB\-ac_supply\fR
.IP
Starting supply, default is 0
.HP
\fB\-ac_timelockfrom\fR
.IP
Timelocked coinbase start height
.HP
\fB\-ac_timelockgte\fR
.IP
Timelocked coinbase minimum amount to be locked
.HP
\fB\-ac_timelockto\fR
.IP
Timelocked coinbase stop height
.HP
\fB\-ac_txpow\fR
.IP
Enforce transaction\-rate limit, default 0
.SH COPYRIGHT
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.
Copyright (C) 2009-2019 The Bitcoin Core Developers
Copyright (C) 2015-2019 The Zcash Developers
Copyright (C) 2015-2019 jl777 and SuperNET developers
Copyright (C) 2018-2019 The Hush developers
This is experimental software!!!
Distributed under the MIT software license, see the accompanying file COPYING
or <http://www.opensource.org/licenses/mit-license.php>.
This product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software written
by Eric Young.

2
doc/wallet-backup.md

@ -16,7 +16,7 @@ These instructions are specific for the officially supported Hush Linux client.
There are multiple ways to make sure you have at least one other copy of the private keys needed to spend your HUSH and view your shielded HUSH.
For all methods, you will need to include an export directory setting in your config file (`HUSH3.conf` located in the data directory which is `~/.komodo/HUSH3` unless it's been overridden with `datadir=` setting):
For all methods, you will need to include an export directory setting in your config file (`HUSH3.conf` located in the data directory which is `~/.hush/HUSH3` or `~/.komodo/HUSH3` (Legacy Location) unless it's been overridden with `datadir=` setting):
`exportdir=path/to/chosen/export/directory`

2
src/bitcoind.cpp

@ -69,7 +69,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
// Tell the main threads to shutdown.
if ( ASSETCHAINS_CBOPRET != 0 ) {
komodo_pricesinit();
hush_pricesinit();
}
while (!fShutdown)

2
src/cc/CCPrices.h

@ -23,7 +23,7 @@
#include "hush_defs.h"
#include "CCinclude.h"
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
int32_t hush_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
extern void GetHushEarlytxidScriptPub();
extern CScript HUSH_EARLYTXID_SCRIPTPUB;

4
src/cc/CC_made_easy.md

@ -84,7 +84,7 @@ However, this is the CC contract basics chapter, so let us ignore mempool issues
That means to just follow a known working template and only changing the things where the existing templates are not sufficient, ie. the core differentiator of your CC contract.
In the ~/komodo/src/cc/eval.h file all the eval codes are defined, currently:
In the hush3/src/cc/eval.h file all the eval codes are defined, currently:
#define FOREACH_EVAL(EVAL) \
EVAL(EVAL_IMPORTPAYOUT, 0xe1) \
@ -201,7 +201,7 @@ You do need to be careful not to cause a deadlock as the CC validation code is c
Chapter 6 - faucet example
Finally, we are ready for the first actual example of a CC contract. The faucet. This is a very simple contract and it ran into some interesting bugs in the first incarnation.
The code in ~/komodo/src/cc/faucet.cpp is the ultimate documentation for it with all the details, so I will just address the conceptual issues here.
The code in hush3/src/cc/faucet.cpp is the ultimate documentation for it with all the details, so I will just address the conceptual issues here.
The idea is that people send funds to the faucet by locking it in faucet's global CC address and anybody is allowed to create a faucetget transaction that spends it.

2
src/cc/cclib.cpp

@ -47,7 +47,7 @@ std::string MYCCLIBNAME = (char *)"sudoku";
#endif
#ifndef BUILD_GAMESCC
void komodo_netevent(std::vector<uint8_t> payload) {}
void hush_netevent(std::vector<uint8_t> payload) {}
#endif
extern std::string MYCCLIBNAME;

6
src/cc/dapps/dappstd.c

@ -246,9 +246,9 @@ int32_t safecopy(char *dest,char *src,long len)
#define true 1
#define false 0
//#ifdef STANDALONE
//#include "../komodo/src/komodo_cJSON.c"
//#include "../hush3/src/hush_cJSON.c"
//#else
#include "../komodo_cJSON.c"
#include "../hush_cJSON.c"
//#endif
int32_t games_replay(uint64_t seed,int32_t sleeptime);
@ -1105,7 +1105,7 @@ int main(int argc, char **argv)
fclose(fp);
if ( GAMES_PORT == 0 )
{
printf("you must copy %s.conf from ~/.komodo/%s/%s.conf (or equivalent location) to current dir\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_SYMBOL,ASSETCHAINS_SYMBOL);
printf("you must copy %s.conf from ~/.hush/%s/%s.conf (or equivalent location) to current dir\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_SYMBOL,ASSETCHAINS_SYMBOL);
return(-1);
}
return(GAMEMAIN(argc,argv));

6
src/cc/gamescc.cpp

@ -479,7 +479,7 @@ int32_t games_event(uint32_t timestamp,uint256 gametxid,int32_t eventid,std::vec
{
GetOpReturnData(games_eventopret(timestamp,mypk,sig,payload),vopret);
games_payloadrecv(mypk,timestamp,payload);
komodo_sendmessage(4,8,"events",vopret);
hush_sendmessage(4,8,"events",vopret);
return(0);
}
fprintf(stderr,"games_eventsign error\n");
@ -539,7 +539,7 @@ UniValue games_events(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
return(result);
}
void komodo_netevent(std::vector<uint8_t> message)
void hush_netevent(std::vector<uint8_t> message)
{
int32_t i,retval,lag,lagerr=0; uint32_t timestamp,now; CPubKey pk; std::vector<uint8_t> sig,payload; char str[67];
if ( games_eventdecode(timestamp,pk,sig,payload,message) == 'E' )
@ -560,7 +560,7 @@ void komodo_netevent(std::vector<uint8_t> message)
if ( (rand() % 10) == 0 )
{
//fprintf(stderr,"relay message.[%d]\n",(int32_t)message.size());
komodo_sendmessage(2,2,"events",message);
hush_sendmessage(2,2,"events",message);
}
}
}

86
src/chainparams.cpp

@ -882,10 +882,88 @@ void *chainparams_commandline() {
(584000, uint256S("0x0000000720f29b0d72469739e9d94607e67b48eb9957b45c2fd5a34b86df039a"))
(585000, uint256S("0x00000001409c395b2e37e2b88110b320996996241bfb489103db9e17aaf2ddc7"))
(586000, uint256S("0x00000006ff6509d260f66af2fc4fc1769d56394333f3ad5a19bbd10c8c26742b"))
(587000, uint256S("0x00000003866d330ac5448e07eb5e95d2e1860203f2e0ca568161d04ea5c5deb8")),
(int64_t) 1625849524, // time of last checkpointed block
(int64_t) 0, // total txs
(double) 2304 // txs in the last day before block 587157
(587000, uint256S("0x00000003866d330ac5448e07eb5e95d2e1860203f2e0ca568161d04ea5c5deb8"))
(588000, uint256S("0x0000000247f3b1c8f60b82a1dc5b86ead3adb023a6e3508d1c732c88bceae666"))
(589000, uint256S("0x00000000d9108a0e811622919777fb929986966034bb53678d431dd50f0b3640"))
(590000, uint256S("0x00000006a7699d8fb948cc67dd2427ee25fbfa2a8e02517aad45880658eab983"))
(591000, uint256S("0x00000004f6746a57c60ab45b5d0a30375e635bb8b564c85b92e8b34afbb82077"))
(592000, uint256S("0x000000023987ca4c3454b0fd17fe64febcc2c1b75d2820e0368084c59d71cbb3"))
(593000, uint256S("0x00000006e05b247fa1a4b99e5292d4c696e2627ed5b64263ceb2a985d98cb446"))
(594000, uint256S("0x000000010f20489639e7ec3a3694b2c1def345f2bf7804fadbd1ee92813a020d"))
(595000, uint256S("0x00000008fda549361df97ddac7f495fdb629c4c6a646c91e5535f96d12d98dee"))
(596000, uint256S("0x0000000512d08ea2cd501bb2132dec8dd997e0332e5d0a51bf9d0992451030da"))
(597000, uint256S("0x00000006384749ab79ee12dd46e068634254354c511f535278d54b8efd41e29e"))
(598000, uint256S("0x000000031ba9be6704d352002cfb763dc7123e93911796159ef8d2d0328da348"))
(599000, uint256S("0x00000005bf47be7b949ff5217ae980fcea48d9d25e824c68367ce934447ef0bd"))
(600000, uint256S("0x00000000a721ce253a2c130fec44c581810dfb9448a46ef524a16f1ef3920bec"))
(601000, uint256S("0x00000007cdbdfd7f1c9bf8c20ff4f35c2c25a21558a5e70ea139bd50d2421fab"))
(602000, uint256S("0x0000000708ba8ec93c022184d3258cd4956f82e2edd0b67c2493f74a3bf6afef"))
(603000, uint256S("0x00000005a7b51fd94b80f51ae2b0d0dc8f7285eb418914bd177f6f2fcc68e745"))
(604000, uint256S("0x00000010bd1bce0ed2c83f8860b5201a700c535dfc6d6af2c15ee7de4e2e0cba"))
(605000, uint256S("0x00000002cac498bb995a395d52a41a48372e57b494de023cd4e2eb70c5616b1b"))
(606000, uint256S("0x0000000269e7256e93648c29f72e169767af626c7db95fa8ac853be6072a7942"))
(607000, uint256S("0x000000073e07d2a4757b93641c318dbdc784067b02d4cc9f0be4747c80319f3b"))
(608000, uint256S("0x00000001613776b53c2060529996e64d24fa5874879b7457aee20430ab2bc87f"))
(609000, uint256S("0x0000000acd03e99bfe60d8a5d5023b373aa13f71a5d577c813141b3b714cc95a"))
(610000, uint256S("0x0000000aa64b831908eb621b6e2c548620d29146b0c8dae951dd84daef0e63d1"))
(611000, uint256S("0x0000000736b273fdf7d8df9bddba568e71547a79e0b14c71027e61dae6a83443"))
(612000, uint256S("0x00000012a5b000bcb8606acb628c46d49157bc97189fc8e37dfaaf280b05f8a1"))
(613000, uint256S("0x00000006bb698faba83d28b958cd9a242fa9baadb2efa510e2e27b1eebedb951"))
(614000, uint256S("0x000000007c66271651afb1468d0546f3ea1b9720d42e3597c9277429d43765f1"))
(615000, uint256S("0x00000015a141ae1feec020f529a3e5dea51d29efdef8d0425677e5126c850f73"))
(616000, uint256S("0x0000000967c92b77c884fc58d7973a8d78ea47c2ec8e68e1619f6b92f3db2c05"))
(617000, uint256S("0x0000000a7eb3e594474d545752f35a70965c17e497c2201fa8f38943bebb8756"))
(618000, uint256S("0x0000000ca0f1eb16ed72e5ea4e77cb165fb87384e4c3e0064d5faac7f49c91b9"))
(619000, uint256S("0x00000006da3e4a2e36342593090efb0fdf19e77d4ce8663a54df0dd7109b178b"))
(620000, uint256S("0x0000000d7c987adbdbf3742c6cebd55b7c8fe213362385f1e24e6eecf7dd4ea0"))
(621000, uint256S("0x00000003009cf1ac25864d6997dd9c9ce76cf6cb58f0e61700bb52ec72f54cc6"))
(622000, uint256S("0x0000000cf25b9a537ea61d548979003dde28155b73b26d53cf2a7b69036926cb"))
(623000, uint256S("0x00000007da399943d00f84c9e190e9968f3f456de70060ad17b6b63606287db0"))
(624000, uint256S("0x0000000cab9f7f9e6e5223eda1bee8de7384b6dbed3bfe807818871d78f9594f"))
(625000, uint256S("0x0000000266b471c7ee107a85080792531d7dc91c23d7b42b46e44728c3d9ea8c"))
(626000, uint256S("0x00000003fe1af9fffd32fae9b809c916d7484024021053c09286c763fd2fc1e6"))
(627000, uint256S("0x00000006f9bbef0362e0e99bb4061b4d386c82477d64d84850e4a1b6fce85093"))
(628000, uint256S("0x0000000d9afb9e78eac960bc5b7aaa8356ac6660e5147175117ed53f6d41215e"))
(629000, uint256S("0x000000071ee3b95304b4df78e66c56f8f1deb557b57ed7716c389b0e04344d87"))
(630000, uint256S("0x00000002ed362482e0bc5d03d07e406748590d01871f91e03ed86d15737d1e2f"))
(631000, uint256S("0x0000000e55845a96afa1359c6aaac5e66c84daf56ccea33d9127a66e6162736d"))
(632000, uint256S("0x0000000fb180307499ce6d21f2308ffdf20b0d03ed45ba0de3420fac71434b95"))
(633000, uint256S("0x00000010ddf5569109d8a405eedac88f2ae9f56838dcf279cd9ca32185cf5d55"))
(634000, uint256S("0x0000000781805d9c573380c22215cf83280c4d0688bbd730adb0821c89b2a3d0"))
(635000, uint256S("0x0000000fa1d7aba218223517de8ceeecfcda087b7e549b0537a986465520e040"))
(636000, uint256S("0x00000010eb125169e1e9cbe061564c9c663389b6a68a06445d18c4346601ce78"))
(637000, uint256S("0x0000000c85df82c1ade3c311e5673c294d97858ea23dac5d5f03aaf32b374b1b"))
(638000, uint256S("0x00000002aa16a3abc3ae9739609eddaf805fce5d0f7b0ae8d9494381843ab5a2"))
(639000, uint256S("0x00000012eb63468724acc222e45889a9bf54c1a5e0152ad1fc9c57cdb7bcb460"))
(640000, uint256S("0x0000000bf6a31eec79a36c5423f52069e5d6858bfc566081556ba9487a5ef36f"))
(641000, uint256S("0x000000065414f1d2a543687ee4c0137ca5d66d5d35f9dbf9b4fe73e59ecc5af7"))
(642000, uint256S("0x00000005fe35f60661760b7ca027a73e6915f6add12e736018357a1e782310a4"))
(643000, uint256S("0x000000076e77c3e0a2a1890a5bea2d92aa720a08bb4e5571e76bb05c93f40c98"))
(644000, uint256S("0x0000001054093374a3a414047113ab882d092f012c1c17cf3d98ca8006b8e8bc"))
(645000, uint256S("0x0000000cb0c07c2325e8162e58f3fcc14323450274a1d69aff06ac799cf72f53"))
(646000, uint256S("0x0000000252d31029d2e96406697ada40ca3afb3d9fe2a2f67cdad2462e8fe00d"))
(647000, uint256S("0x0000001155755f0718b6cc3474e44748358e5328c2c0c32c97cfd3842bf22510"))
(648000, uint256S("0x000000173c2e63d658263c1c28e1e0a1b2ce30f2d3d4eba2f540836315a9d5ea"))
(649000, uint256S("0x00000002044331ebe095ea838da367fed1495be4ad69b0c655df653ccb1923dd"))
(650000, uint256S("0x00000010afad2d800c397557a9cbe501f32cd09f18f89c2f3f11e0e38ae45843"))
(651000, uint256S("0x0000000b6a9630f3a2334d4529ba013480104e54fc59dc4cabc3a8869ad17a01"))
(652000, uint256S("0x00000004d22aa00fb4c8266b0304f43bc7bec8e18850e764a431438a9fdfd141"))
(653000, uint256S("0x0000000a248721cef01783838a5b53547b12273ddf57a2bc3ba708ea987f8937"))
(654000, uint256S("0x00000004c95adc9e17e429c35cc4c8ffd130e23228245e29f150896ab66ffdfd"))
(655000, uint256S("0x0000001428523dbe3cf9338753a42c579a669df7bbd8d6fa667f4daf2c4c749f"))
(656000, uint256S("0x0000001704429a9b902d4cddee708bd0ae7b758c6bd9ed634c143931e15ac337"))
(657000, uint256S("0x00000007b376e2c197b21a2eacac81847f401f92ed50213e845e039d3516458c"))
(658000, uint256S("0x00000026e751010b1135052b105f2be464702b040d76610bfeae1b1a2bcab15c"))
(659000, uint256S("0x00000005d784a9cf7b60bc6908234052c29a555dcf1d4f8a82663aabbc2e0c83"))
(660000, uint256S("0x00000015cdf576c284ad93912955194f6764a16d562308bb82bcfdc7a27ad20b"))
(661000, uint256S("0x0000000af126a5261626bc10a6cf2a8a07ea145f6aa33539e4d434033411c4db"))
(662000, uint256S("0x00000011c4659f0bbe3559c32ff24588d78a3822e8b0e31bb9298a16213fe154"))
(663000, uint256S("0x000000076756708535e3daeaca6bc32aa1dc360228af6a0c5e5e07b5d9f5f00b"))
(664000, uint256S("0x000000181806c17b47bb843537cc91c95ca1e3596bb9e049d18c2e73c1026258"))
(665000, uint256S("0x0000001e966c9edae76c40262e65a6c9ab764a09154eb802fb892ceebc2d1935")),
(int64_t) 1631750258, // time of last checkpointed block
(int64_t) 1064407, // total txs
(double) 1402 // txs in the last day before block 665685
};
} else {
checkpointData = //(Checkpoints::CCheckpointData)

2
src/clientversion.cpp

@ -32,7 +32,7 @@
* for both bitcoind and bitcoin-core, to make it harder for attackers to
* target servers or GUI users specifically.
*/
const std::string CLIENT_NAME = GetArg("-clientname", "jl777sRemorse");
const std::string CLIENT_NAME = GetArg("-clientname", "GoldenSandtrout");
/**
* Client version number

2
src/clientversion.h

@ -29,7 +29,7 @@
//! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it
// Must be kept in sync with configure.ac , ugh!
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_MINOR 9
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 50

18
src/hush.h

@ -146,7 +146,7 @@ int32_t hush_parsestatefile(struct hush_state *sp,FILE *fp,char *symbol,char *de
errs++;
//if ( matched != 0 ) global independent states -> inside *sp
//printf("%s.%d load[%s] ht.%d\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight);
hush_eventadd_kmdheight(sp,symbol,ht,kheight,0);
hush_eventadd_hushheight(sp,symbol,ht,kheight,0);
}
else if ( func == 'T' )
{
@ -157,7 +157,7 @@ int32_t hush_parsestatefile(struct hush_state *sp,FILE *fp,char *symbol,char *de
errs++;
//if ( matched != 0 ) global independent states -> inside *sp
//printf("%s.%d load[%s] ht.%d t.%u\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight,ktimestamp);
hush_eventadd_kmdheight(sp,symbol,ht,kheight,ktimestamp);
hush_eventadd_hushheight(sp,symbol,ht,kheight,ktimestamp);
}
else if ( func == 'R' )
{
@ -285,7 +285,7 @@ int32_t hush_parsestatefiledata(struct hush_state *sp,uint8_t *filedata,long *fp
int32_t kheight;
if ( memread(&kheight,sizeof(kheight),filedata,&fpos,datalen) != sizeof(kheight) )
errs++;
hush_eventadd_kmdheight(sp,symbol,ht,kheight,0);
hush_eventadd_hushheight(sp,symbol,ht,kheight,0);
}
else if ( func == 'T' )
{
@ -296,7 +296,7 @@ int32_t hush_parsestatefiledata(struct hush_state *sp,uint8_t *filedata,long *fp
errs++;
//if ( matched != 0 ) global independent states -> inside *sp
//printf("%s.%d load[%s] ht.%d t.%u\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight,ktimestamp);
hush_eventadd_kmdheight(sp,symbol,ht,kheight,ktimestamp);
hush_eventadd_hushheight(sp,symbol,ht,kheight,ktimestamp);
}
else if ( func == 'R' )
{
@ -409,7 +409,7 @@ void hush_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotarie
if ( fwrite(&HUSHheight,1,sizeof(HUSHheight),fp) != sizeof(HUSHheight) )
errs++;
}
hush_eventadd_kmdheight(sp,symbol,height,HUSHheight,HUSHtimestamp);
hush_eventadd_hushheight(sp,symbol,height,HUSHheight,HUSHtimestamp);
} else if ( opretbuf != 0 && opretlen > 0 ) {
uint16_t olen = opretlen;
fputc('R',fp);
@ -653,8 +653,8 @@ int32_t hush_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notaryi
// MoMoM, depth, numpairs, (notarization ht, MoMoM offset)
if ( len+48-opoffset <= opretlen && strcmp(ccdata.symbol,SMART_CHAIN_SYMBOL) == 0 )
{
len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.kmdstarti);
len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.kmdendi);
len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.hushstarti);
len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.hushendi);
len += dragon_rwbignum(0,&scriptbuf[len],sizeof(MoMoMdata.MoMoM),(uint8_t *)&MoMoMdata.MoMoM);
len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.MoMoMdepth);
len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.numpairs);
@ -711,7 +711,7 @@ int32_t hush_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notaryi
else if ( matched != 0 && i == 0 && j == 1 && opretlen == 149 )
{
if ( notaryid >= 0 && notaryid < 64 )
komodo_paxpricefeed(height,&scriptbuf[len],opretlen);
hush_paxpricefeed(height,&scriptbuf[len],opretlen);
}
else if ( matched != 0 )
{
@ -792,7 +792,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
if ( pindex->GetHeight() != hwmheight )
{
printf("%s hwmheight.%d vs pindex->GetHeight().%d t.%u reorg.%d\n",SMART_CHAIN_SYMBOL,hwmheight,pindex->GetHeight(),(uint32_t)pindex->nTime,hwmheight-pindex->GetHeight());
komodo_purge_ccdata((int32_t)pindex->GetHeight());
hush_purge_ccdata((int32_t)pindex->GetHeight());
hwmheight = pindex->GetHeight();
}
if (!fJustCheck)

24
src/hush_bitcoind.h

@ -868,18 +868,18 @@ int32_t hush_minerids(uint8_t *minerids,int32_t height,int32_t width)
return(nonz);
}
int32_t hush_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip)
int32_t hush_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *hushstartip,int32_t *hushendip)
{
int32_t depth,notarized_ht; uint256 MoM,kmdtxid;
depth = hush_MoMdata(&notarized_ht,&MoM,&kmdtxid,nHeight,MoMoMp,MoMoMoffsetp,MoMoMdepthp,kmdstartip,kmdendip);
int32_t depth,notarized_ht; uint256 MoM,hushtxid;
depth = hush_MoMdata(&notarized_ht,&MoM,&hushtxid,nHeight,MoMoMp,MoMoMoffsetp,MoMoMdepthp,hushstartip,hushendip);
memset(MoMp,0,sizeof(*MoMp));
memset(kmdtxidp,0,sizeof(*kmdtxidp));
memset(hushtxidp,0,sizeof(*hushtxidp));
*notarized_heightp = 0;
if ( depth != 0 && notarized_ht > 0 && nHeight > notarized_ht-depth && nHeight <= notarized_ht )
{
*MoMp = MoM;
*notarized_heightp = notarized_ht;
*kmdtxidp = kmdtxid;
*hushtxidp = hushtxid;
}
return(depth);
}
@ -950,12 +950,12 @@ int32_t hush_nextheight()
else return(hush_longestchain() + 1);
}
int32_t hush_isrealtime(int32_t *kmdheightp)
int32_t hush_isrealtime(int32_t *hushheightp)
{
struct hush_state *sp; CBlockIndex *pindex;
if ( (sp= hush_stateptrget((char *)"HUSH3")) != 0 )
*kmdheightp = sp->CURRENT_HEIGHT;
else *kmdheightp = 0;
*hushheightp = sp->CURRENT_HEIGHT;
else *hushheightp = 0;
if ( (pindex= chainActive.LastTip()) != 0 && pindex->GetHeight() >= (int32_t)hush_longestchain() )
return(1);
else return(0);
@ -1212,7 +1212,7 @@ void hush_segids(uint8_t *hashbuf,int32_t height,int32_t n)
}
}
arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime)
arith_uint256 hush_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime)
{
arith_uint256 origtarget,easy; int32_t diff,tipdiff; int64_t mult; bool fNegative,fOverflow; CBlockIndex *tipindex;
if ( height > 10 && (tipindex= hush_chainactive(height - 1)) != 0 ) // disable offchain diffchange
@ -1238,7 +1238,7 @@ arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,ui
return(bnTarget);
}
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc)
arith_uint256 hush_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc)
{
int32_t oldflag = 0,dispflag = 0;
CBlockIndex *pindex; arith_uint256 easydiff,bnTarget,hashval,sum,ave; bool fNegative,fOverflow; int32_t i,n,m,ht,percPoS,diff,val;
@ -1543,7 +1543,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height)
return(0);
}
bool komodo_appendACscriptpub()
bool hush_appendACscriptpub()
{
static bool didinit = false;
if ( didinit )
@ -1638,7 +1638,7 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height)
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
{
static bool didinit = false;
if ( !didinit && height > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && komodo_appendACscriptpub() )
if ( !didinit && height > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() )
{
fprintf(stderr, "appended CC_op_return to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str());
didinit = true;

4
src/hush_cJSON.h

@ -36,8 +36,8 @@
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
#ifndef komodo_cJSON__h
#define komodo_cJSON__h
#ifndef hush_cJSON__h
#define hush_cJSON__h
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

46
src/hush_ccdata.h

@ -41,7 +41,7 @@ uint256 hush_calcMoM(int32_t height,int32_t MoMdepth)
return BuildMerkleTree(&fMutated, leaves, tree);
}
struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi)
struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t hushstarti,int32_t hushendi)
{
struct hush_ccdata_entry *allMoMs=0; struct hush_ccdata *ccdata,*tmpptr; int32_t i,num,max;
bool fMutated; std::vector<uint256> tree, leaves;
@ -49,7 +49,7 @@ struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t k
portable_mutex_lock(&HUSH_CC_mutex);
DL_FOREACH_SAFE(CC_data,ccdata,tmpptr)
{
if ( ccdata->MoMdata.height <= kmdendi && ccdata->MoMdata.height >= kmdstarti )
if ( ccdata->MoMdata.height <= hushendi && ccdata->MoMdata.height >= hushstarti )
{
if ( num >= max )
{
@ -58,12 +58,12 @@ struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t k
}
allMoMs[num].MoM = ccdata->MoMdata.MoM;
allMoMs[num].notarized_height = ccdata->MoMdata.notarized_height;
allMoMs[num].kmdheight = ccdata->MoMdata.height;
allMoMs[num].hushheight = ccdata->MoMdata.height;
allMoMs[num].txi = ccdata->MoMdata.txi;
strcpy(allMoMs[num].symbol,ccdata->symbol);
num++;
}
if ( ccdata->MoMdata.height < kmdstarti )
if ( ccdata->MoMdata.height < hushstarti )
break;
}
portable_mutex_unlock(&HUSH_CC_mutex);
@ -81,7 +81,7 @@ struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t k
return(allMoMs);
}
int32_t komodo_addpair(struct hush_ccdataMoMoM *mdata,int32_t notarized_height,int32_t offset,int32_t maxpairs)
int32_t hush_addpair(struct hush_ccdataMoMoM *mdata,int32_t notarized_height,int32_t offset,int32_t maxpairs)
{
if ( maxpairs >= 0) {
if ( mdata->numpairs >= maxpairs )
@ -91,7 +91,7 @@ int32_t komodo_addpair(struct hush_ccdataMoMoM *mdata,int32_t notarized_height,i
//fprintf(stderr,"pairs reallocated to %p num.%d\n",mdata->pairs,mdata->numpairs);
}
} else {
fprintf(stderr,"komodo_addpair.maxpairs %d must be >= 0\n",(int32_t)maxpairs);
fprintf(stderr,"hush_addpair.maxpairs %d must be >= 0\n",(int32_t)maxpairs);
return(-1);
}
mdata->pairs[mdata->numpairs].notarized_height = notarized_height;
@ -100,7 +100,7 @@ int32_t komodo_addpair(struct hush_ccdataMoMoM *mdata,int32_t notarized_height,i
return(maxpairs);
}
int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height)
int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t hushheight,int32_t notarized_height)
{
uint8_t hexdata[8192]; struct hush_ccdata *ccdata,*tmpptr; int32_t len,maxpairs,i,retval=-1,depth,starti,endi,CCid=0; struct hush_ccdata_entry *allMoMs;
starti = endi = depth = len = maxpairs = 0;
@ -114,9 +114,9 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda
portable_mutex_lock(&HUSH_CC_mutex);
DL_FOREACH_SAFE(CC_data,ccdata,tmpptr)
{
if ( ccdata->MoMdata.height < kmdheight )
if ( ccdata->MoMdata.height < hushheight )
{
//fprintf(stderr,"%s notarized.%d kmd.%d\n",ccdata->symbol,ccdata->MoMdata.notarized_height,ccdata->MoMdata.height);
//fprintf(stderr,"%s notarized.%d HUSH3.%d\n",ccdata->symbol,ccdata->MoMdata.notarized_height,ccdata->MoMdata.height);
if ( strcmp(ccdata->symbol,symbol) == 0 )
{
if ( endi == 0 )
@ -136,23 +136,23 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda
}
}
portable_mutex_unlock(&HUSH_CC_mutex);
mdata->kmdstarti = starti;
mdata->kmdendi = endi;
mdata->hushstarti = starti;
mdata->hushendi = endi;
if ( starti != 0 && endi != 0 && endi >= starti )
{
if ( (allMoMs= komodo_allMoMs(&depth,&mdata->MoMoM,starti,endi)) != 0 )
if ( (allMoMs= hush_allMoMs(&depth,&mdata->MoMoM,starti,endi)) != 0 )
{
mdata->MoMoMdepth = depth;
for (i=0; i<depth; i++)
{
if ( strcmp(symbol,allMoMs[i].symbol) == 0 )
maxpairs = komodo_addpair(mdata,allMoMs[i].notarized_height,i,maxpairs);
maxpairs = hush_addpair(mdata,allMoMs[i].notarized_height,i,maxpairs);
}
if ( mdata->numpairs > 0 )
{
len += dragon_rwnum(1,&hexdata[len],sizeof(CCid),(uint8_t *)&CCid);
len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->kmdstarti);
len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->kmdendi);
len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->hushstarti);
len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->hushendi);
len += dragon_rwbignum(1,&hexdata[len],sizeof(mdata->MoMoM),(uint8_t *)&mdata->MoMoM);
len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->MoMoMdepth);
len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->numpairs);
@ -160,7 +160,7 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda
{
if ( len + sizeof(uint32_t)*2 > sizeof(hexdata) )
{
fprintf(stderr,"%s %d %d i.%d of %d exceeds hexdata.%d\n",symbol,kmdheight,notarized_height,i,mdata->numpairs,(int32_t)sizeof(hexdata));
fprintf(stderr,"%s %d %d i.%d of %d exceeds hexdata.%d\n",symbol,hushheight,notarized_height,i,mdata->numpairs,(int32_t)sizeof(hexdata));
break;
}
len += dragon_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->pairs[i].notarized_height);
@ -171,7 +171,7 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda
init_hexbytes_noT(hexstr,hexdata,len);
//fprintf(stderr,"hexstr.(%s)\n",hexstr);
retval = 0;
} else fprintf(stderr,"%s %d %d too much hexdata[%d] for hexstr[%d]\n",symbol,kmdheight,notarized_height,len,hexsize);
} else fprintf(stderr,"%s %d %d too much hexdata[%d] for hexstr[%d]\n",symbol,hushheight,notarized_height,len,hexsize);
}
free(allMoMs);
}
@ -179,7 +179,7 @@ int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mda
return(retval);
}
void komodo_purge_ccdata(int32_t height)
void hush_purge_ccdata(int32_t height)
{
struct hush_ccdata *ccdata,*tmpptr;
if ( SMART_CHAIN_SYMBOL[0] == 0 )
@ -247,7 +247,7 @@ int32_t hush_rwccdata(char *thischain,int32_t rwflag,struct hush_ccdata *ccdata,
{
for (i=0; i<MoMoMdata->numpairs; i++)
{
if ( (np= komodo_npptr(MoMoMdata->pairs[i].notarized_height)) != 0 )
if ( (np= hush_npptr(MoMoMdata->pairs[i].notarized_height)) != 0 )
{
memset(&zero,0,sizeof(zero));
if ( memcmp(&np->MoMoM,&zero,sizeof(np->MoMoM)) == 0 )
@ -255,12 +255,12 @@ int32_t hush_rwccdata(char *thischain,int32_t rwflag,struct hush_ccdata *ccdata,
np->MoMoM = MoMoMdata->MoMoM;
np->MoMoMdepth = MoMoMdata->MoMoMdepth;
np->MoMoMoffset = MoMoMdata->MoMoMoffset;
np->kmdstarti = MoMoMdata->kmdstarti;
np->kmdendi = MoMoMdata->kmdendi;
np->hushstarti = MoMoMdata->hushstarti;
np->hushendi = MoMoMdata->hushendi;
}
else if ( memcmp(&np->MoMoM,&MoMoMdata->MoMoM,sizeof(np->MoMoM)) != 0 || np->MoMoMdepth != MoMoMdata->MoMoMdepth || np->MoMoMoffset != MoMoMdata->MoMoMoffset || np->kmdstarti != MoMoMdata->kmdstarti || np->kmdendi != MoMoMdata->kmdendi )
else if ( memcmp(&np->MoMoM,&MoMoMdata->MoMoM,sizeof(np->MoMoM)) != 0 || np->MoMoMdepth != MoMoMdata->MoMoMdepth || np->MoMoMoffset != MoMoMdata->MoMoMoffset || np->hushstarti != MoMoMdata->hushstarti || np->hushendi != MoMoMdata->hushendi )
{
fprintf(stderr,"preexisting MoMoM mismatch: %s (%d %d %d %d) vs %s (%d %d %d %d)\n",np->MoMoM.ToString().c_str(),np->MoMoMdepth,np->MoMoMoffset,np->kmdstarti,np->kmdendi,MoMoMdata->MoMoM.ToString().c_str(),MoMoMdata->MoMoMdepth,MoMoMdata->MoMoMoffset,MoMoMdata->kmdstarti,MoMoMdata->kmdendi);
fprintf(stderr,"preexisting MoMoM mismatch: %s (%d %d %d %d) vs %s (%d %d %d %d)\n",np->MoMoM.ToString().c_str(),np->MoMoMdepth,np->MoMoMoffset,np->hushstarti,np->hushendi,MoMoMdata->MoMoM.ToString().c_str(),MoMoMdata->MoMoMdepth,MoMoMdata->MoMoMoffset,MoMoMdata->hushstarti,MoMoMdata->hushendi);
}
}
}

99
src/hush_defs.h

@ -53,13 +53,15 @@ const uint32_t nHushHardforkHeight = 166250;
const uint32_t nHushHardforkHeight2 = 245055;
// This height begins Hush DPoW from Hush notaries
const uint32_t nHushHardforkHeight3 = 340420;
// No coins/code are currently using timestamp activated fork
const uint32_t nHushHardforkHeight3 = 340420;
const uint32_t nHushHardforkTimestamp = 1580303652; // Jan 29nd 1pm GMT
const uint32_t nHushHardforkTimestamp2 = 1594425600; // Jul 11th 12a GMT
// Used by HSCs
static const uint32_t HUSH_SEASON_TIMESTAMPS[NUM_HUSH_SEASONS] = {1525132800, 1563148800, nHushHardforkTimestamp, nHushHardforkTimestamp2, nHushHardforkTimestamp2*5, nHushHardforkTimestamp2*6, nHushHardforkTimestamp2*7};
// Used by HUSH3+TUSH
// Block 1702100 = nHushHardforkHeight3*5
static const int32_t HUSH_SEASON_HEIGHTS[NUM_HUSH_SEASONS] = {1,2,nHushHardforkHeight, nHushHardforkHeight2, (int)340000, nHushHardforkHeight3, nHushHardforkHeight3*5};
// Era array of pubkeys. Add extra seasons to bottom as requried, after adding appropriate info above.
@ -472,6 +474,73 @@ static const char *notaries_elected[NUM_HUSH_SEASONS][NUM_HUSH_NOTARIES][2] =
{"RAJWHL6MzGFKg7KB2sZ87KPQUSvxy3VrEW", "0389971362b002ab5dfa1b5f9c4f88e68249511a3935242ba1e0d31c1c88a36d70"},
{"RU592tQnbH8gt6xd5Uu23nEw3SucDNkXmK", "02b8b6a2266fe57b25f2d4b1da93a07d27930154e78f9d137bc7509cf1ae8e3d49"},
{"RLGCLRzaEmruPC9UmVt5qRHEhXwHip1e6d", "02a2fd96b4459411ad2b09597ba59cf52b282c56330da7c0cc6d2a5c0323a18f1e"}
},
{
// season 7
{"RFetqf8WUfWnwNeXdknkm8ojk7EXnYFzrv", "038a1bd41a08f38edda51042988022933c5775dfce81f7bae0b32a9179650352ac"},
{"RV7YSVW89WC9jBDtFG4ubtopDRove4Tfvc", "03c9d35488be73fe4f2dbb1dc011468482d71bac32249f8cce6480bcc574415d19"},
{"RBPFE9oXceZBWTn3Vhne4FUKE9vxGEXUKX", "028a8bb6ded2692b39a69ec2d3c9836ff221815909d5cd65257374aeb66394a002"},
{"RM3cvUcafPhjyypZLEginQjdhjLnSgJHte", "03a36180014115b47b97c1c8776a269bba66047b1ce2c7eb1a3d4e995a6dfff0df"},
{"RFFX1VaTmZYPBLCzFj7w3iJQArV9ZdaWcW", "02190865f3ca3678d322c96e49a3ddf8ad394a4c8cd97d4bb3376cf547d0d83c66"},
{"RDwZsLpH1QiAbJwUEY8ajXwTzu3PaWhx7n", "023ea0babb34e1ff9f4db8131ee84ad8991b954038a1e6ef9afc2a1b3fa13bbcb9"},
{"RCUvfnmt16ZMvLTmLGGAztcAE8fBjfbP6u", "0379a5ba9fb6b463ffcdc0b1f3ecf45a5b737275354f9c2598492f20660f6f7dfd"},
{"RBLu9adNVMVf6jzLLbAenWovcwq8nU6gYd", "022cd69381231d69d6d3b9638762df849bc7bbab71cbb8383eec29ca677f1afa30"},
{"RWfv6wd2fwgecnJxC1Ykpf1SJefGh2Wc6i", "03da8a8f57d88afb61f712a8cd35462b65ce2b2575db8f9ee33a725dcd12c44755"},
{"RWiK4xooG3dPdvaovu6JvR3DWoYD4tfRjx", "02ffe66af4d71345fe6984b5002ad69206e1817566a70d9ac406a679be6a3335a0"},
{"RYLNiJiRnEGeMxx1Q2xLoFujshRNkBa2x4", "028ef6501004569c1170ce2d7ec7ecfe5739001130ad1b39129f8b88cd3d610257"},
{"RTw36Ksy5Wk1Xv3B53T79zoRd6XDsE9MS6", "02d7cf4ece00895ca857fcdd0a4c2fc9c949a518d2750396f77d9f031c08a94364"},
{"RTPkUBriQzZy67WmFhEs6aQzJn5HBB3ntb", "03319ca1eae5888c45115d160ac07c4f2abd1720926aa579d535c4b46c807bb7f7"},
{"RBmZzttvDnMaEv47cWXs8SgdC993djB68r", "034302c4e1ff72a5f5391f259f7a46e646c7845aa2c9de9fb0c0a4c4802aad79d6"},
{"RGocb2jLCa2E9kVHDUsijrVGTDP82ngGYZ", "024440a18a16e38b836b3ad9bb54ab0b5ba83b04edebb58c62c09b2de29e9fc703"},
{"RVqwCjPQ6AJ6r9WeGzQvAT4eGXDScprLkW", "028a94e53ad8ed9e78f0f8a87cf3bc4754784222ad7ddf2d3dc5fafec2f6891cde"},
{"RB2Xc8eLrATRWVsxrZKHHx3hyJz1vugMt9", "02eca07a9b5810fe929a87f90e5f02e29a06479d39cd3a888abfa1793e1565155a"},
{"RKm7WUuFfqCTiUBkbxBsdh54nT6ivXpDPX", "03e3f634671005c8ffb7fe883fcf9e08f6f5486df057f215d761741d91c88de898"},
{"RLbHTvFQoz946W3o3gXTrjxxADeUsWWW16", "02e6bb6dcecf5e3abfe239dec55842a92f096eeac7f0ff7621c3e8948e5e789b27"},
{"RD75njr2RLGC5PqjHbWwuL7ndTqZiUfYxs", "0250d9996c25a34cb1b4e86303a297fc5c49c65615eb31a57fb17d1e1b376e71be"},
{"RT1VTzZYZLWUsPWFJ2oypEqB1MXMfq8b5Y", "02d1797941b7df42a98f59ede0f22294e7c02754232a8b1de9512ededaf3f82880"},
{"RKeXriTVXioHeKpFTjC8Cjohd6DHGUcKqt", "0341e62f0cdffc4ba3e0efb793c0fcaaad1b611db7021b844f643d5c25847733d2"},
{"RQYrDEgZPKMFAgTHNkWFeMHEmpkXe8j28T", "02b8719cd8484755990158cbdf7b9d990d4a5c3741cabe204e51ed04be5bd50133"},
{"RE85TACcn8CEn26itAxQV9afxV9mVg17vm", "0367f569d3dc304e699196fe9b798671fe3f12df7851a0a474879b0dbf8bc508d1"},
{"RPYWQJXto1aeCGe8T6g9Wo4tAL4xE82LJ8", "02cf1e245dfb44e418fd550abb825a600e1753d46a51995970e70c98be539da33e"},
{"RSVHRS5wqEw7bxfuE9k6xJGbARcy5guisp", "03ab8ac83d689ce76b5d29a54c3b34d0a6cb37d64313ff4467c744787475969a23"},
{"REAQwBaJFo6DyBkwfW7rTTDbUtkdmATcQ8", "025e80f0075514cc5940de85c0c559efa99a3688faf6cccb8c1d1f38b96ca91e71"},
{"RF1gz8QBw5uFScGasqVxoUjQwJCD9zHJwC", "031cdae4b545e5049ccee8e0cb792e25795b56e08b5e64b1d972c9b94e9bfd4ed0"},
{"RTnLGoWzpsyoGSViGH8GyYcYhSveSEmnPV", "03cf3403a9d1cefa83e07b73e618a7f991d140a8283a02df3ce7c00223f27f43d0"},
{"RArURqxp6qfF7fqv38tCYr6p4zBtLtqf4x", "026bc4c91c2c35fabe88fea6470d6cda98977a97c251656adf25b81653c00c3800"},
{"RN8GCryShNFvBWtcNEWrQJ5A9AWb3JJoXt", "02afa94f6574cd0fe4f5dc83b09a2112457862421ce96bdc75c1cf25ef5b1f8c4b"},
{"RQSC2eBckcFPWzq9UtofePC31wgDySfJtw", "035d570768d844c8150a3bd966a2e13aa99316f4ab3e80370c4d16fb02f95d0974"},
{"RC4uQsfH6jXpgnTFuFiDwAFo58gHLNkWo7", "02402b0ab7001fd4bcb4fa0d8d7006a6c521b1c76e85aad7b374ecd6c5d564c237"},
{"RREcuaUWSkNzTNPBbFLbXKTKiC4fd5t47J", "03d5bf8b43c44ba064e897da47dd36dba537bebf013d28247ce7a088496dd9b66d"},
{"REFyC5e7kmse3PUapDuXHL2xmtYEGttYYL", "035f56fd01dd21725928bbd878b795dccafecc03b978dc83748e9194dcbfebfb79"},
{"RH1BLwZosLp2hv9msdZGdSu93K8GrMWw7D", "0224ab22ece88f624f80a8535b8d5194646ad6be749070ec188a22c5e29fdd7098"},
{"RNkhugMQVbqDysSayHu2eAhTQpXzKWqZ3m", "02caab4c83c8cc245a7aeb6d25504363555d1b0874aef0f9f8116b4ddb61f24799"},
{"RKiyhLELDJATA7ZCUcutkP1WCEHnAgZRZ8", "028c01859a700ed3941a5786cf2043992e17a45c6689ac4bf608ad3f19e6d0e832"},
{"RLKARvLNo6Abkh5qh5NVn2HJmYfj8ELa6A", "0300a33629da90b9d3c0519d796f4b1278355bb8c46e4caee04b1305e2ab2ff3f2"},
{"RACX21FKLenyyEf8SYK3LmjsDzkDthwUbR", "0205d73c6a3e969eff29e5f424c861d22544245e09eaafc3fefe021cad052b7c0b"},
{"RETb7pEDauKBEuTBuXDhKS3ksd2p8x9KYa", "025c1f7596fd0b7286e6ebd1b3c275a14a13aa4d134db4677769324969b7b7e3a5"},
{"RJrAo78TL6zUmiHXbBv8oRhfGKxGnPnxUu", "02d40a76fbab96a78898b7579626be6dfe360c63b91030e513f849f212d57c1af6"},
{"RL8g6ANxhZBPHHHWgApaiSQ2BSP9qKwuwf", "020236a5748ea49da891276bcb85dc03487cb9f3d0c2b2cdb35227b6a624f86797"},
{"RY3vwBjuuTCiYL5am9HmwbdCjffWd9f4CE", "032f61fd08957d9b88dabc077d8732bef6c30d0234c14e02f3a741116834f591dc"},
{"RQW4LsSzjCPtNw1HGamSaCoiirvsrZmDY5", "02e29451f9baf0186a655396726a22a20617a3e54ea895590f6066abc993f83d32"},
{"RJtjorxqhazz39UpFdhDW8MiW4E3jhXDNk", "03795b7a650db872c22f13a9c88ad5c1ad3cb07a349f1f29e9789efd27e151164b"},
{"RSi8AiCCtS3doFupdpdfuorAhkrCS6mLMu", "037a62ff6b7eb2ba1e170b5c42e7788817ded6a3a7ed841321c01cc107aa647d42"},
{"RMjMXC8m9PgAaMMvwqgLCyCrv47pp6F6XY", "033bdf151c01bc733e614f9d4f204ca44396bf56984df6643205d349a35f7b265d"},
{"RYB3ZMgHt4h7YL8TUzpqaSDw22ABksAPGC", "021266e045f95322fceddae02877dca9721792bef8f2be28cacd7c36290cd813a7"},
{"RGwy64PXswUKpiepfzgaRW98v3gsuqPtow", "03008783c34c2622e7167f0a5201846133e530e89dfe1a8fbcf4c29b33051c4565"},
{"RKJRPLaQV4AkWF6EfUUzFwawTGU4RQZgcS", "03c20a9fd21de76a20ffc87e384be735dfabb7f34a2d881ca9714830fb1bbe6bdb"},
{"RQ4SPvBKTEKyV6y31iSihtfMxi3KeyAJgV", "033c5a23c75d946c15c15fac1e6d78e08c2b656549a158627cfb6bc44bb7b3a560"},
{"RTvRBC1pCQpPKrS27Q4hUCVKVpa5tSTsFS", "02c25672fae388a0613d0127fcfe38ef37f5f354ecfdea0fb734528e354319bd9d"},
{"RKxWu9HpCg7m3UeUGw2Xs1SpFiR96fSCQj", "02ec760d09b369b82b34d864af5a468d8a7dc5609b06bce455d045d1059c4b0f71"},
{"RBAaUWAD8jwVLL7ueb7ciAQewqgheKxwdk", "0274ec3abcca214cdf7f1a565f5f3d3fa910e62e751a1ab0de148ea14ba72d6ba7"},
{"RT853SBEGt4EWrKbpSujya69DG1jSNYjob", "02e80260ca44b8539159e6af678cf5ed0bc596753e4985f66418d6417085b4104e"},
{"RKjEuhVByPwJcZ9wuBgfELiCVnBrc4F8i4", "0357c38f5d5eb1662a54b980c9243ddd8b2100d4b2b9f8175246938ef76e100678"},
{"RT6wVuFFPU5tY6C7Buup1GLV3SE5mpYEha", "02571085ead1aca86b9e90fa9a23d99a194c862524b0c714102888be5bf122dc7d"},
{"RSTgcpV82AivrvWJpd4LR2KwWirwbwXE3Y", "021a0ee4611ca4d8a2e209cc43b95036deb0a9d1cc31fc9f87d50233a44f05ec1a"},
{"RCiaXRzo4AAG3zmPL3Hx63NsRWv5UGiNuM", "02f4876be65c54613e47f7fac67f1453e8d8fde5e19fa53f278a1083a08b258ab3"},
{"RCGgLWrTTaqBhUsS1BqrmFpJZAdNJMzscv", "02893d2db5329b15a33aa7edfbf323c85cabbdc25caa6cf6186fac6052ae6d96a0"},
{"RAJWHL6MzGFKg7KB2sZ87KPQUSvxy3VrEW", "0389971362b002ab5dfa1b5f9c4f88e68249511a3935242ba1e0d31c1c88a36d70"},
{"RU592tQnbH8gt6xd5Uu23nEw3SucDNkXmK", "02b8b6a2266fe57b25f2d4b1da93a07d27930154e78f9d137bc7509cf1ae8e3d49"},
{"RLGCLRzaEmruPC9UmVt5qRHEhXwHip1e6d", "02a2fd96b4459411ad2b09597ba59cf52b282c56330da7c0cc6d2a5c0323a18f1e"}
}
};
@ -525,7 +594,7 @@ extern int32_t ASSETCHAINS_EARLYTXIDCONTRACT;
int tx_height( const uint256 &hash );
extern std::vector<std::string> vAllowListAddress;
extern std::map <std::int8_t, int32_t> mapHeightEvalActivate;
void komodo_netevent(std::vector<uint8_t> payload);
void hush_netevent(std::vector<uint8_t> payload);
int32_t getacseason(uint32_t timestamp);
int32_t gethushseason(int32_t height);
@ -534,8 +603,8 @@ int32_t gethushseason(int32_t height);
#define HUSH_KVBINARY 2
#define PRICES_SMOOTHWIDTH 1
#define PRICES_MAXDATAPOINTS 8
uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume);
int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel);
uint64_t hush_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume);
int32_t hush_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel);
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len);
int32_t hush_minerids(uint8_t *minerids,int32_t height,int32_t width);
@ -546,22 +615,22 @@ int32_t hush_longestchain();
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
int8_t hush_segid(int32_t nocache,int32_t height);
int32_t hush_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight);
char *komodo_pricename(char *name,int32_t ind);
int32_t komodo_priceind(const char *symbol);
int32_t komodo_pricesinit();
int64_t komodo_priceave(int64_t *tmpbuf,int64_t *correlated,int32_t cskip);
int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t rawskip,uint32_t *nonzprices,int32_t smoothwidth);
char *hush_pricename(char *name,int32_t ind);
int32_t hush_priceind(const char *symbol);
int32_t hush_pricesinit();
int64_t hush_priceave(int64_t *tmpbuf,int64_t *correlated,int32_t cskip);
int64_t hush_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t rawskip,uint32_t *nonzprices,int32_t smoothwidth);
int32_t hush_nextheight();
uint32_t hush_heightstamp(int32_t height);
int64_t komodo_pricemult(int32_t ind);
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
int64_t hush_pricemult(int32_t ind);
int32_t hush_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
int32_t hush_currentheight();
int32_t hush_notarized_bracket(struct notarized_checkpoint *nps[2],int32_t height);
arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime);
arith_uint256 hush_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime);
bool hush_hardfork_active(uint32_t time);
uint256 Parseuint256(const char *hexstr);
void komodo_sendmessage(int32_t minpeers, int32_t maxpeers, const char *message, std::vector<uint8_t> payload);
void hush_sendmessage(int32_t minpeers, int32_t maxpeers, const char *message, std::vector<uint8_t> payload);
CBlockIndex *hush_getblockindex(uint256 hash);
int32_t hush_nextheight();
CBlockIndex *hush_blockindex(uint256 hash);

26
src/hush_events.h

@ -88,7 +88,7 @@ void hush_eventadd_pricefeed(struct hush_state *sp,char *symbol,int32_t height,u
memcpy(F.prices,prices,sizeof(*F.prices) * num);
hush_eventadd(sp,height,symbol,HUSH_EVENT_PRICEFEED,(uint8_t *)&F,(int32_t)(sizeof(F.num) + sizeof(*F.prices) * num));
if ( sp != 0 )
komodo_pvals(height,prices,num);
hush_pvals(height,prices,num);
} //else fprintf(stderr,"skip pricefeed[%d]\n",num);
}
@ -107,7 +107,7 @@ void hush_eventadd_opreturn(struct hush_state *sp,char *symbol,int32_t height,ui
hush_eventadd(sp,height,symbol,HUSH_EVENT_OPRETURN,opret,O.oplen);
free(opret);
if ( sp != 0 )
komodo_opreturn(height,value,buf,opretlen,txid,vout,symbol);
hush_opreturn(height,value,buf,opretlen,txid,vout,symbol);
}
}
@ -155,32 +155,32 @@ void hush_event_rewind(struct hush_state *sp,char *symbol,int32_t height)
}
}
void komodo_setkmdheight(struct hush_state *sp,int32_t kmdheight,uint32_t timestamp)
void hush_sethushheight(struct hush_state *sp,int32_t hushheight,uint32_t timestamp)
{
if ( sp != 0 )
{
if ( kmdheight > sp->SAVEDHEIGHT )
if ( hushheight > sp->SAVEDHEIGHT )
{
sp->SAVEDHEIGHT = kmdheight;
sp->SAVEDHEIGHT = hushheight;
sp->SAVEDTIMESTAMP = timestamp;
}
if ( kmdheight > sp->CURRENT_HEIGHT )
sp->CURRENT_HEIGHT = kmdheight;
if ( hushheight > sp->CURRENT_HEIGHT )
sp->CURRENT_HEIGHT = hushheight;
}
}
void hush_eventadd_kmdheight(struct hush_state *sp,char *symbol,int32_t height,int32_t kmdheight,uint32_t timestamp)
void hush_eventadd_hushheight(struct hush_state *sp,char *symbol,int32_t height,int32_t hushheight,uint32_t timestamp)
{
uint32_t buf[2];
if ( kmdheight > 0 ) {
buf[0] = (uint32_t)kmdheight;
if ( hushheight > 0 ) {
buf[0] = (uint32_t)hushheight;
buf[1] = timestamp;
hush_eventadd(sp,height,symbol,HUSH_EVENT_HUSHHEIGHT,(uint8_t *)buf,sizeof(buf));
if ( sp != 0 )
komodo_setkmdheight(sp,kmdheight,timestamp);
hush_sethushheight(sp,hushheight,timestamp);
} else {
//fprintf(stderr,"REWIND kmdheight.%d\n",kmdheight);
kmdheight = -kmdheight;
//fprintf(stderr,"REWIND hushheight.%d\n",hushheight);
hushheight = -hushheight;
hush_eventadd(sp,height,symbol,HUSH_EVENT_REWIND,(uint8_t *)&height,sizeof(height));
if ( sp != 0 )
hush_event_rewind(sp,symbol,height);

398
src/hush_gateway.h

File diff suppressed because it is too large

10
src/hush_globals.h

@ -21,16 +21,16 @@ void hush_prefetch(FILE *fp);
uint32_t hush_heightstamp(int32_t height);
void hush_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint32_t ktime,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth);
void hush_init(int32_t height);
int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *hushstartip,int32_t *hushendip);
int32_t hush_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp);
char *hush_issuemethod(char *userpass,char *method,char *params,uint16_t port);
void hush_init(int32_t height);
int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
int32_t hush_isrealtime(int32_t *kmdheightp);
uint64_t komodo_paxtotal();
int32_t hush_isrealtime(int32_t *hushheightp);
uint64_t hush_paxtotal();
int32_t hush_longestchain();
uint64_t komodo_maxallowed(int32_t baseid);
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
uint64_t hush_maxallowed(int32_t baseid);
int32_t hush_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
int32_t hush_checkvout(int32_t vout,int32_t k,int32_t indallvouts);
pthread_mutex_t hush_mutex;

2
src/hush_nSPV_fullnode.h

@ -863,7 +863,7 @@ int32_t NSPV_getspentinfo(struct NSPV_spentinfo *ptr,uint256 txid,int32_t vout)
return(len);
}
void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> request) // received a request
void hush_nSPVreq(CNode *pfrom,std::vector<uint8_t> request) // received a request
{
int32_t len,slen,ind,reqheight,n; std::vector<uint8_t> response; uint32_t timestamp = (uint32_t)time(NULL);
if ( (len= request.size()) > 0 )

8
src/hush_nSPV_superlite.h

@ -128,9 +128,9 @@ struct NSPV_ntzsproofresp *NSPV_ntzsproof_add(struct NSPV_ntzsproofresp *ptr)
return(&NSPV_ntzsproofresp_cache[i]);
}
// komodo_nSPVresp is called from async message processing
// hush_nSPVresp is called from async message processing
void komodo_nSPVresp(CNode *pfrom,std::vector<uint8_t> response) // received a response
void hush_nSPVresp(CNode *pfrom,std::vector<uint8_t> response) // received a response
{
struct NSPV_inforesp I; int32_t len; uint32_t timestamp = (uint32_t)time(NULL);
strncpy(NSPV_lastpeer,pfrom->addr.ToString().c_str(),sizeof(NSPV_lastpeer)-1);
@ -274,9 +274,9 @@ UniValue NSPV_logout()
return(result);
}
// komodo_nSPV from main polling loop (really this belongs in its own file, but it is so small, it ended up here)
// hush_nSPV from main polling loop (really this belongs in its own file, but it is so small, it ended up here)
void komodo_nSPV(CNode *pto) // polling loop from SendMessages
void hush_nSPV(CNode *pto) // polling loop from SendMessages
{
uint8_t msg[256]; int32_t i,len=0; uint32_t timestamp = (uint32_t)time(NULL);
if ( NSPV_logintime != 0 && timestamp > NSPV_logintime+NSPV_AUTOLOGOUT )

44
src/hush_notary.h

@ -62,6 +62,19 @@ const char *Notaries_genesis[][2] =
int32_t gethushseason(int32_t height)
{
bool istush = strncmp(SMART_CHAIN_SYMBOL, "TUSH",4) == 0 ? true : false;
if ( istush ) {
// TUSH is always Season 7 DPoW notaries from genblock
return 7;
}
// It is season 7 until a new consensus code change, instead
// of the old way, which requires a new code release before
// the last season block height or nodes stop working correctly
if ( height > nHushHardforkHeight3 ) {
return 7;
}
if ( height <= HUSH_SEASON_HEIGHTS[0] )
return(1);
for (int32_t i = 1; i < NUM_HUSH_SEASONS; i++)
@ -89,6 +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
if ( timestamp == 0 && SMART_CHAIN_SYMBOL[0] != 0 ) {
timestamp = hush_heightstamp(height);
} else if ( SMART_CHAIN_SYMBOL[0] == 0 ) {
@ -98,7 +112,9 @@ int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp)
// Find the correct DPoW Notary pubkeys for this season
int32_t hush_season = 0;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
hush_season = ishush3 ? gethushseason(height) : getacseason(timestamp);
bool istush = strncmp(SMART_CHAIN_SYMBOL, "TUSH",4) == 0 ? true : false;
// TUSH uses height activation like HUSH3, other HSCs use timestamps
hush_season = (ishush3 || istush) ? gethushseason(height) : getacseason(timestamp);
if(IS_HUSH_NOTARY) {
fprintf(stderr,"%s: [%s] season=%d height=%d time=%d\n", __func__, ishush3 ? "HUSH3" : SMART_CHAIN_SYMBOL, hush_season, height, timestamp);
@ -230,7 +246,7 @@ int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,ui
//struct hush_state *hush_stateptr(char *symbol,char *dest);
struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx)
struct notarized_checkpoint *hush_npptr_for_height(int32_t height, int *idx)
{
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; int32_t i; struct hush_state *sp; struct notarized_checkpoint *np = 0;
if ( (sp= hush_stateptr(symbol,dest)) != 0 )
@ -247,13 +263,13 @@ struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx)
return(0);
}
struct notarized_checkpoint *komodo_npptr(int32_t height)
struct notarized_checkpoint *hush_npptr(int32_t height)
{
int idx;
return komodo_npptr_for_height(height, &idx);
return hush_npptr_for_height(height, &idx);
}
struct notarized_checkpoint *komodo_npptr_at(int idx)
struct notarized_checkpoint *hush_npptr_at(int idx)
{
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp;
if ( (sp= hush_stateptr(symbol,dest)) != 0 )
@ -262,7 +278,7 @@ struct notarized_checkpoint *komodo_npptr_at(int idx)
return(0);
}
int32_t komodo_prevMoMheight()
int32_t hush_prevMoMheight()
{
static uint256 zero;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; int32_t i; struct hush_state *sp; struct notarized_checkpoint *np = 0;
@ -298,7 +314,7 @@ int32_t hush_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *tx
{
*hashp = sp->NOTARIZED_HASH;
*txidp = sp->NOTARIZED_DESTTXID;
*prevMoMheightp = komodo_prevMoMheight();
*prevMoMheightp = hush_prevMoMheight();
}
return(sp->NOTARIZED_HEIGHT);
} else return(0);
@ -323,25 +339,25 @@ int32_t hush_dpowconfs(int32_t txheight,int32_t numconfs)
return(numconfs);
}
int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip)
int32_t hush_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *hushstartip,int32_t *hushendip)
{
struct notarized_checkpoint *np = 0;
if ( (np= komodo_npptr(height)) != 0 )
if ( (np= hush_npptr(height)) != 0 )
{
*notarized_htp = np->notarized_height;
*MoMp = np->MoM;
*kmdtxidp = np->notarized_desttxid;
*hushtxidp = np->notarized_desttxid;
*MoMoMp = np->MoMoM;
*MoMoMoffsetp = np->MoMoMoffset;
*MoMoMdepthp = np->MoMoMdepth;
*kmdstartip = np->kmdstarti;
*kmdendip = np->kmdendi;
*hushstartip = np->hushstarti;
*hushendip = np->hushendi;
return(np->MoMdepth & 0xffff);
}
*notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0;
*notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *hushstartip = *hushendip = 0;
memset(MoMp,0,sizeof(*MoMp));
memset(MoMoMp,0,sizeof(*MoMoMp));
memset(kmdtxidp,0,sizeof(*kmdtxidp));
memset(hushtxidp,0,sizeof(*hushtxidp));
return(0);
}

18
src/hush_pax.h

@ -133,7 +133,7 @@ uint64_t peggy_smooth_coeffs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)] = // numpri
1, 1, 1, 1, 1, 1, 0, 0, // isum 100000000000
};
uint64_t komodo_maxallowed(int32_t baseid)
uint64_t hush_maxallowed(int32_t baseid)
{
uint64_t mult,val = COIN * (uint64_t)10000;
if ( baseid < 0 || baseid >= 32 )
@ -144,7 +144,7 @@ uint64_t komodo_maxallowed(int32_t baseid)
return(mult * val);
}
uint64_t komodo_paxvol(uint64_t volume,uint64_t price)
uint64_t hush_paxvol(uint64_t volume,uint64_t price)
{
if ( volume < 10000000000 )
return((volume * price) / 1000000000);
@ -170,7 +170,7 @@ void pax_rank(uint64_t *ranked,uint32_t *pvals)
int32_t i; uint64_t vals[32],sum = 0;
for (i=0; i<32; i++)
{
vals[i] = komodo_paxvol(M1SUPPLY[i] / MINDENOMS[i],pvals[i]);
vals[i] = hush_paxvol(M1SUPPLY[i] / MINDENOMS[i],pvals[i]);
sum += vals[i];
}
for (i=0; i<32; i++)
@ -228,11 +228,11 @@ double PAX_val(uint32_t pval,int32_t baseid)
return(0.);
}
void komodo_pvals(int32_t height,uint32_t *pvals,uint8_t numpvals)
void hush_pvals(int32_t height,uint32_t *pvals,uint8_t numpvals)
{
}
uint64_t komodo_paxcorrelation(uint64_t *votes,int32_t numvotes,uint64_t seed)
uint64_t hush_paxcorrelation(uint64_t *votes,int32_t numvotes,uint64_t seed)
{
int32_t i,j,k,ind,zeroes,wt,nonz; int64_t delta; uint64_t lastprice,tolerance,den,densum,sum=0;
for (sum=i=zeroes=nonz=0; i<numvotes; i++)
@ -294,22 +294,22 @@ uint64_t komodo_paxcorrelation(uint64_t *votes,int32_t numvotes,uint64_t seed)
return(sum);
}
uint64_t komodo_paxpriceB(uint64_t seed,int32_t height,char *base,char *rel,uint64_t basevolume)
uint64_t hush_paxpriceB(uint64_t seed,int32_t height,char *base,char *rel,uint64_t basevolume)
{
return 0;
}
uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume)
uint64_t hush_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume)
{
return 0;
}
int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel)
int32_t hush_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel)
{
return 0;
}
void komodo_paxpricefeed(int32_t height,uint8_t *pricefeed,int32_t opretlen)
void hush_paxpricefeed(int32_t height,uint8_t *pricefeed,int32_t opretlen)
{
}

8
src/hush_structs.h

@ -77,7 +77,7 @@ struct pax_transaction
{
UT_hash_handle hh;
uint256 txid;
uint64_t komodoshis,fiatoshis,validated;
uint64_t puposhis,fiatoshis,validated;
int32_t marked,height,otherheight,approved,didstats,ready;
uint16_t vout;
char symbol[HUSH_SMART_CHAIN_MAXLEN],source[HUSH_SMART_CHAIN_MAXLEN],coinaddr[64]; uint8_t rmd160[20],type,buf[35];
@ -88,7 +88,7 @@ struct knotaries_entry { int32_t height,numnotaries; struct knotary_entry *Notar
struct notarized_checkpoint
{
uint256 notarized_hash,notarized_desttxid,MoM,MoMoM;
int32_t nHeight,notarized_height,MoMdepth,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi;
int32_t nHeight,notarized_height,MoMdepth,MoMoMdepth,MoMoMoffset,hushstarti,hushendi;
};
struct hush_ccdataMoM
@ -97,13 +97,13 @@ struct hush_ccdataMoM
int32_t MoMdepth,notarized_height,height,txi;
};
struct hush_ccdata_entry { uint256 MoM; int32_t notarized_height,kmdheight,txi; char symbol[65]; };
struct hush_ccdata_entry { uint256 MoM; int32_t notarized_height,hushheight,txi; char symbol[65]; };
struct hush_ccdatapair { int32_t notarized_height,MoMoMoffset; };
struct hush_ccdataMoMoM
{
uint256 MoMoM;
int32_t kmdstarti,kmdendi,MoMoMoffset,MoMoMdepth,numpairs,len;
int32_t hushstarti,hushendi,MoMoMoffset,MoMoMdepth,numpairs,len;
struct hush_ccdatapair *pairs;
};

8
src/hush_utils.h

@ -980,7 +980,7 @@ int32_t dragon_rwbignum(int32_t rwflag,uint8_t *serialized,int32_t len,uint8_t *
return(len);
}
int32_t komodo_scriptitemlen(int32_t *opretlenp,uint8_t *script)
int32_t hush_scriptitemlen(int32_t *opretlenp,uint8_t *script)
{
int32_t opretlen,len = 0;
if ( (opretlen= script[len++]) >= 0x4c )
@ -2292,7 +2292,7 @@ void hush_args(char *argv0)
extralen += symbol.size();
}
}
//komodo_pricesinit();
//hush_pricesinit();
hush_cbopretupdate(1); // will set Mineropret
fprintf(stderr,"This blockchain uses data produced from CoinDesk Bitcoin Price Index\n");
}
@ -2325,7 +2325,7 @@ void hush_args(char *argv0)
if ( (baseid = hush_baseid(SMART_CHAIN_SYMBOL)) >= 0 && baseid < 32 )
{
//komodo_maxallowed(baseid);
//hush_maxallowed(baseid);
if(fDebug)
printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,SMART_CHAIN_SYMBOL,(double)MAX_MONEY/SATOSHIDEN);
}
@ -2381,7 +2381,7 @@ void hush_args(char *argv0)
if ( ASSETCHAINS_RPCPORT == 0 )
ASSETCHAINS_RPCPORT = ASSETCHAINS_P2PPORT + 1;
//ASSETCHAINS_NOTARIES = GetArg("-ac_notaries","");
//komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str());
//hush_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str());
dragon_rwnum(1,magic,sizeof(ASSETCHAINS_MAGIC),(void *)&ASSETCHAINS_MAGIC);
for (i=0; i<4; i++)
sprintf(&magicstr[i<<1],"%02x",magic[i]);

21
src/main.cpp

@ -82,7 +82,7 @@ int32_t hush_block2pubkey33(uint8_t *pubkey33,CBlock *block);
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
void hush_setactivation(int32_t height);
void hush_changeblocktime();
void komodo_pricesupdate(int32_t height,CBlock *pblock);
void hush_pricesupdate(int32_t height,CBlock *pblock);
BlockMap mapBlockIndex;
CChain chainActive;
CBlockIndex *pindexBestHeader = NULL;
@ -1423,7 +1423,7 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState
{
static uint256 array[64]; static int32_t numbanned,indallvouts; int32_t j,k,n;
if ( *(int32_t *)&array[0] == 0 )
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
numbanned = hush_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
n = tx.vin.size();
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
@ -1455,8 +1455,9 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState
// This is used only in RPC currently but hush_notaries()/gethushseason/getacseason is consensus
int32_t hush_isnotaryvout(char *coinaddr,uint32_t tiptime) {
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
bool istush = strncmp(SMART_CHAIN_SYMBOL, "TUSH",4) == 0 ? true : false;
int32_t height = chainActive.LastTip()->GetHeight();
int32_t season = ishush3 ? gethushseason(height) : getacseason(tiptime);
int32_t season = (ishush3 || istush) ? gethushseason(height) : getacseason(tiptime);
fprintf(stderr,"%s: season=%d, tiptime=%d\n", __func__, season,tiptime);
if ( NOTARY_ADDRESSES[season-1][0][0] == 0 ) {
uint8_t pubkeys[64][33];
@ -4040,7 +4041,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
{
//fprintf(stderr,"%s: HUSH_NSPV_FULLNODE\n", __FUNCTION__);
if ( ASSETCHAINS_CBOPRET != 0 )
komodo_pricesupdate(pindexNew->GetHeight(),pblock);
hush_pricesupdate(pindexNew->GetHeight(),pblock);
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > HUSH_SAPING_ACTIVATION - 24*3600 )
hush_activate_sapling(pindexNew);
if ( ASSETCHAINS_CC != 0 && HUSH_SNAPSHOT_INTERVAL != 0 && (pindexNew->GetHeight() % HUSH_SNAPSHOT_INTERVAL) == 0 && pindexNew->GetHeight() >= HUSH_SNAPSHOT_INTERVAL )
@ -4471,7 +4472,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
if (it != mapBlockIndex.end())
{
if ( it->second != 0 ) // vNodes.size() >= HUSH_LIMITED_NETWORKSIZE, change behavior to allow komodo_ensure to work
if ( it->second != 0 ) // vNodes.size() >= HUSH_LIMITED_NETWORKSIZE
{
// this is the strange case where somehow the hash is in the mapBlockIndex via as yet undetermined process, but the pindex for the hash is not there. Theoretically it is due to processing the block headers, but I have seen it get this case without having received it from the block headers or anywhere else... jl777
//fprintf(stderr,"addtoblockindex already there %p\n",it->second);
@ -4479,7 +4480,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
}
if ( miPrev != mapBlockIndex.end() && (*miPrev).second == 0 )
{
//fprintf(stderr,"edge case of both block and prevblock in the strange state\n");
fprintf(stderr,"%s: edge case of both block and prevblock in the strange state\n", __func__);
return(0); // return here to avoid the state of pindex->GetHeight() not set and pprev NULL
}
}
@ -7074,7 +7075,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
std::vector<uint8_t> payload;
vRecv >> payload;
komodo_netevent(payload);
hush_netevent(payload);
return(true);
} else if (strCommand == "verack") {
pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
@ -7274,7 +7275,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{
std::vector<uint8_t> payload;
vRecv >> payload;
komodo_nSPVreq(pfrom,payload);
hush_nSPVreq(pfrom,payload);
}
return(true);
} else if (strCommand == "nSPV") {
@ -7282,7 +7283,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{
std::vector<uint8_t> payload;
vRecv >> payload;
komodo_nSPVresp(pfrom,payload);
hush_nSPVresp(pfrom,payload);
}
return(true);
}
@ -8009,7 +8010,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
}
if ( HUSH_NSPV_SUPERLITE )
{
komodo_nSPV(pto);
hush_nSPV(pto);
return(true);
}
BOOST_FOREACH(const CBlockReject& reject, state.rejects)

20
src/miner.cpp

@ -147,8 +147,8 @@ int32_t hush_is_notarytx(const CTransaction& tx);
uint64_t hush_notarypay(CMutableTransaction &txNew, std::vector<int8_t> &NotarizationNotaries, uint32_t timestamp, int32_t height, uint8_t *script, int32_t len);
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
int32_t hush_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *script, int32_t len);
CScript komodo_mineropret(int32_t nHeight);
bool komodo_appendACscriptpub();
CScript hush_mineropret(int32_t nHeight);
bool hush_appendACscriptpub();
CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32_t gpucount, bool isStake)
{
@ -167,7 +167,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
}
} else pk = _pk;
uint64_t deposits,voutsum=0; int32_t isrealtime,kmdheight; uint32_t blocktime; const CChainParams& chainparams = Params();
uint64_t deposits,voutsum=0; int32_t isrealtime,hushheight; uint32_t blocktime; const CChainParams& chainparams = Params();
bool fNotarizationBlock = false; std::vector<int8_t> NotarizationNotaries;
//fprintf(stderr,"create new block\n");
@ -612,7 +612,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
{
static bool didinit = false;
if ( !didinit && nHeight > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && komodo_appendACscriptpub() )
if ( !didinit && nHeight > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() )
{
fprintf(stderr, "appended ccopreturn to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str());
didinit = true;
@ -667,7 +667,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
int32_t numv = (int32_t)txNew.vout.size();
txNew.vout.resize(numv+1);
txNew.vout[numv].nValue = 0;
txNew.vout[numv].scriptPubKey = komodo_mineropret(nHeight);
txNew.vout[numv].scriptPubKey = hush_mineropret(nHeight);
//printf("autocreate commision/cbopret.%lld vout[%d]\n",(long long)ASSETCHAINS_CBOPRET,(int32_t)txNew.vout.size());
}
pblock->vtx[0] = txNew;
@ -879,7 +879,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake);
}
void komodo_sendmessage(int32_t minpeers,int32_t maxpeers,const char *message,std::vector<uint8_t> payload)
void hush_sendmessage(int32_t minpeers,int32_t maxpeers,const char *message,std::vector<uint8_t> payload)
{
int32_t numsent = 0;
LOCK(cs_vNodes);
@ -956,7 +956,7 @@ static bool ProcessBlockFound(CBlock* pblock)
int32_t hush_baseid(char *origbase);
int32_t hush_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t *blocktimes,int32_t *nonzpkeysp,int32_t height);
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
arith_uint256 hush_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
int32_t FOUND_BLOCK,HUSH_MAYBEMINED;
extern int32_t HUSH_LASTMINED,HUSH_INSYNC;
int32_t roundrobin_delay;
@ -1237,7 +1237,7 @@ void static BitcoinMiner()
} else Mining_start = 0;
//else if ( ASSETCHAINS_ADAPTIVEPOW > 0 )
// HASHTarget_POW = komodo_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime);
// HASHTarget_POW = hush_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime);
gotinvalid = 0;
while (true)
{
@ -1462,7 +1462,7 @@ void static BitcoinMiner()
HASHTarget.SetCompact(pblock->nBits);
hashTarget = HASHTarget;
savebits = pblock->nBits;
//hashTarget = HASHTarget_POW = komodo_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime);
//hashTarget = HASHTarget_POW = hush_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime);
}
/*if ( NOTARY_PUBKEY33[0] == 0 )
{
@ -1472,7 +1472,7 @@ void static BitcoinMiner()
{
// Changing pblock->nTime can change work required on testnet:
HASHTarget.SetCompact(pblock->nBits);
HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED);
HASHTarget_POW = hush_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED);
}
}*/
}

22
src/rpc/blockchain.cpp

@ -942,18 +942,18 @@ UniValue minerids(const UniValue& params, bool fHelp, const CPubKey& mypk)
}
for (i=0; i<64; i++)
{
UniValue item(UniValue::VOBJ); std::string hex,hushaddress; char *hexstr,kmdaddr[64],*ptr; int32_t m;
UniValue item(UniValue::VOBJ); std::string hex,hushaddress; char *hexstr,hushaddr[64],*ptr; int32_t m;
hex.resize(66);
hexstr = (char *)hex.data();
for (j=0; j<33; j++)
sprintf(&hexstr[j*2],"%02x",pubkeys[i][j]);
item.push_back(Pair("notaryid", i));
bitcoin_address(kmdaddr,60,pubkeys[i],33);
m = (int32_t)strlen(kmdaddr);
bitcoin_address(hushaddr,60,pubkeys[i],33);
m = (int32_t)strlen(hushaddr);
hushaddress.resize(m);
ptr = (char *)hushaddress.data();
memcpy(ptr,kmdaddr,m);
memcpy(ptr,hushaddr,m);
item.push_back(Pair("HUSHaddress", hushaddress));
item.push_back(Pair("pubkey", hex));
@ -973,7 +973,7 @@ UniValue minerids(const UniValue& params, bool fHelp, const CPubKey& mypk)
UniValue notaries(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue a(UniValue::VARR); uint32_t timestamp=0; UniValue ret(UniValue::VOBJ); int32_t i,j,n,m; char *hexstr; uint8_t pubkeys[64][33]; char btcaddr[64],kmdaddr[64],*ptr;
UniValue a(UniValue::VARR); uint32_t timestamp=0; UniValue ret(UniValue::VOBJ); int32_t i,j,n,m; char *hexstr; uint8_t pubkeys[64][33]; char btcaddr[64],hushaddr[64],*ptr;
if ( fHelp || (params.size() != 1 && params.size() != 2) )
throw runtime_error("notaries height timestamp\n");
LOCK(cs_main);
@ -1011,11 +1011,11 @@ UniValue notaries(const UniValue& params, bool fHelp, const CPubKey& mypk)
memcpy(ptr,btcaddr,m);
item.push_back(Pair("BTCaddress", btcaddress));
bitcoin_address(kmdaddr,60,pubkeys[i],33);
m = (int32_t)strlen(kmdaddr);
bitcoin_address(hushaddr,60,pubkeys[i],33);
m = (int32_t)strlen(hushaddr);
hushaddress.resize(m);
ptr = (char *)hushaddress.data();
memcpy(ptr,kmdaddr,m);
memcpy(ptr,hushaddr,m);
item.push_back(Pair("HUSHaddress", hushaddress));
a.push_back(item);
}
@ -1027,7 +1027,7 @@ UniValue notaries(const UniValue& params, bool fHelp, const CPubKey& mypk)
return ret;
}
int32_t komodo_pending_withdraws(char *opretstr);
int32_t hush_pending_withdraws(char *opretstr);
int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base);
extern char CURRENCIES[][8];
@ -1037,7 +1037,7 @@ UniValue paxpending(const UniValue& params, bool fHelp, const CPubKey& mypk)
if ( fHelp || params.size() != 0 )
throw runtime_error("paxpending needs no args\n");
LOCK(cs_main);
if ( (opretlen= komodo_pending_withdraws(opretbuf)) > 0 )
if ( (opretlen= hush_pending_withdraws(opretbuf)) > 0 )
ret.push_back(Pair("withdraws", opretbuf));
else ret.push_back(Pair("withdraws", (char *)""));
for (baseid=0; baseid<32; baseid++)
@ -1076,7 +1076,7 @@ UniValue paxprice(const UniValue& params, bool fHelp, const CPubKey& mypk)
else height = atoi(params[2].get_str().c_str());
//if ( params.size() == 3 || (basevolume= COIN * atof(params[3].get_str().c_str())) == 0 )
basevolume = 100000;
relvolume = komodo_paxprice(&seed,height,(char *)base.c_str(),(char *)rel.c_str(),basevolume);
relvolume = hush_paxprice(&seed,height,(char *)base.c_str(),(char *)rel.c_str(),basevolume);
ret.push_back(Pair("base", base));
ret.push_back(Pair("rel", rel));
ret.push_back(Pair("height", height));

53
src/rpc/crosschain.cpp

@ -56,9 +56,9 @@ int32_t ensure_CCrequirements(uint8_t evalcode);
bool EnsureWalletIsAvailable(bool avoidException);
int32_t hush_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height);
struct hush_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi);
int32_t hush_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *hushtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *hushstartip,int32_t *hushendip);
int32_t hush_MoMoMdata(char *hexstr,int32_t hexsize,struct hush_ccdataMoMoM *mdata,char *symbol,int32_t hushheight,int32_t notarized_height);
struct hush_ccdata_entry *hush_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t hushstarti,int32_t hushendi);
uint256 hush_calcMoM(int32_t height,int32_t MoMdepth);
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
extern std::string ASSETCHAINS_SELFIMPORT;
@ -71,7 +71,7 @@ UniValue assetchainproof(const UniValue& params, bool fHelp, const CPubKey& mypk
{
uint256 hash;
// parse params and get notarisation data for tx
// parse params and get notarization data for tx
if ( fHelp || params.size() != 1)
throw runtime_error("assetchainproof needs a txid");
@ -93,7 +93,7 @@ UniValue crosschainproof(const UniValue& params, bool fHelp, const CPubKey& mypk
UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
int32_t height,depth,notarized_height,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi; uint256 MoM,MoMoM,kmdtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR);
int32_t height,depth,notarized_height,MoMoMdepth,MoMoMoffset,hushstarti,hushendi; uint256 MoM,MoMoM,hushtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR);
if ( fHelp || params.size() != 1 )
throw runtime_error("height_MoM height\n");
LOCK(cs_main);
@ -108,7 +108,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
height = chainActive.Tip()->GetHeight();
}
//fprintf(stderr,"height_MoM height.%d\n",height);
depth = hush_MoM(&notarized_height,&MoM,&kmdtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi);
depth = hush_MoM(&notarized_height,&MoM,&hushtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&hushstarti,&hushendi);
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL)));
ret.push_back(Pair("height",height));
ret.push_back(Pair("timestamp",(uint64_t)timestamp));
@ -117,14 +117,14 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
ret.push_back(Pair("depth",depth));
ret.push_back(Pair("notarized_height",notarized_height));
ret.push_back(Pair("MoM",MoM.GetHex()));
ret.push_back(Pair("kmdtxid",kmdtxid.GetHex()));
ret.push_back(Pair("hushtxid",hushtxid.GetHex()));
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
ret.push_back(Pair("MoMoM",MoMoM.GetHex()));
ret.push_back(Pair("MoMoMoffset",MoMoMoffset));
ret.push_back(Pair("MoMoMdepth",MoMoMdepth));
ret.push_back(Pair("kmdstarti",kmdstarti));
ret.push_back(Pair("kmdendi",kmdendi));
ret.push_back(Pair("hushstarti",hushstarti));
ret.push_back(Pair("hushendi",hushendi));
}
} else ret.push_back(Pair("error",(char *)"no MoM for height"));
@ -134,18 +134,18 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
UniValue MoMoMdata(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if ( fHelp || params.size() != 3 )
throw runtime_error("MoMoMdata symbol kmdheight ccid\n");
throw runtime_error("MoMoMdata symbol hushheight ccid\n");
UniValue ret(UniValue::VOBJ);
char* symbol = (char *)params[0].get_str().c_str();
int kmdheight = atoi(params[1].get_str().c_str());
int hushheight = atoi(params[1].get_str().c_str());
uint32_t ccid = atoi(params[2].get_str().c_str());
ret.push_back(Pair("coin",symbol));
ret.push_back(Pair("kmdheight",kmdheight-5));
ret.push_back(Pair("hushheight",hushheight-5));
ret.push_back(Pair("ccid", (int) ccid));
uint256 destNotarizationTxid;
std::vector<uint256> moms;
uint256 MoMoM = CalculateProofRoot(symbol, ccid, kmdheight-5, moms, destNotarizationTxid);
uint256 MoMoM = CalculateProofRoot(symbol, ccid, hushheight-5, moms, destNotarizationTxid);
UniValue valMoms(UniValue::VARR);
for (int i=0; i<moms.size(); i++) valMoms.push_back(moms[i].GetHex());
@ -1126,7 +1126,7 @@ UniValue getNotarizationsForBlock(const UniValue& params, bool fHelp, const CPub
// TODO take timestamp as param, and loop blockindex to get starting/finish height.
if (fHelp || params.size() != 1)
throw runtime_error("getNotarizationsForBlock height\n\n"
"Takes a block height and returns notarisation information "
"Takes a block height and returns notarization information "
"within the block");
LOCK(cs_main);
@ -1168,34 +1168,11 @@ UniValue getNotarizationsForBlock(const UniValue& params, bool fHelp, const CPub
return out;
}
/*UniValue getNotarizationsForBlock(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (fHelp || params.size() != 1)
throw runtime_error("getNotarizationsForBlock blockHash\n\n"
"Takes a block hash and returns notarisation transactions "
"within the block");
uint256 blockHash = uint256S(params[0].get_str());
NotarizationsInBlock nibs;
GetBlockNotarizations(blockHash, nibs);
UniValue out(UniValue::VARR);
BOOST_FOREACH(const Notarization& n, nibs)
{
UniValue item(UniValue::VARR);
item.push_back(n.first.GetHex());
item.push_back(HexStr(E_MARSHAL(ss << n.second)));
out.push_back(item);
}
return out;
}*/
UniValue scanNotarizationsDB(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (fHelp || params.size() < 2 || params.size() > 3)
throw runtime_error("scanNotarizationsDB blockHeight symbol [blocksLimit=1440]\n\n"
"Scans notarisationsdb backwards from height for a notarisation"
"Scans notarizationsdb backwards from height for a notarization"
" of given symbol");
int height = atoi(params[0].get_str().c_str());
std::string symbol = params[1].get_str().c_str();

2
src/rpc/mining.cpp

@ -52,7 +52,7 @@ using namespace std;
extern int32_t ASSETCHAINS_FOUNDERS;
uint64_t the_commission(const CBlock *pblock,int32_t height);
int32_t hush_blockload(CBlock& block,CBlockIndex *pindex);
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
arith_uint256 hush_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
/**
* Return average network hashes per second based on the last 'lookup' blocks,

4
src/rpc/server.cpp

@ -829,8 +829,10 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue &params
// Others may not have data loaded yet, such as wallet details, but
// those RPCs are written defensively to deal with that. Allowing these
// few RPCs means we can see our addresses and make private key backups
// while a very long wallet rescan is happening
// while a very long wallet rescan is happening and do other read-only devopz
if (pcmd->name != "stop" && pcmd->name != "help" && pcmd->name != "z_listaddresses" && pcmd->name != "z_exportkey" &&
pcmd->name != "getNotarizationsForBlock" && pcmd->name != "scanNotarizationsDB" &&
pcmd->name != "getnotarysendmany" && pcmd->name != "geterablockheights" &&
pcmd->name != "getaddressesbyaccount" && pcmd->name != "listaddresses" && pcmd->name != "z_exportwallet" &&
pcmd->name != "notaries" && pcmd->name != "signmessage" && pcmd->name != "decoderawtransaction" &&
pcmd->name != "dumpprivkey" && pcmd->name != "getpeerinfo" && pcmd->name != "getnetworkinfo" ) {

5
src/stratum.cpp

@ -2080,8 +2080,7 @@ UniValue rpc_stratum_setdifficulty (const UniValue& params, bool fHelp, const CP
} else {
if (ParseDouble(param_str, &hush_diff)) {
// kmd diff as a str passed
// hush diff as a str passed
// difficulty = difficulty_1_target / current_target
arith_uint256 target;
ccminer::hush_diff_to_target_equi((uint32_t *)&target, hush_diff);
@ -2091,7 +2090,7 @@ UniValue rpc_stratum_setdifficulty (const UniValue& params, bool fHelp, const CP
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid difficulty (not hex target, not hush_diff)");
}
} else if (params[0].getType() == UniValue::VNUM) {
// kmd diff as a num passed
// hush diff as a num passed
hush_diff = params[0].get_real();
// difficulty = difficulty_1_target / current_target

3
src/sync.cpp

@ -19,12 +19,9 @@
******************************************************************************/
#include "sync.h"
#include "util.h"
#include "utilstrencodings.h"
#include <stdio.h>
#include <boost/foreach.hpp>
#include <boost/thread.hpp>

17
src/tush-cli

@ -0,0 +1,17 @@
#!/bin/bash
# Copyright (c) 2016-2021 The Hush developers
# set working directory to the location of this script
# readlink -f does not always exist
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
DIR="$( cd "$( dirname "$( readlink "${BASH_SOURCE[0]}" )" )" && pwd )"
cd $DIR
NAME=TUSH
# Use the HUSHCLI env var to over-ride using the same directory as this file
CLI=${HUSHCLI:-./hush-cli}
if [ -f $CLI ]; then
$CLI -ac_name=$NAME "$@"
fi

15
src/tushd

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Copyright (c) 2016-2021 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
# set working directory to the location of this script
# readlink -f does not always exist
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
DIR="$( cd "$( dirname "$( readlink "${BASH_SOURCE[0]}" )" )" && pwd )"
cd $DIR
# ./hushd -ac_name=TUSH -ac_private=1 -gen=1 -testnode=1
./hushd -ac_name=TUSH -ac_private=1 -ac_supply=55555

2
src/version.h

@ -21,7 +21,7 @@
#define HUSH_VERSION_H
// network protocol versioning
static const int PROTOCOL_VERSION = 1987423;
static const int PROTOCOL_VERSION = 1987424;
//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
//! In this version, 'getheaders' was introduced.

11
src/wallet/crypter.cpp

@ -2,7 +2,6 @@
// Copyright (c) 2016-2021 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
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
@ -17,17 +16,21 @@
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
#include "crypter.h"
#include "script/script.h"
#include "script/standard.h"
#include "streams.h"
#include "util.h"
#include <string>
#include <vector>
#include <boost/foreach.hpp>
// TODO: these are not set correctly by wolfssl for some reason. Ja bless.
#undef ECC_TIMING_RESISTANT
#undef TFM_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT 420
#define TFM_TIMING_RESISTANT 420
#undef WC_RSA_BLINDING
#define WC_RSA_BLINDING
#include <wolfssl/openssl/aes.h>
#include <wolfssl/openssl/evp.h>

24
src/wallet/rpcwallet.cpp

@ -443,8 +443,6 @@ UniValue listaddresses(const UniValue& params, bool fHelp, const CPubKey& mypk)
LOCK2(cs_main, pwalletMain->cs_wallet);
string strAccount = AccountFromValue(params[0]);
// Find all taddrs
UniValue ret(UniValue::VARR);
for (const std::pair<CTxDestination, CAddressBookData>& item : pwalletMain->mapAddressBook) {
@ -614,7 +612,7 @@ int32_t hush_opreturnscript(uint8_t *script,uint8_t type,uint8_t *opret,int32_t
extern int32_t HUSH_PAX;
int32_t hush_is_issuer();
int32_t dragon_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp);
int32_t hush_isrealtime(int32_t *kmdheightp);
int32_t hush_isrealtime(int32_t *hushheightp);
int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base);
int32_t hush_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[DRAGON_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
int32_t hush_kvcmp(uint8_t *refvalue,uint16_t refvaluesize,uint8_t *value,uint16_t valuesize);
@ -768,7 +766,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
UniValue paxdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
uint64_t available,deposited,issued,withdrawn,approved,redeemed,seed,komodoshis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33];
uint64_t available,deposited,issued,withdrawn,approved,redeemed,seed,puposhis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33];
bool fSubtractFeeFromAmount = false;
if ( HUSH_PAX == 0 )
{
@ -793,28 +791,28 @@ UniValue paxdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk)
fprintf(stderr,"available %llu vs fiatoshis %llu\n",(long long)available,(long long)fiatoshis);
throw runtime_error("paxdeposit not enough available inventory");
}
komodoshis = PAX_fiatdest(&seed,0,destaddr,pubkey37,(char *)params[0].get_str().c_str(),height,(char *)base.c_str(),fiatoshis);
puposhis = PAX_fiatdest(&seed,0,destaddr,pubkey37,(char *)params[0].get_str().c_str(),height,(char *)base.c_str(),fiatoshis);
dest.append(destaddr);
CBitcoinAddress destaddress(CRYPTO555_HUSHADDR);
if (!destaddress.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid dest Bitcoin address");
for (i=0; i<33; i++)
fprintf(stderr,"%02x",pubkey37[i]);
fprintf(stderr," ht.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",height,(char *)params[0].get_str().c_str(),(char *)base.c_str(),(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed);
fprintf(stderr," ht.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) puposhis.%llu seed.%llx\n",height,(char *)params[0].get_str().c_str(),(char *)base.c_str(),(long long)fiatoshis,destaddr,(long long)puposhis,(long long)seed);
EnsureWalletIsUnlocked();
CWalletTx wtx;
uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = komodoshis / 1000;
uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = puposhis / 1000;
if ( fee < 10000 )
fee = 10000;
dragon_rwnum(1,&pubkey37[33],sizeof(height),&height);
opretlen = hush_opreturnscript(opretbuf,'D',pubkey37,37);
SendMoney(address.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,komodoshis);
SendMoney(address.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,puposhis);
return wtx.GetHash().GetHex();
}
UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
CWalletTx wtx; std::string dest; int32_t kmdheight; uint64_t seed,komodoshis = 0; char destaddr[64]; uint8_t i,pubkey37[37]; bool fSubtractFeeFromAmount = false;
CWalletTx wtx; std::string dest; int32_t hushheight; uint64_t seed,puposhis = 0; char destaddr[64]; uint8_t i,pubkey37[37]; bool fSubtractFeeFromAmount = false;
if ( SMART_CHAIN_SYMBOL[0] == 0 )
return(0);
if (!EnsureWalletIsAvailable(fHelp))
@ -822,26 +820,26 @@ UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk)
throw runtime_error("paxwithdraw deprecated");
if (fHelp || params.size() != 2)
throw runtime_error("paxwithdraw address fiatamount");
if ( hush_isrealtime(&kmdheight) == 0 )
if ( hush_isrealtime(&hushheight) == 0 )
return(0);
LOCK2(cs_main, pwalletMain->cs_wallet);
CBitcoinAddress address(params[0].get_str());
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
int64_t fiatoshis = atof(params[1].get_str().c_str()) * COIN;
komodoshis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),kmdheight,SMART_CHAIN_SYMBOL,fiatoshis);
puposhis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),hushheight,SMART_CHAIN_SYMBOL,fiatoshis);
dest.append(destaddr);
CBitcoinAddress destaddress(CRYPTO555_HUSHADDR);
if (!destaddress.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid dest Bitcoin address");
for (i=0; i<33; i++)
printf("%02x",pubkey37[i]);
printf(" kmdheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",kmdheight,(char *)params[0].get_str().c_str(),SMART_CHAIN_SYMBOL,(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed);
printf(" hushheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) puposhis.%llu seed.%llx\n",hushheight,(char *)params[0].get_str().c_str(),SMART_CHAIN_SYMBOL,(long long)fiatoshis,destaddr,(long long)puposhis,(long long)seed);
EnsureWalletIsUnlocked();
uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = fiatoshis / 1000;
if ( fee < 10000 )
fee = 10000;
dragon_rwnum(1,&pubkey37[33],sizeof(kmdheight),&kmdheight);
dragon_rwnum(1,&pubkey37[33],sizeof(hushheight),&hushheight);
opretlen = hush_opreturnscript(opretbuf,'W',pubkey37,37);
SendMoney(destaddress.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,fiatoshis);
return wtx.GetHash().GetHex();

2
src/zcash/JoinSplit.cpp

@ -4,10 +4,8 @@
#include "JoinSplit.hpp"
#include "prf.h"
#include "sodium.h"
#include <memory>
#include <fstream>
#include "librustzcash.h"
namespace libzcash {

Loading…
Cancel
Save