Browse Source

Merge remote-tracking branch 'origin/duke' into duke

pull/43/head
Duke Leto 5 years ago
parent
commit
a93763aadc
  1. 3
      .travis.yml
  2. 7
      README-mac.md
  3. 4
      configure.ac
  4. 21
      contrib/README.md
  5. 240
      contrib/debian/changelog
  6. 21
      contrib/debian/control
  7. 4
      contrib/debian/copyright
  8. 140
      contrib/debian/examples/HUSH3.conf
  9. 0
      contrib/debian/hush.example
  10. 1
      contrib/debian/hush.install
  11. 2
      contrib/debian/hush.manpages
  12. 2
      contrib/debian/zcash.manpages
  13. 160
      contrib/zcash-cli.bash-completion
  14. 57
      contrib/zcash-tx.bash-completion
  15. 57
      contrib/zcashd.bash-completion
  16. 4
      depends/packages/packages.mk
  17. 9
      depends/packages/utfcpp.mk
  18. 6
      doc/man/komodo-cli.1
  19. 10
      doc/man/komodo-tx.1
  20. 6
      doc/man/komodod.1
  21. 13
      doc/man/verus-cli/linux/README.txt
  22. 17
      doc/man/verus-cli/mac/README.txt
  23. 21
      doc/man/verus-cli/windows/README.txt
  24. 88
      doc/man/zcash-cli.1
  25. 28
      doc/man/zcash-fetch-params.1
  26. 101
      doc/man/zcash-tx.1
  27. 483
      doc/man/zcashd.1
  28. 10
      makeReleaseMac.sh
  29. 9072
      patches
  30. 10
      qa/rpc-tests/test_framework/util.py
  31. 2
      src/ac/coqui
  32. 2
      src/ac/coquicash
  33. 2
      src/ac/thc
  34. 32
      src/assetchains.json
  35. 12
      src/assetchains.old
  36. 23
      src/bitcoind.cpp
  37. 2
      src/cc/CCinclude.h
  38. 8
      src/cc/CCtokens.cpp
  39. 24
      src/cc/CCtx.cpp
  40. 10
      src/cc/CCutils.cpp
  41. 20
      src/cc/channels.cpp
  42. 17
      src/cc/dice.cpp
  43. 8
      src/cc/dilithium.c
  44. 24
      src/cc/gamescc.cpp
  45. 18
      src/cc/gateways.cpp
  46. 16
      src/cc/importgateway.cpp
  47. 8
      src/cc/lotto.cpp
  48. 38
      src/cc/oracles.cpp
  49. 12
      src/cc/pegs.cpp
  50. 16
      src/cc/rewards.cpp
  51. 6
      src/cc/rogue_rpc.cpp
  52. 568
      src/chainparams.cpp
  53. 4
      src/clientversion.h
  54. 2
      src/fiat/coqui
  55. 2
      src/fiat/coquicash
  56. 2
      src/fiat/thc
  57. 2
      src/fiat/vote2018
  58. 2
      src/fiat/vote2019
  59. 25
      src/init.cpp
  60. 6
      src/komodo-tx.cpp
  61. 3
      src/komodo_nSPV_defs.h
  62. 84
      src/komodo_nSPV_fullnode.h
  63. 46
      src/komodo_nSPV_superlite.h
  64. 9
      src/komodo_nSPV_wallet.h
  65. 33
      src/komodo_notary.h
  66. 24
      src/main.cpp
  67. 4
      src/rpc/blockchain.cpp
  68. 1
      src/rpc/client.cpp
  69. 4
      src/rpc/mining.cpp
  70. 47
      src/txmempool.cpp
  71. 7
      src/txmempool.h
  72. 6
      src/wallet/rpcdump.cpp
  73. 256
      src/wallet/rpcwallet.cpp
  74. 78
      src/wallet/wallet.cpp
  75. 12
      src/wallet/wallet.h
  76. 50
      src/zcash/Note.cpp
  77. 432
      zcutil/VerusCoin.xml
  78. 67
      zcutil/build-debian-package.sh

3
.travis.yml

@ -6,9 +6,6 @@ matrix:
dist: xenial
sudo: required
env: LINUX_DEPLOY="true" OSX_DEPLOY="false" $TRAVIS_OS_NAME="linux"
- os: osx
osx_image: xcode8
env: OSX_DEPLOY="true" LINUX_DEPLOY="false" $TRAVIS_OS_NAME="osx"
branches:
only:
- master

7
README-mac.md

@ -22,13 +22,12 @@ brew tap discoteq/discoteq; brew install flock autoconf autogen automake gcc@6 b
Get all that installed, then run:
```shell
git clone https://github.com/VerusCoin/VerusCoin.git
cd VerusCoin
git clone https://github.com/MyHush/hush3
cd hush3
./zcutil/build-mac.sh
./zcutil/fetch-params.sh
```
To build a distributable version of VerusCoin then run the makeReleaseMac.sh script after building. This will fix the dependency references and move the komodod and komodo-cli binaries to the kmd/mac/verus-cli directory along with the 6 libraries required for it to work properly.
To build a distributable version of Hush then run the makeReleaseMac.sh script after building. This will fix the dependency references and move the komodod and komodo-cli binaries to the kmd/mac/verus-cli directory along with the 6 libraries required for it to work properly.
When you are done building, you need to create `Komodo.conf` the Mac way.

4
configure.ac

@ -1,9 +1,9 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_BUILD, 50)
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))
define(_CLIENT_VERSION_IS_RELEASE, true)

21
contrib/README.md

@ -1,7 +1,13 @@
*** Warning: This document has not been updated for Zcash and may be inaccurate. ***
# Hush Contrib
Wallet Tools
---------------------
This is mostly very old stuff inherited from Bitcoin and Zcash!
Do not expect all scripts to work!
Please fix bugs and report things you find.
## Wallet Tools
### [BitRPC](/contrib/bitrpc) ###
Allows for sending of all standard Bitcoin commands via RPC rather than as command line args.
@ -11,8 +17,7 @@ Allows for sending of all standard Bitcoin commands via RPC rather than as comma
Use the raw transactions API to send coins received on a particular
address (or addresses).
Repository Tools
---------------------
## Repository Tools
### [Developer tools](/contrib/devtools) ###
Specific tools for developers working on this repository.
@ -31,8 +36,7 @@ A Linux bash script that will set up traffic control (tc) to limit the outgoing
### [Seeds](/contrib/seeds) ###
Utility to generate the pnSeed[] array that is compiled into the client.
Build Tools and Keys
---------------------
## Build Tools and Keys
### [Debian](/contrib/debian) ###
Contains files used to package bitcoind/bitcoin-qt
@ -47,8 +51,7 @@ Various PGP files of core developers.
### [MacDeploy](/contrib/macdeploy) ###
Scripts and notes for Mac builds.
Test and Verify Tools
---------------------
## Test and Verify Tools
### [TestGen](/contrib/testgen) ###
Utilities to generate test vectors for the data-driven Bitcoin tests.

240
contrib/debian/changelog

@ -1,239 +1,5 @@
zcash (2.0.1) stable; urgency=medium
hush (3.2.0) stable; urgency=medium
* 2.0.1 release.
* 3.2.0.1 release.
-- Zcash Company <team@z.cash> Sun, 14 Oct 2018 13:40:30 -0700
zcash (2.0.1~rc1) stable; urgency=medium
* 2.0.1-rc1 release.
-- Zcash Company <team@z.cash> Mon, 08 Oct 2018 12:40:54 -0700
zcash (2.0.0) stable; urgency=medium
* 2.0.0 release.
-- Zcash Company <team@z.cash> Wed, 15 Aug 2018 17:57:50 -0700
zcash (2.0.0~rc1) stable; urgency=medium
* 2.0.0-rc1 release.
-- Zcash Company <team@z.cash> Thu, 09 Aug 2018 16:56:56 +0000
zcash (1.1.2) stable; urgency=medium
* 1.1.2 release.
-- Zcash Company <team@z.cash> Sun, 01 Jul 2018 20:12:33 -0700
zcash (1.1.2~rc1) stable; urgency=medium
* 1.1.2-rc1 release.
-- Zcash Company <team@z.cash> Fri, 22 Jun 2018 17:03:41 -0700
zcash (1.1.1) stable; urgency=medium
* 1.1.1 release.
-- Zcash Company <team@z.cash> Fri, 25 May 2018 15:49:34 +1200
zcash (1.1.1~rc2) stable; urgency=medium
* 1.1.1-rc2 release.
-- Zcash Company <team@z.cash> Wed, 23 May 2018 09:28:50 -0700
zcash (1.1.1~rc1) stable; urgency=medium
* 1.1.1-rc1 release.
-- Zcash Company <team@z.cash> Sat, 19 May 2018 10:16:14 +1200
zcash (1.1.0) stable; urgency=medium
* 1.1.0 release.
-- Zcash Company <team@z.cash> Wed, 11 Apr 2018 20:15:29 -0600
zcash (1.1.0~rc1) stable; urgency=medium
* 1.1.0-rc1 release.
-- Zcash Company <team@z.cash> Thu, 05 Apr 2018 03:26:17 +0100
zcash (1.0.15) stable; urgency=medium
* 1.0.15 release.
-- Zcash Company <team@z.cash> Wed, 28 Feb 2018 16:58:19 +0000
zcash (1.0.15~rc1) stable; urgency=medium
* 1.0.15-rc1 release.
-- Zcash Company <team@z.cash> Sat, 24 Feb 2018 04:20:05 +0000
zcash (1.0.14) stable; urgency=medium
* 1.0.14 release.
-- Zcash Company <team@z.cash> Wed, 03 Jan 2018 23:54:16 +0100
zcash (1.0.14~rc1) stable; urgency=medium
* 1.0.14-rc1 release.
-- Zcash Company <team@z.cash> Fri, 22 Dec 2017 10:12:41 +0000
zcash (1.0.13) stable; urgency=medium
* 1.0.13 release.
-- Zcash Company <team@z.cash> Mon, 20 Nov 2017 12:31:53 +0000
zcash (1.0.13~rc2) stable; urgency=medium
* 1.0.13-rc2 release.
-- Zcash Company <team@z.cash> Fri, 17 Nov 2017 18:01:08 +0000
zcash (1.0.13~rc1) stable; urgency=medium
* 1.0.13-rc1 release.
-- Zcash Company <team@z.cash> Wed, 15 Nov 2017 00:02:21 +0000
zcash (1.0.12) stable; urgency=medium
* 1.0.12 release.
-- Zcash Company <team@z.cash> Thu, 28 Sep 2017 01:26:44 +0100
zcash (1.0.12~rc1) stable; urgency=medium
* 1.0.12-rc1 release.
-- Zcash Company <team@z.cash> Sat, 23 Sep 2017 10:51:36 +0100
zcash (1.0.11) stable; urgency=medium
* 1.0.11 release.
-- Zcash Company <team@z.cash> Tue, 15 Aug 2017 10:06:25 +0100
zcash (1.0.11~rc1) stable; urgency=medium
* 1.0.11-rc1 release.
-- Zcash Company <team@z.cash> Tue, 01 Aug 2017 17:12:52 +0200
zcash (1.0.10+1) stable; urgency=medium
* 1.0.10-1 release.
-- Zcash Company <team@z.cash> Fri, 23 Jun 2017 19:50:41 -0700
zcash (1.0.10) stable; urgency=medium
* 1.0.10 release.
-- Zcash Company <team@z.cash> Thu, 22 Jun 2017 15:13:04 +1200
zcash (1.0.9) stable; urgency=medium
* 1.0.9 release.
-- Zcash Company <team@z.cash> Wed, 24 May 2017 12:51:06 -0700
zcash (1.0.8+1) jessie; urgency=high
* 1.0.8-1 release.
-- Zcash Company <team@z.cash> Thu, 13 Apr 2017 20:20:37 -0700
zcash (1.0.8) jessie; urgency=medium
* 1.0.8 release.
-- Zcash Company <team@z.cash> Mon, 27 Mar 2017 21:30:07 +0100
zcash (1.0.7+1) jessie; urgency=medium
* 1.0.7-1 release.
-- Zcash Company <team@z.cash> Wed, 08 Mar 2017 13:51:11 -0800
zcash (1.0.7) jessie; urgency=medium
* 1.0.7 release.
-- Zcash Company <team@z.cash> Fri, 03 Mar 2017 20:55:04 -0800
zcash (1.0.6) jessie; urgency=medium
* 1.0.6 release.
-- Zcash Company <team@z.cash> Fri, 10 Feb 2017 10:23:00 -0800
zcash (1.0.5) jessie; urgency=medium
* 1.0.5 release.
-- Zcash Company <team@z.cash> Thu, 19 Jan 2017 19:23:40 -0700
zcash (1.0.4) jessie; urgency=medium
* 1.0.4 release.
-- Zcash Company <team@z.cash> Thu, 15 Dec 2016 16:46:14 +1300
zcash (1.0.3) jessie; urgency=medium
* 1.0.3 release.
-- Zcash Company <team@z.cash> Wed, 17 Nov 2016 15:56:00 -0700
zcash (1.0.2) jessie; urgency=medium
* 1.0.2 release.
-- Zcash Company <team@z.cash> Mon, 07 Nov 2016 19:01:35 -0600
zcash (1.0.1) jessie; urgency=medium
* 1.0.1 release.
-- Zcash Company <team@z.cash> Thu, 03 Nov 2016 23:21:09 -0500
zcash (1.0.0-sprout) jessie; urgency=medium
* 1.0.0 release.
-- Zcash Company <team@z.cash> Fri, 28 Oct 2016 03:00:50 -0700
zcash (1.0.0-rc4) jessie; urgency=medium
* 1.0.0-rc4 release.
-- Zcash Company <team@z.cash> Thu, 27 Oct 2016 13:36:00 +0100
zcash (1.0.0-rc3) jessie; urgency=medium
* 1.0.0-rc3 release.
-- Zcash Company <team@z.cash> Wed, 26 Oct 2016 23:17:03 +0100
zcash (1.0.0-rc2) jessie; urgency=medium
* 1.0.0-rc2 release.
-- Zcash Company <team@z.cash> Sun, 23 Oct 2016 01:51:27 +0100
zcash (1.0.0-rc1) jessie; urgency=medium
* Initial packaging for Debian.
-- Zcash Company <team@z.cash> Mon, 17 Oct 2016 11:47:02 -0700
-- Hush Core <myhushteam@gmail.com> Sun, 14 Oct 2019 13:40:30 -0700

21
contrib/debian/control

@ -1,22 +1,17 @@
Source: VerusCoin
Source: Hush
Section: utils
Priority: optional
Maintainer: VerusCoin <team@z.cash>
Homepage: https://veruscoin.io
Maintainer: Hush <myhushteam@gmail.com>
Homepage: https://myhush.org
Build-Depends: autoconf, automake, bsdmainutils, build-essential,
git, g++-multilib, libc6-dev, libtool,
m4, ncurses-dev, pkg-config, python,
unzip, wget, zlib1g-dev
Vcs-Git: https://github.com/VeruscCoin/VerusCoin.git
Vcs-Browser: https://github.com/VerusCoin/VerusCoin
Vcs-Git: https://github.com/MyHush/hush3.git
Vcs-Browser: https://github.com/MyHush/hush3
Package: Verus-CLI
Package: hush
Architecture: amd64
Depends: ${shlibs:Depends}
Description: VerusCoin is a new, mineable and stakeable cryptocurrency.
It is a live fork of Komodo that retains its Zcash lineage and improves it.
VerusCoin will leverage the Komodo platform and dPoW notarization for enhanced security and cross-chain interoperability.
We have added a variation of a zawy12, lwma difficulty algorithm, a new CPU-optimized hash algorithm and a new algorithm for fair proof of stake.
We describe these changes and vision going forward in a [our Phase I white paper](http://185.25.51.16/papers/VerusPhaseI.pdf) and
[our Vision](http://185.25.51.16/papers/VerusVision.pdf).
Description: Hush cryptocoin full node. Speak And Transact Freely.
Hush inherits from Bitcoin Protocol and Zcash Protocol and is focused on private communications.

4
contrib/debian/copyright

@ -68,6 +68,10 @@ Files: src/secp256k1/build-aux/m4/ax_prog_cc_for_build.m4
Copyright: 2008 Paolo Bonzini <bonzini@gnu.org>
License: GNU-All-permissive-License
Files: depends/sources/utfcpp-*.tar.gz
Copyright: 2006 Nemanja Trifunovic
License: Boost-Software-License-1.0
License: Boost-Software-License-1.0
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by

140
contrib/debian/examples/HUSH3.conf

@ -0,0 +1,140 @@
##
## komodo.conf configuration file. Lines beginning with # are comments.
##
# Network-related settings:
# Run a regression test network
#regtest=0
# Connect via a SOCKS5 proxy
#proxy=127.0.0.1:9050
# Bind to given address and always listen on it. Use [host]:port notation for IPv6
#bind=<addr>
# Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6
#whitebind=<addr>
##############################################################
## Quick Primer on addnode vs connect ##
## Let's say for instance you use addnode=4.2.2.4 ##
## addnode will connect you to and tell you about the ##
## nodes connected to 4.2.2.4. In addition it will tell ##
## the other nodes connected to it that you exist so ##
## they can connect to you. ##
## connect will not do the above when you 'connect' to it. ##
## It will *only* connect you to 4.2.2.4 and no one else.##
## ##
## So if you're behind a firewall, or have other problems ##
## finding nodes, add some using 'addnode'. ##
## ##
## If you want to stay private, use 'connect' to only ##
## connect to "trusted" nodes. ##
## ##
## If you run multiple nodes on a LAN, there's no need for ##
## all of them to open lots of connections. Instead ##
## 'connect' them all to one node that is port forwarded ##
## and has lots of connections. ##
## Thanks goes to [Noodle] on Freenode. ##
##############################################################
# Use as many addnode= settings as you like to connect to specific peers
#addnode=69.164.218.197
#addnode=10.0.0.2:8233
# Alternatively use as many connect= settings as you like to connect ONLY to specific peers
#connect=69.164.218.197
#connect=10.0.0.1:8233
# Listening mode, enabled by default except when 'connect' is being used
#listen=1
# Maximum number of inbound+outbound connections.
#maxconnections=
#
# JSON-RPC options (for controlling a running Komodo/komodod process)
#
# server=1 tells komodod to accept JSON-RPC commands (set as default if not specified)
#server=1
# 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)
#rpcbind=<addr>
# You must set rpcuser and rpcpassword to secure the JSON-RPC api
#rpcuser=Ulysses
#rpcpassword=YourSuperGreatPasswordNumber_DO_NOT_USE_THIS_OR_YOU_WILL_GET_ROBBED_385593
# How many seconds komodo will wait for a complete RPC HTTP request.
# after the HTTP connection is established.
#rpcclienttimeout=30
# By default, only RPC connections from localhost are allowed.
# Specify as many rpcallowip= settings as you like to allow connections from other hosts,
# either as a single IPv4/IPv6 or with a subnet specification.
# NOTE: opening up the RPC port to hosts outside your local trusted network is NOT RECOMMENDED,
# because the rpcpassword is transmitted over the network unencrypted and also because anyone
# that can authenticate on the RPC port can steal your keys + take over the account running komodod
# For more information see https://github.com/zcash/zcash/issues/1497
#rpcallowip=10.1.1.34/255.255.255.0
#rpcallowip=1.2.3.4/24
#rpcallowip=2001:db8:85a3:0:0:8a2e:370:7334/96
# Listen for RPC connections on this TCP port:
#rpcport=8232
# You can use Komodo or komodod to send commands to Komodo/komodod
# running on another host using this option:
#rpcconnect=127.0.0.1
# Transaction Fee
# Send transactions as zero-fee transactions if possible (default: 0)
#sendfreetransactions=0
# Create transactions that have enough fees (or priority) so they are likely to # begin confirmation within n blocks (default: 1).
# This setting is overridden by the -paytxfee option.
#txconfirmtarget=n
# Miscellaneous options
# Enable attempt to mine komodo.
#gen=0
# Set the number of threads to be used for mining komodo (-1 = all cores).
#genproclimit=1
# Specify a different Equihash solver (e.g. "tromp") to try to mine komodo
# faster when gen=1.
#equihashsolver=default
# Pre-generate this many public/private key pairs, so wallet backups will be valid for
# both prior transactions and several dozen future transactions.
#keypool=100
# Pay an optional transaction fee every time you send komodo. Transactions with fees
# are more likely than free transactions to be included in generated blocks, so may
# be validated sooner. This setting does not affect private transactions created with
# 'z_sendmany'.
#paytxfee=0.00
#Rewind the chain to specific block height. This is useful for creating snapshots at a given block height.
#rewind=777777
#Stop the chain a specific block height. This is useful for creating snapshots at a given block height.
#stopat=1000000
#Set an address to use as change address for all transactions. This value must be set to a 33 byte pubkey. All mined coins will also be sent to this address.
#pubkey=027dc7b5cfb5efca96674b45e9fda18df069d040b9fd9ff32c35df56005e330392
#Forfeit all user rewards to miners. Set this to explicitly not claim user rewards.
#exchange=1
#Donate all user rewards to a a specific address. This value must be set to a 33 byte pubkey.
#donation=027dc7b5cfb5efca96674b45e9fda18df069d040b9fd9ff32c35df56005e330392

0
contrib/debian/zcash.examples → contrib/debian/hush.example

1
contrib/debian/zcash.install → contrib/debian/hush.install

@ -1,3 +1,2 @@
usr/bin/komodod
usr/bin/komodo-cli
usr/bin/zcash-fetch-params

2
contrib/debian/hush.manpages

@ -0,0 +1,2 @@
DEBIAN/manpages/hush-cli.1
DEBIAN/manpages/hushd.1

2
contrib/debian/zcash.manpages

@ -1,2 +0,0 @@
DEBIAN/manpages/zcash-cli.1
DEBIAN/manpages/zcashd.1

160
contrib/zcash-cli.bash-completion

@ -1,160 +0,0 @@
# bash programmable completion for zcash-cli(1)
# Copyright (c) 2012-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# call $zcash-cli for RPC
_zcash_rpc() {
# determine already specified args necessary for RPC
local rpcargs=()
for i in ${COMP_LINE}; do
case "$i" in
-conf=*|-datadir=*|-regtest|-rpc*|-testnet)
rpcargs=( "${rpcargs[@]}" "$i" )
;;
esac
done
$zcash_cli "${rpcargs[@]}" "$@"
}
# Add wallet accounts to COMPREPLY
_zcash_accounts() {
local accounts
# Accounts are deprecated in Zcash
#accounts=$(_zcash_rpc listaccounts | awk -F '"' '{ print $2 }')
accounts="\\\"\\\""
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$accounts" -- "$cur" ) )
}
_zcash_cli() {
local cur prev words=() cword
local zcash_cli
# save and use original argument to invoke zcash-cli for -help, help and RPC
# as zcash-cli might not be in $PATH
zcash_cli="$1"
COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword
if ((cword > 5)); then
case ${words[cword-5]} in
sendtoaddress)
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
return 0
;;
esac
fi
if ((cword > 4)); then
case ${words[cword-4]} in
importaddress|listtransactions|setban)
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
return 0
;;
signrawtransaction)
COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) )
return 0
;;
esac
fi
if ((cword > 3)); then
case ${words[cword-3]} in
addmultisigaddress)
_zcash_accounts
return 0
;;
getbalance|gettxout|importaddress|importpubkey|importprivkey|listreceivedbyaccount|listreceivedbyaddress|listsinceblock)
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
return 0
;;
esac
fi
if ((cword > 2)); then
case ${words[cword-2]} in
addnode)
COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) )
return 0
;;
setban)
COMPREPLY=( $( compgen -W "add remove" -- "$cur" ) )
return 0
;;
fundrawtransaction|getblock|getblockheader|getmempoolancestors|getmempooldescendants|getrawtransaction|gettransaction|listaccounts|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction)
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
return 0
;;
z_importkey|z_importviewingkey)
COMPREPLY=( $( compgen -W "yes no whenkeyisnew" -- "$cur" ) )
return 0
;;
move|setaccount)
_zcash_accounts
return 0
;;
esac
fi
case "$prev" in
backupwallet|dumpwallet|importwallet|z_exportwallet|z_importwallet)
_filedir
return 0
;;
getaddednodeinfo|getrawmempool|lockunspent|setgenerate)
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
return 0
;;
getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendfrom|sendmany)
_zcash_accounts
return 0
;;
esac
case "$cur" in
-conf=*)
cur="${cur#*=}"
_filedir
return 0
;;
-datadir=*)
cur="${cur#*=}"
_filedir -d
return 0
;;
-*=*) # prevent nonsense completions
return 0
;;
*)
local helpopts commands
# only parse -help if senseful
if [[ -z "$cur" || "$cur" =~ ^- ]]; then
helpopts=$($zcash_cli -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
fi
# only parse help if senseful
if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then
commands=$(_zcash_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }')
fi
COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) )
# Prevent space if an argument is desired
if [[ $COMPREPLY == *= ]]; then
compopt -o nospace
fi
return 0
;;
esac
} &&
complete -F _zcash_cli zcash-cli
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

57
contrib/zcash-tx.bash-completion

@ -1,57 +0,0 @@
# bash programmable completion for zcash-tx(1)
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
_zcash_tx() {
local cur prev words=() cword
local zcash_tx
# save and use original argument to invoke zcash-tx for -help
# it might not be in $PATH
zcash_tx="$1"
COMPREPLY=()
_get_comp_words_by_ref -n =: cur prev words cword
case "$cur" in
load=*:*)
cur="${cur#load=*:}"
_filedir
return 0
;;
*=*) # prevent attempts to complete other arguments
return 0
;;
esac
if [[ "$cword" == 1 || ( "$prev" != "-create" && "$prev" == -* ) ]]; then
# only options (or an uncompletable hex-string) allowed
# parse zcash-tx -help for options
local helpopts
helpopts=$($zcash_tx -help | sed -e '/^ -/ p' -e d )
COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
else
# only commands are allowed
# parse -help for commands
local helpcmds
helpcmds=$($zcash_tx -help | sed -e '1,/Commands:/d' -e 's/=.*/=/' -e '/^ [a-z]/ p' -e d )
COMPREPLY=( $( compgen -W "$helpcmds" -- "$cur" ) )
fi
# Prevent space if an argument is desired
if [[ $COMPREPLY == *= ]]; then
compopt -o nospace
fi
return 0
} &&
complete -F _zcash_tx zcash-tx
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

57
contrib/zcashd.bash-completion

@ -1,57 +0,0 @@
# bash programmable completion for zcashd(1)
# Copyright (c) 2012-2017 The Bitcoin Core developers
# Copyright (c) 2016-2017 The Zcash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
_zcashd() {
local cur prev words=() cword
local zcashd
# save and use original argument to invoke zcashd for -help
# it might not be in $PATH
zcashd="$1"
COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword
case "$cur" in
-conf=*|-pid=*|-loadblock=*|-rpccookiefile=*|-wallet=*)
cur="${cur#*=}"
_filedir
return 0
;;
-datadir=*|-exportdir=*)
cur="${cur#*=}"
_filedir -d
return 0
;;
-*=*) # prevent nonsense completions
return 0
;;
*)
# only parse -help if senseful
if [[ -z "$cur" || "$cur" =~ ^- ]]; then
local helpopts
helpopts=$($zcashd -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
fi
# Prevent space if an argument is desired
if [[ $COMPREPLY == *= ]]; then
compopt -o nospace
fi
return 0
;;
esac
} &&
complete -F _zcashd zcashd
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

4
depends/packages/packages.mk

@ -1,10 +1,10 @@
rust_packages := rust librustzcash
ifeq ($(build_os),darwin)
zcash_packages := libsnark libgmp libsodium
zcash_packages := libsnark libgmp libsodium utfcpp
else
proton_packages := proton
zcash_packages := libgmp libsodium
zcash_packages := libgmp libsodium utfcpp
endif
rust_crates := \

9
depends/packages/utfcpp.mk

@ -0,0 +1,9 @@
$(package)_version=3.1
$(package)_download_path=https://github.com/nemtrif/$(package)/archive/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_download_file=v$($(package)_version).tar.gz
$(package)_sha256_hash=ab531c3fd5d275150430bfaca01d7d15e017a188183be932322f2f651506b096
define $(package)_stage_cmds
cp -a ./source $($(package)_staging_dir)$(host_prefix)/include
endef

6
doc/man/komodo-cli.1

@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH KOMODO-CLI "1" "June 2019" "komodo-cli v3.0.0" "User Commands"
.TH KOMODO-CLI "1" "October 2019" "komodo-cli v3.2.0" "User Commands"
.SH NAME
komodo-cli \- manual page for komodo-cli v3.0.0
komodo-cli \- manual page for komodo-cli v3.2.0
.SH DESCRIPTION
Komodo RPC client version v3.0.0\-beta2\-ab9d87166\-dirty
Komodo RPC client version v3.2.0\-61917057d\-dirty
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.

10
doc/man/komodo-tx.1

@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH KOMODO-TX "1" "June 2019" "komodo-tx v3.0.0" "User Commands"
.TH KOMODO-TX "1" "October 2019" "komodo-tx v3.2.0" "User Commands"
.SH NAME
komodo-tx \- manual page for komodo-tx v3.0.0
komodo-tx \- manual page for komodo-tx v3.2.0
.SH DESCRIPTION
Zcash zcash\-tx utility version v3.0.0\-beta2\-ab9d87166\-dirty
Hush komodo\-tx utility version v3.2.0\-61917057d\-dirty
.SS "Usage:"
.TP
zcash\-tx [options] <hex\-tx> [commands]
komodo\-tx [options] <hex\-tx> [commands]
Update hex\-encoded zcash transaction
.TP
zcash\-tx [options] \fB\-create\fR [commands]
komodo\-tx [options] \fB\-create\fR [commands]
Create hex\-encoded zcash transaction
.SH OPTIONS
.HP

6
doc/man/komodod.1

@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH KOMODOD "1" "June 2019" "komodod v3.0.0" "User Commands"
.TH KOMODOD "1" "October 2019" "komodod v3.2.0" "User Commands"
.SH NAME
komodod \- manual page for komodod v3.0.0
komodod \- manual page for komodod v3.2.0
.SH DESCRIPTION
Komodo Daemon version v3.0.0\-beta2\-ab9d87166\-dirty
Komodo Daemon version v3.2.0\-61917057d\-dirty
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://myhush.org/security/>.

13
doc/man/verus-cli/linux/README.txt

@ -1,13 +0,0 @@
VerusCoin Command Line Tools v0.4.0c
Contents:
komodod - VerusCoin's enhanced Komodo daemon
komodo-cli - VerusCoin's Komodo command line utility
verus - wrapper for komodo-cli that applies the command to the VRSC coin
verusd - wrapper for komodod that sets the VerusCoin parameters to defaults properly
The first time on a new system you will need to run ./fetch-params before using komodod or verusd.
Run ./verusd to launch komodod, and use verus to run commands such as:
./verus stop
Which signals komodod (if it is running) to stop running.

17
doc/man/verus-cli/mac/README.txt

@ -1,17 +0,0 @@
VerusCoin Command Line Tools v0.4.0c
Contents:
komodod - VerusCoin's enhanced Komodo daemon.
komodo-cli - VerusCoin's enhanced Komodo command line utility.
verus - wrapper for komodo-cli that applies the command to the VRSC coin
verusd - wrapper for komodod that sets the VerusCoin parameters to defaults properly
fetch_params.sh - utility to download the zcash parameters needed to start the VerusCoin command line tools and scripts
lib*.dylib - assorted dynamic libraries, dependencies needed by fetch-params.sh, komodod and/or komodo-cli
Command line tools are run from the terminal. You can launch the terminal on a Mac by using the Finder, selecting Applications and from that select Utilities, finally selecting Terminal from the Utilities folder.
You will need to switch to the directory you extracted the verus-cl into. If you extracted it in the Download folder then the change directory command is
cd ~/Downloads/verus-cli
The first time on a new system you will need to run ./fetch-params before using komodod or verusd.
Run ./verusd to launch komodod, and use verus to run commands such as:
./verus stop
Which signals komodod (if it is running) to stop running.

21
doc/man/verus-cli/windows/README.txt

@ -1,21 +0,0 @@
VerusCoin Command Line Tools v0.4.0c
Contents:
komodod.exe - VerusCoin's enhanced Komodo daemon
komodo-cli.exe - VerusCoin's Komodo command line utility
verus.bat - wrapper for komodo-cli that applies the command to the VRSC coin
verusd.bat - wrapper for komodod that sets the VerusCoin parameters to defaults properly
You need to run a command prompt, for example hit <Ctrl><Esc> and type cmd<Enter>
From the command prompt change to the directory where you installed verus-cli. If you downloaded the file to your Downloads directory and extracted it there then the change directory command is
cd \Users\MyName\Downloads\verus-cli
From this directory you can run the Verus command line utilities.
The first time on a new system you will need to run fetch-params before using komodod.exe or verusd.
Many anti-virus products interfere with the VerusCoin tool's ability to open ports and will need to be configured to allow what the scanner says is unsafe behavior.
Extreme cases can result in the virus scanner deleting Agama.exe or moving it to "protect" the system. You will to add the executables to a whitelist and re-extract the verus-cli-windows.zip file if that happens.
Run verusd.bat to launch komodod, and use verus.bat to run commands such as:
verus.bat stop
Which signals komodod.exe (if it is running) to stop running.
Note that if you pass in command line options to verus.bat or verusd.bat that include an = like -ac_veruspos=50 you must surround it with double quotes like this:
verusd.bat "-ac_veruspos=50"
Otherwise Windows will drop the = and pass the two values in as separate command line options.

88
doc/man/zcash-cli.1

@ -1,88 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3.
.TH ZCASH-CLI "1" "October 2018" "zcash-cli v2.0.1" "User Commands"
.SH NAME
zcash-cli \- manual page for zcash-cli v2.0.1
.SH DESCRIPTION
Zcash RPC client version v2.0.1
.PP
In order to ensure you are adequately protecting your privacy when using Zcash,
please see <https://z.cash/support/security/>.
.SS "Usage:"
.TP
zcash\-cli [options] <command> [params]
Send command to Zcash
.TP
zcash\-cli [options] help
List commands
.TP
zcash\-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: zcash.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 Zcash,
please see <https://z.cash/support/security/>.
Copyright (C) 2009-2017 The Bitcoin Core Developers
Copyright (C) 2015-2017 The Zcash 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.

28
doc/man/zcash-fetch-params.1

@ -1,28 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3.
.TH ZCASH-FETCH-PARAMS "1" "January 2017" "Zcash - zcash-fetch-params" "User Commands"
.SH NAME
zcash-fetch-params \- Downloads the Zcash network parameters
.SH DESCRIPTION
Zcash \- zcash-fetch\-params
.PP
This script will fetch the Zcash zkSNARK parameters and verify their
integrity with sha256sum.
.PP
If they already exist locally, it will exit now and do nothing else.
.PP
This script will fetch the Zcash zkSNARK parameters and verify their
integrity with sha256sum.
.PP
If they already exist locally, it will exit now and do nothing else.
.SH "SEE ALSO"
The full documentation for
.B Zcash
is maintained as a Texinfo manual. If the
.B info
and
.B Zcash
programs are properly installed at your site, the command
.IP
.B info Zcash
.PP
should give you access to the complete manual.

101
doc/man/zcash-tx.1

@ -1,101 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3.
.TH ZCASH-TX "1" "October 2018" "zcash-tx v2.0.1" "User Commands"
.SH NAME
zcash-tx \- manual page for zcash-tx v2.0.1
.SH DESCRIPTION
Zcash zcash\-tx utility version v2.0.1
.SS "Usage:"
.TP
zcash\-tx [options] <hex\-tx> [commands]
Update hex\-encoded zcash transaction
.TP
zcash\-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 Zcash,
please see <https://z.cash/support/security/>.
Copyright (C) 2009-2017 The Bitcoin Core Developers
Copyright (C) 2015-2017 The Zcash 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.

483
doc/man/zcashd.1

@ -1,483 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3.
.TH ZCASHD "1" "October 2018" "zcashd v2.0.1" "User Commands"
.SH NAME
zcashd \- manual page for zcashd v2.0.1
.SH DESCRIPTION
Zcash Daemon version v2.0.1
.PP
In order to ensure you are adequately protecting your privacy when using Zcash,
please see <https://z.cash/support/security/>.
.SS "Usage:"
.TP
zcashd [options]
Start Zcash 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\-conf=\fR<file>
.IP
Specify configuration file (default: zcash.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\-4\fR to 16, 0 = auto, <0 =
leave that many cores free, default: 0)
.HP
\fB\-pid=\fR<file>
.IP
Specify pid file (default: zcashd.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)
.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: 125)
.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: 8233 or testnet: 18233)
.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 ZEC/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: 20)
.HP
\fB\-maxtxfee=\fR<amt>
.IP
Maximum total fees (in ZEC) 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\-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 ZEC/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: 80)
.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\-gen\fR
.IP
Generate coins (default: 0)
.HP
\fB\-genproclimit=\fR<n>
.IP
Set the number of threads for coin generation if enabled (\fB\-1\fR = all
cores, default: 1)
.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: 8232 or testnet:
18232)
.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)
.SH COPYRIGHT
In order to ensure you are adequately protecting your privacy when using Zcash,
please see <https://z.cash/support/security/>.
Copyright (C) 2009-2017 The Bitcoin Core Developers
Copyright (C) 2015-2017 The Zcash 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.

10
makeReleaseMac.sh

@ -1,12 +1,16 @@
#!/bin/sh
#!/bin/bash
# Copyright ? various authors too lazy to put a copyright header
# Copyright 2019 The Hush Developers
PACKAGE_DIR="$@"
mkdir ${PACKAGE_DIR}
echo "Created ${PACKAGE_DIR}"
binaries=("komodo-cli" "komodod")
alllibs=()
for binary in "${binaries[@]}";
do
echo "Processing binary ${binary}"
# do the work in the destination directory
cp src/${binary} ${PACKAGE_DIR}
# find the dylibs to copy for komodod
@ -20,6 +24,7 @@ libraries=("libgcc_s.1.dylib" "libgomp.1.dylib" "libidn2.0.dylib" "libstdc++.6.d
for binary in "${libraries[@]}";
do
echo "Processing binary ${binary}"
# find the dylibs to copy for komodod
DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying ${DYLIBS} to ${PACKAGE_DIR}"
@ -31,6 +36,7 @@ indirectlibraries=("libintl.8.dylib" "libunistring.2.dylib")
for binary in "${indirectlibraries[@]}";
do
echo "Processing binary ${binary}"
# Need to undo this for the dylibs when we are done
chmod 755 src/${binary}
# find the dylibs to copy for komodod
@ -42,6 +48,7 @@ done
for binary in "${binaries[@]}";
do
echo "Processing binary ${binary}"
# modify komodod to point to dylibs
echo "modifying ${binary} to use local libraries"
for dylib in "${alllibs[@]}"
@ -54,6 +61,7 @@ done
for binary in "${libraries[@]}";
do
echo "Processing binary ${binary}"
# modify libraries to point to dylibs
echo "modifying ${binary} to use local libraries"
for dylib in "${alllibs[@]}"

9072
patches

File diff suppressed because it is too large

10
qa/rpc-tests/test_framework/util.py

@ -56,7 +56,7 @@ def sync_blocks(rpc_connections, wait=1):
def sync_mempools(rpc_connections, wait=1):
"""
Wait until everybody has the same transactions in their memory
pools
pools, and has notified all internal listeners of them
"""
while True:
pool = set(rpc_connections[0].getrawmempool())
@ -68,6 +68,14 @@ def sync_mempools(rpc_connections, wait=1):
break
time.sleep(wait)
# Now that the mempools are in sync, wait for the internal
# notifications to finish
while True:
notified = [ x.getmempoolinfo()['fullyNotified'] for x in rpc_connections ]
if notified == [ True ] * len(notified):
break
time.sleep(wait)
bitcoind_processes = {}
def initialize_datadir(dirname, n):

2
src/ac/coqui

@ -1,2 +0,0 @@
#!/bin/bash
./komodo-cli -ac_name=COQUI $1 $2 $3 $4 $5 $6

2
src/ac/coquicash

@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=COQUICASH $1 $2 $3 $4 $5 $6

2
src/ac/thc

@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=THC $1 $2 $3 $4 $5 $6

32
src/assetchains.json

@ -84,14 +84,6 @@
"ac_name": "BTCH",
"ac_supply": "20998641"
},
{
"ac_name": "PIZZA",
"ac_supply": "100000000"
},
{
"ac_name": "BEER",
"ac_supply": "100000000"
},
{
"ac_name": "NINJA",
"ac_supply": "100000000"
@ -117,10 +109,6 @@
"ac_name": "DSEC",
"ac_supply": "7000000"
},
{
"ac_name": "GLXT",
"ac_supply": "10000000000"
},
{
"ac_name": "EQL",
"ac_supply": "500000000",
@ -299,5 +287,25 @@
"136.243.227.142",
"5.9.224.250"
]
},
{
"ac_name": "THC",
"ac_supply": "251253103",
"ac_reward": "360000000,300000000,240000000,180000000,150000000,90000000,0",
"ac_staked": "100",
"ac_eras": "7",
"ac_end": "500001,1000001,1500001,2000001,2500001,4500001,0",
"ac_perc": "233333333",
"ac_cc": "2",
"ac_ccenable": "229,236,240",
"ac_script": "2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401ccb8",
"ac_founders": "150",
"ac_cbmaturity": "1",
"ac_sapling": "1",
"earlytxid": "7e4a76259e99c9379551389e9f757fc5f46c33ae922a8644dc2b187af2a6adc1",
"addnode": [
"157.230.45.184",
"165.22.52.123"
]
}
]

12
src/assetchains.old

@ -15,7 +15,7 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=MSHARK -ac_supply=1400000 -addnode=95.213.238.98 $1 &
./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=95.213.238.98 $1 &
./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=95.213.238.98 $1 &
./komodod -pubkey=$pubkey -ac_name=COQUI -ac_supply=72000000 -ac_ccactivate=200000 -addnode=95.213.238.98 $1 &
./komodod -pubkey=$pubkey -ac_name=COQUICASH -ac_supply=72000000 -ac_reward=7200000000 -ac_staked=50 -ac_halving=420000 -ac_cc=2 -ac_ccenable=227,235,236,241 -addnode=78.47.108.168 &
./komodod -pubkey=$pubkey -ac_name=WLC -ac_supply=210000000 -addnode=95.213.238.98 $1 &
./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=95.213.238.98 $1 &
./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=95.213.238.98 $1 &
@ -23,15 +23,15 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -ac_ccactivate=130000 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=BEER -ac_supply=100000000 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=PIZZA -ac_supply=100000000 -addnode=95.213.238.98 &
#./komodod -pubkey=$pubkey -ac_name=BEER -ac_supply=100000000 -addnode=95.213.238.98 &
#./komodod -pubkey=$pubkey -ac_name=PIZZA -ac_supply=100000000 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=NINJA -ac_supply=100000000 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=OOT -ac_supply=216000000 -ac_sapling=5000000 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=BNTN -ac_supply=500000000 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=CHAIN -ac_supply=999999 -addnode=95.213.238.98 &
./komodod -pubkey=$pubkey -ac_name=PRLPAY -ac_supply=500000000 -addnode=13.250.226.125 &
./komodod -pubkey=$pubkey -ac_name=DSEC -ac_supply=7000000 -addnode=185.148.147.30 &
./komodod -pubkey=$pubkey -ac_name=GLXT -ac_supply=10000000000 -addnode=13.230.224.15 &
#./komodod -pubkey=$pubkey -ac_name=GLXT -ac_supply=10000000000 -addnode=13.230.224.15 &
./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -ac_ccactivate=205000 -addnode=46.101.124.153 &
./komodod -pubkey=$pubkey -ac_name=ZILLA -ac_supply=11000000 -ac_sapling=5000000 -addnode=51.68.215.104 &
./komodod -pubkey=$pubkey -ac_name=RFOX -ac_supply=1000000000 -ac_reward=100000000 -addnode=95.213.238.98 &
@ -48,8 +48,12 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=ILN -ac_supply=10000000000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=51.75.122.83 &
./komodod -pubkey=$pubkey -ac_name=RICK -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=95.217.44.58 -addnode=138.201.136.145 &
./komodod -pubkey=$pubkey -ac_name=MORTY -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=95.217.44.58 -addnode=138.201.136.145 &
<<<<<<< HEAD
./komodod -pubkey=$pubkey -ac_name=VOTE2019 -ac_supply=123651638 -ac_public=1 -addnode=95.213.238.98 &
=======
>>>>>>> beta
./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 &
./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 &
./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 &
./komodod -pubkey=$pubkey -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=188.165.212.101 -addnode=136.243.227.142 -addnode=5.9.224.250 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac &
./komodod -pubkey=$pubkey -ac_name=THC -ac_supply=251253103 -ac_reward=360000000,300000000,240000000,180000000,150000000,90000000,0 -ac_staked=100 -ac_eras=7 -ac_end=500001,1000001,1500001,2000001,2500001,4500001,0 -ac_perc=233333333 -ac_cc=2 -ac_ccenable=229,236,240 -ac_script=2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401ccb8 -ac_founders=150 -ac_cbmaturity=1 -ac_sapling=1 -addnode=157.230.45.184 -addnode=165.22.52.123 -earlytxid=7e4a76259e99c9379551389e9f757fc5f46c33ae922a8644dc2b187af2a6adc1 &

23
src/bitcoind.cpp

@ -170,19 +170,17 @@ bool AppInit(int argc, char* argv[])
try
{
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
if (!SelectParamsFromCommandLine()) {
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
return false;
}
void komodo_args(char *argv0);
komodo_args(argv[0]);
void chainparams_commandline();
chainparams_commandline();
fprintf(stderr,"call komodo_args.(%s) NOTARY_PUBKEY.(%s)\n",argv[0],NOTARY_PUBKEY.c_str());
while ( ASSETCHAIN_INIT == 0 )
{
//if ( komodo_is_issuer() != 0 )
// komodo_passport_iteration();
#ifdef _WIN32
boost::this_thread::sleep_for(boost::chrono::seconds(1));
#else
sleep(1);
#endif
}
printf("initialized %s at %u\n",ASSETCHAINS_SYMBOL,(uint32_t)time(NULL));
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
@ -214,11 +212,6 @@ bool AppInit(int argc, char* argv[])
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
return false;
}
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
if (!SelectParamsFromCommandLine()) {
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
return false;
}
// Command-line RPC
bool fCommandLine = false;

2
src/cc/CCinclude.h

@ -292,7 +292,7 @@ extern std::vector<CPubKey> NULL_pubkeys;
std::string FinalizeCCTx(uint64_t skipmask,struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey mypk,uint64_t txfee,CScript opret,std::vector<CPubKey> pubkeys = NULL_pubkeys);
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool CCflag = true);
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool CCflag = true);
void SetCCtxids_NSPV(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool ccflag, uint8_t evalcode, uint256 filtertxid);
void SetCCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_t evalcode, uint256 filtertxid, uint8_t func);
int64_t NSPV_AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs,struct NSPV_CCmtxinfo *ptr);
int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs);
int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinputs);

8
src/cc/CCtokens.cpp

@ -1026,7 +1026,7 @@ UniValue TokenInfo(uint256 tokenid)
UniValue TokenList()
{
UniValue result(UniValue::VARR);
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
std::vector<uint256> txids;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > addressIndexCCMarker;
struct CCcontract_info *cp, C; uint256 txid, hashBlock;
@ -1043,9 +1043,9 @@ UniValue TokenList()
}
};
SetCCtxids(addressIndex, cp->normaladdr,false); // find by old normal addr marker
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it = addressIndex.begin(); it != addressIndex.end(); it++) {
addTokenId(it->first.txhash);
SetCCtxids(txids, cp->normaladdr,false,cp->evalcode,zeroid,'c'); // find by old normal addr marker
for (std::vector<uint256>::const_iterator it = txids.begin(); it != txids.end(); it++) {
addTokenId(*it);
}
SetCCunspents(addressIndexCCMarker, cp->unspendableCCaddr,true); // find by burnable validated cc addr marker

24
src/cc/CCtx.cpp

@ -340,7 +340,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
void NSPV_CCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag);
void NSPV_CCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &txids,char *coinaddr,bool ccflag);
void NSPV_CCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &txids,char *coinaddr,bool ccflag,uint8_t evalcode,uint256 filtertxid);
void NSPV_CCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_t evalcode,uint256 filtertxid, uint8_t func);
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag)
{
@ -390,14 +390,30 @@ void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex
}
}
void SetCCtxids_NSPV(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool ccflag, uint8_t evalcode, uint256 filtertxid)
void SetCCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_t evalcode, uint256 filtertxid, uint8_t func)
{
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
if ( KOMODO_NSPV_SUPERLITE )
{
NSPV_CCtxids(addressIndex,coinaddr,ccflag,evalcode,filtertxid);
NSPV_CCtxids(txids,coinaddr,ccflag,evalcode,filtertxid,func);
return;
}
else SetCCtxids(addressIndex,coinaddr,ccflag);
n = (int32_t)strlen(coinaddr);
addrstr.resize(n+1);
ptr = (char *)addrstr.data();
for (i=0; i<=n; i++)
ptr[i] = coinaddr[i];
CBitcoinAddress address(addrstr);
if ( address.GetIndexKey(hashBytes, type, ccflag) == 0 )
return;
addresses.push_back(std::make_pair(hashBytes,type));
for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++)
{
if ( GetAddressIndex((*it).first, (*it).second, addressIndex) == 0 )
return;
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it1=addressIndex.begin(); it1!=addressIndex.end(); it1++) txids.push_back(it1->first.txhash);
}
}
int64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout,int32_t CCflag)

10
src/cc/CCutils.cpp

@ -664,6 +664,16 @@ uint256 BitcoinGetProofMerkleRoot(const std::vector<uint8_t> &proofData, std::ve
return merkleBlock.txn.ExtractMatches(txids);
}
extern struct NSPV_inforesp NSPV_inforesult;
int32_t komodo_get_current_height()
{
if ( KOMODO_NSPV_SUPERLITE )
{
return (NSPV_inforesult.height);
}
else return chainActive.LastTip()->GetHeight();
}
bool komodo_txnotarizedconfirmed(uint256 txid)
{
char str[65];

20
src/cc/channels.cpp

@ -787,22 +787,20 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid)
UniValue ChannelsList()
{
UniValue result(UniValue::VOBJ); std::vector<std::pair<CAddressIndexKey, CAmount> > txids; struct CCcontract_info *cp,C; uint256 txid,hashBlock,tmp_txid,param3,tokenid;
UniValue result(UniValue::VOBJ); std::vector<uint256> txids; struct CCcontract_info *cp,C; uint256 txid,hashBlock,tmp_txid,param3,tokenid;
CTransaction tx; char myCCaddr[65],addr[65],str[256]; CPubKey mypk,srcpub,destpub; int32_t vout,numvouts,param1;
int64_t nValue,param2;
cp = CCinit(&C,EVAL_CHANNELS);
mypk = pubkey2pk(Mypubkey());
GetCCaddress(cp,myCCaddr,mypk);
SetCCtxids(txids,myCCaddr,true);
SetCCtxids(txids,myCCaddr,true,EVAL_CHANNELS,zeroid,'O');
result.push_back(Pair("result","success"));
result.push_back(Pair("name","Channels List"));
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
vout = (int32_t)it->first.index;
nValue = (int64_t)it->second;
if ( (vout == 1 || vout == 2) && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 )
txid = *it;
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 )
{
if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3) == 'O')
{
@ -820,7 +818,7 @@ UniValue ChannelsInfo(uint256 channeltxid)
UniValue result(UniValue::VOBJ),array(UniValue::VARR); CTransaction tx,opentx; uint256 txid,tmp_txid,hashBlock,param3,opentxid,hashchain,tokenid;
struct CCcontract_info *cp,C; char CCaddr[65],addr[65],str[512]; int32_t vout,numvouts,param1,numpayments;
int64_t param2,payment; CPubKey srcpub,destpub,mypk;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; std::vector<CTransaction> txs;
std::vector<uint256> txids; std::vector<CTransaction> txs;
cp = CCinit(&C,EVAL_CHANNELS);
mypk = pubkey2pk(Mypubkey());
@ -846,10 +844,10 @@ UniValue ChannelsInfo(uint256 channeltxid)
result.push_back(Pair("Amount (satoshi)",i64tostr(param1*param2)));
}
GetCCaddress(cp,CCaddr,mypk);
SetCCtxids_NSPV(addressIndex,CCaddr,true,EVAL_CHANNELS,opentxid);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,CCaddr,true,EVAL_CHANNELS,channeltxid,0);
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
if (myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && it->second==CC_MARKER_VALUE &&
if (myGetTransaction(*it,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 &&
DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3)!=0 && (tmp_txid==channeltxid || tx.GetHash()==channeltxid))
txs.push_back(tx);
}

17
src/cc/dice.cpp

@ -1224,9 +1224,9 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit
bool DicePlanExists(CScript &fundingPubKey,uint256 &fundingtxid,struct CCcontract_info *cp,uint64_t refsbits,CPubKey dicepk,int64_t &minbet,int64_t &maxbet,int64_t &maxodds,int64_t &timeoutblocks)
{
char CCaddr[64]; uint64_t sbits=0; uint256 txid,hashBlock; CTransaction tx;
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
std::vector<uint256> txids;
GetCCaddress(cp,CCaddr,dicepk);
SetCCtxids(txids,cp->normaladdr,false);
SetCCtxids(txids,cp->normaladdr,false,cp->evalcode,zeroid,'F');
if ( fundingtxid != zeroid ) // avoid scan unless creating new funding plan
{
//fprintf(stderr,"check fundingtxid\n");
@ -1240,10 +1240,9 @@ bool DicePlanExists(CScript &fundingPubKey,uint256 &fundingtxid,struct CCcontrac
} else fprintf(stderr,"couldnt get funding tx\n");
return(false);
}
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
//int height = it->first.blockHeight;
txid = it->first.txhash;
txid = *it;
if ( fundingtxid != zeroid && txid != fundingtxid )
continue;
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 && ConstrainVout(tx.vout[0],1,CCaddr,0) != 0 )
@ -1320,12 +1319,12 @@ UniValue DiceInfo(uint256 diceid)
UniValue DiceList()
{
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction vintx; uint64_t sbits; int64_t minbet,maxbet,maxodds,timeoutblocks; char str[65];
UniValue result(UniValue::VARR); std::vector<uint256> txids; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction vintx; uint64_t sbits; int64_t minbet,maxbet,maxodds,timeoutblocks; char str[65];
cp = CCinit(&C,EVAL_DICE);
SetCCtxids(addressIndex,cp->normaladdr,false);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,cp->normaladdr,false,cp->evalcode,zeroid,'F');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
{
if ( vintx.vout.size() > 0 && DecodeDiceFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,minbet,maxbet,maxodds,timeoutblocks) != 0 )

8
src/cc/dilithium.c

@ -3580,16 +3580,16 @@ int32_t dilithium_registrationpub33(char *pkaddr,CPubKey &pub33,uint256 txid)
void dilithium_handleinit(struct CCcontract_info *cp)
{
static int32_t didinit;
std::vector<std::pair<CAddressIndexKey, CAmount> > txids; struct dilithium_handle *hashstr; CPubKey dilithiumpk,pub33; uint256 txid,hashBlock; CTransaction txi; int32_t numvouts; std::vector<uint8_t> bigpub; std::string handle; char CCaddr[64];
std::vector<uint256> txids; struct dilithium_handle *hashstr; CPubKey dilithiumpk,pub33; uint256 txid,hashBlock; CTransaction txi; int32_t numvouts; std::vector<uint8_t> bigpub; std::string handle; char CCaddr[64];
if ( didinit != 0 )
return;
pthread_mutex_init(&DILITHIUM_MUTEX,NULL);
dilithiumpk = GetUnspendable(cp,0);
GetCCaddress(cp,CCaddr,dilithiumpk);
SetCCtxids(txids,CCaddr,true);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
SetCCtxids(txids,CCaddr,true,cp->evalcode,zeroid,'R');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,txi,hashBlock) != 0 && (numvouts= txi.vout.size()) > 1 )
{
if ( dilithium_registeropretdecode(handle,pub33,bigpub,txi.vout[numvouts-1].scriptPubKey) == 'R' )

24
src/cc/gamescc.cpp

@ -1664,29 +1664,25 @@ UniValue games_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
UniValue games_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
{
UniValue result(UniValue::VOBJ),a(UniValue::VARR),b(UniValue::VARR); uint256 txid,hashBlock,gametxid,tokenid,playertxid; int32_t vout,maxplayers,gameheight,numvouts; CPubKey gamespk,mypk; char coinaddr[64]; CTransaction tx,gametx; int64_t buyin;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
std::vector<uint256> txids;
gamespk = GetUnspendable(cp,0);
mypk = pubkey2pk(Mypubkey());
GetCCaddress1of2(cp,coinaddr,gamespk,mypk);
SetCCtxids(addressIndex,coinaddr,true);
SetCCtxids(txids,coinaddr,true,cp->evalcode,zeroid,'R');
games_univalue(result,"games",-1,-1);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
vout = (int32_t)it->first.index;
txid = *it;
//char str[65]; fprintf(stderr,"%s check %s/v%d %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN);
if ( vout == 0 )
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 )
{
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 )
if ( games_registeropretdecode(gametxid,tokenid,playertxid,tx.vout[numvouts-1].scriptPubKey) == 'R' )
{
if ( games_registeropretdecode(gametxid,tokenid,playertxid,tx.vout[numvouts-1].scriptPubKey) == 'R' )
if ( games_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,gametxid,0) == 0 )
{
if ( games_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,gametxid,0) == 0 )
{
if ( CCgettxout(txid,vout,1,0) < 0 )
b.push_back(gametxid.GetHex());
else a.push_back(gametxid.GetHex());
}
if ( CCgettxout(txid,vout,1,0) < 0 )
b.push_back(gametxid.GetHex());
else a.push_back(gametxid.GetHex());
}
}
}

18
src/cc/gateways.cpp

@ -481,13 +481,13 @@ int32_t GatewaysBindExists(struct CCcontract_info *cp,CPubKey gatewayspk,uint256
{
char markeraddr[64],depositaddr[64]; std::string coin; int32_t numvouts; int64_t totalsupply; uint256 tokenid,oracletxid,hashBlock;
uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys; CTransaction tx;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
std::vector<uint256> txids;
_GetCCaddress(markeraddr,EVAL_GATEWAYS,gatewayspk);
SetCCtxids(addressIndex,markeraddr,true);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,markeraddr,true,EVAL_GATEWAYS,zeroid,'B');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
if ( myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey)=='B' )
if ( myGetTransaction(*it,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey)=='B' )
{
if ( DecodeGatewaysBindOpRet(depositaddr,tx.vout[numvouts-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) == 'B' )
{
@ -1114,6 +1114,8 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui
if ( CCchange != 0 ) mtx.vout.push_back(MakeTokensCC1vout(EVAL_GATEWAYS,CCchange,gatewayspk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysClaimOpRet('C',tokenid,bindtxid,refcoin,deposittxid,destpub,amount)));
}
CCerror = strprintf("cant find enough tokens in gateways address for given amount");
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
return("");
}
@ -1677,12 +1679,12 @@ UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin)
UniValue GatewaysList()
{
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock,oracletxid,tokenid; CTransaction vintx; std::string coin; int64_t totalsupply; char str[65],depositaddr[64]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
UniValue result(UniValue::VARR); std::vector<uint256> txids; struct CCcontract_info *cp,C; uint256 txid,hashBlock,oracletxid,tokenid; CTransaction vintx; std::string coin; int64_t totalsupply; char str[65],depositaddr[64]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
cp = CCinit(&C,EVAL_GATEWAYS);
SetCCtxids(addressIndex,cp->unspendableCCaddr,true);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,cp->unspendableCCaddr,true,EVAL_GATEWAYS,zeroid,'B');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
{
if ( vintx.vout.size() > 0 && DecodeGatewaysBindOpRet(depositaddr,vintx.vout[vintx.vout.size()-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 0 )

16
src/cc/importgateway.cpp

@ -260,13 +260,13 @@ int32_t ImportGatewayBindExists(struct CCcontract_info *cp,CPubKey importgateway
{
char markeraddr[64],burnaddr[64]; std::string coin; int32_t numvouts; int64_t totalsupply; uint256 tokenid,oracletxid,hashBlock;
uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys; CTransaction tx;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
std::vector<uint256> txids;
_GetCCaddress(markeraddr,EVAL_IMPORTGATEWAY,importgatewaypk);
SetCCtxids(addressIndex,markeraddr,true);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,markeraddr,true,cp->evalcode,zeroid,'B');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
if ( myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey)=='B' )
if ( myGetTransaction(*it,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey)=='B' )
{
if ( DecodeImportGatewayBindOpRet(burnaddr,tx.vout[numvouts-1].scriptPubKey,coin,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) == 'B' )
{
@ -1172,14 +1172,14 @@ UniValue ImportGatewayProcessedWithdraws(uint256 bindtxid,std::string refcoin)
UniValue ImportGatewayList()
{
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
UniValue result(UniValue::VARR); std::vector<uint256> txids;
struct CCcontract_info *cp,C; uint256 txid,hashBlock,oracletxid; CTransaction vintx; std::string coin;
char str[65],burnaddr[64]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
cp = CCinit(&C,EVAL_IMPORTGATEWAY);
SetCCtxids(addressIndex,cp->unspendableCCaddr,true);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,cp->unspendableCCaddr,true,cp->evalcode,zeroid,'B');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
{
if ( vintx.vout.size() > 0 && DecodeImportGatewayBindOpRet(burnaddr,vintx.vout[vintx.vout.size()-1].scriptPubKey,coin,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 0 )

8
src/cc/lotto.cpp

@ -264,12 +264,12 @@ UniValue LottoInfo(uint256 lottoid)
UniValue LottoList()
{
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock,hentropy; CTransaction vintx; uint64_t sbits; int32_t ticketsize,odds,firstheight,period; char str[65];
UniValue result(UniValue::VARR); std::vector<uint256> txids; struct CCcontract_info *cp,C; uint256 txid,hashBlock,hentropy; CTransaction vintx; uint64_t sbits; int32_t ticketsize,odds,firstheight,period; char str[65];
cp = CCinit(&C,EVAL_LOTTO);
SetCCtxids(addressIndex,cp->normaladdr,true);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,cp->normaladdr,true,cp->evalcode,zeroid,'F');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
{
if ( vintx.vout.size() > 0 && DecodeLottoFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,ticketsize,odds,firstheight,period,hentropy) == 'F' )

38
src/cc/oracles.cpp

@ -92,7 +92,7 @@
vout.n-1: opreturn with oracletxid, prevbatontxid and data in proper format
*/
extern int32_t komodo_currentheight();
extern int32_t komodo_get_current_height();
#define PUBKEY_SPOOFING_FIX_ACTIVATION 1563148800
#define CC_MARKER_VALUE 10000
@ -792,13 +792,13 @@ int64_t AddOracleInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,uint
int64_t LifetimeOraclesFunds(struct CCcontract_info *cp,uint256 oracletxid,CPubKey publisher)
{
char coinaddr[64]; CPubKey pk; int64_t total=0,num; uint256 txid,hashBlock,subtxid; CTransaction subtx;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
std::vector<uint256> txids;
GetCCaddress(cp,coinaddr,publisher);
SetCCtxids_NSPV(addressIndex,coinaddr,true,EVAL_ORACLES,oracletxid);
SetCCtxids(txids,coinaddr,true,cp->evalcode,oracletxid,'S');
//fprintf(stderr,"scan lifetime of %s\n",coinaddr);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,subtx,hashBlock) != 0 )
{
if ( subtx.vout.size() > 0 && DecodeOraclesOpRet(subtx.vout[subtx.vout.size()-1].scriptPubKey,subtxid,pk,num) == 'S' && subtxid == oracletxid && pk == publisher )
@ -896,7 +896,7 @@ std::string OracleFund(int64_t txfee,uint256 oracletxid)
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C;
if (GetLatestTimestamp(komodo_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
if (GetLatestTimestamp(komodo_get_current_height())<PUBKEY_SPOOFING_FIX_ACTIVATION)
{
CCerror = strprintf("oraclesfund not active yet, activation scheduled for July 15th");
fprintf(stderr,"%s\n", CCerror.c_str() );
@ -936,7 +936,7 @@ std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
if (AddNormalinputs(mtx,mypk,3*txfee,4))
{
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
if (GetLatestTimestamp(komodo_get_current_height())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
{
CCerror = strprintf("error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!");
fprintf(stderr,"%s\n", CCerror.c_str() );
@ -944,7 +944,7 @@ std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
}
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION) mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
if (GetLatestTimestamp(komodo_get_current_height())>PUBKEY_SPOOFING_FIX_ACTIVATION) mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('R',oracletxid,mypk,datafee)));
}
CCerror = strprintf("error adding normal inputs");
@ -1097,7 +1097,7 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
{
UniValue result(UniValue::VOBJ),b(UniValue::VARR); CTransaction tx,oracletx; uint256 txid,hashBlock,btxid,oracletxid;
CPubKey pk; std::string name,description,format; int32_t numvouts,n=0,vout; std::vector<uint8_t> data; char *formatstr = 0;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; int64_t nValue;
std::vector<uint256> txids; int64_t nValue;
result.push_back(Pair("result","success"));
if ( myGetTransaction(reforacletxid,oracletx,hashBlock) != 0 && (numvouts=oracletx.vout.size()) > 0 )
@ -1122,15 +1122,13 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
break;
}
}
SetCCtxids(addressIndex,batonaddr,true);
if (addressIndex.size()>0)
SetCCtxids(txids,batonaddr,true,EVAL_ORACLES,reforacletxid,'D');
if (txids.size()>0)
{
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.end()-1; it!=addressIndex.begin(); it--)
for (std::vector<uint256>::const_iterator it=txids.end()-1; it!=txids.begin(); it--)
{
txid=it->first.txhash;
vout = (int32_t)it->first.index;
nValue = (int64_t)it->second;
if (vout==1 && nValue==10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 )
txid=*it;
if (myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 )
{
if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
{
@ -1224,12 +1222,12 @@ UniValue OracleInfo(uint256 origtxid)
UniValue OraclesList()
{
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction createtx; std::string name,description,format; char str[65];
UniValue result(UniValue::VARR); std::vector<uint256> txids; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction createtx; std::string name,description,format; char str[65];
cp = CCinit(&C,EVAL_ORACLES);
SetCCtxids(addressIndex,cp->normaladdr,false);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,cp->normaladdr,false,cp->evalcode,zeroid,'C');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,createtx,hashBlock) != 0 )
{
if ( createtx.vout.size() > 0 && DecodeOraclesCreateOpRet(createtx.vout[createtx.vout.size()-1].scriptPubKey,name,description,format) == 'C' )

12
src/cc/pegs.cpp

@ -1225,7 +1225,7 @@ UniValue PegsAccountHistory(uint256 pegstxid)
{
char coinaddr[64]; int64_t nValue,amount; uint256 txid,accounttxid,hashBlock,tmptokenid,tmppegstxid;
CTransaction tx; int32_t numvouts,vout; char funcid; CPubKey mypk,pegspk,pk; std::map<uint256,std::pair<int64_t,int64_t>> accounts;
std::vector<std::pair<CAddressIndexKey, CAmount> > txids; std::pair<int64_t,int64_t> account;
std::vector<uint256> txids; std::pair<int64_t,int64_t> account;
UniValue result(UniValue::VOBJ),acc(UniValue::VARR); struct CCcontract_info *cp,C;
result.push_back(Pair("result","success"));
@ -1234,13 +1234,11 @@ UniValue PegsAccountHistory(uint256 pegstxid)
mypk = pubkey2pk(Mypubkey());
pegspk = GetUnspendable(cp,0);
GetCCaddress1of2(cp,coinaddr,mypk,pegspk);
SetCCtxids_NSPV(txids,coinaddr,true,EVAL_PEGS,pegstxid);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
SetCCtxids(txids,coinaddr,true,EVAL_PEGS,pegstxid,0);
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
vout = (int32_t)it->first.index;
nValue = (int64_t)it->second;
if (vout == 1 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
txid = *it;
if (myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
(funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid)
{
UniValue obj(UniValue::VOBJ);

16
src/cc/rewards.cpp

@ -432,13 +432,13 @@ int64_t RewardsPlanFunds(uint64_t &lockedfunds,uint64_t refsbits,struct CCcontra
bool RewardsPlanExists(struct CCcontract_info *cp,uint64_t refsbits,CPubKey rewardspk,uint64_t &APR,uint64_t &minseconds,uint64_t &maxseconds,uint64_t &mindeposit)
{
char CCaddr[64]; uint64_t sbits; uint256 txid,hashBlock; CTransaction tx;
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
std::vector<uint256> txids;
GetCCaddress(cp,CCaddr,rewardspk);
SetCCtxids(txids,CCaddr,true);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
SetCCtxids(txids,CCaddr,true,cp->evalcode,zeroid,'F');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
//int height = it->first.blockHeight;
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 && ConstrainVout(tx.vout[0],1,CCaddr,0) != 0 )
{
//char str[65]; fprintf(stderr,"rewards plan %s\n",uint256_str(str,txid));
@ -492,12 +492,12 @@ UniValue RewardsInfo(uint256 rewardsid)
UniValue RewardsList()
{
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction vintx; uint64_t sbits,APR,minseconds,maxseconds,mindeposit; char str[65];
UniValue result(UniValue::VARR); std::vector<uint256> txids; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction vintx; uint64_t sbits,APR,minseconds,maxseconds,mindeposit; char str[65];
cp = CCinit(&C,EVAL_REWARDS);
SetCCtxids(addressIndex,cp->normaladdr,false);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
SetCCtxids(txids,cp->normaladdr,false,cp->evalcode,zeroid,'F');
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
txid = it->first.txhash;
txid = *it;
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
{
if ( vintx.vout.size() > 0 && DecodeRewardsFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,APR,minseconds,maxseconds,mindeposit) != 0 )

6
src/cc/rogue_rpc.cpp

@ -1452,15 +1452,15 @@ UniValue rogue_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
UniValue rogue_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
{
UniValue result(UniValue::VOBJ),a(UniValue::VARR),b(UniValue::VARR); uint256 txid,hashBlock,gametxid,tokenid,playertxid; int32_t vout,maxplayers,gameheight,numvouts; CPubKey roguepk,mypk; char coinaddr[64]; CTransaction tx,gametx; int64_t buyin;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
std::vector<uint256> txids;
//std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
roguepk = GetUnspendable(cp,0);
mypk = pubkey2pk(Mypubkey());
GetCCaddress1of2(cp,coinaddr,roguepk,mypk);
//SetCCunspents(unspentOutputs,coinaddr);
SetCCtxids(addressIndex,coinaddr,true);
SetCCtxids(txids,coinaddr,true,cp->evalcode,zeroid,'R');
rogue_univalue(result,"games",-1,-1);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
//for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
{
txid = it->first.txhash;

568
src/chainparams.cpp

@ -89,7 +89,7 @@ static CBlock CreateGenesisBlock(uint32_t nTime, const uint256& nNonce, const st
* timestamp before)
* + Contains no strange transactions
*/
void *chainparams_commandline(void *ptr);
void *chainparams_commandline();
#include "komodo_defs.h"
int32_t ASSETCHAINS_BLOCKTIME = 60;
uint64_t ASSETCHAINS_NK[2];
@ -214,11 +214,6 @@ public:
fRequireStandard = true;
fMineBlocksOnDemand = false;
fTestnetToBeDeprecatedFieldRPC = false;
if ( pthread_create((pthread_t *)malloc(sizeof(pthread_t)),NULL,chainparams_commandline,(void *)&consensus) != 0 )
{
}
}
};
@ -247,290 +242,6 @@ void CChainParams::SetCheckpointData(CChainParams::CCheckpointData checkpointDat
*/
int32_t MAX_BLOCK_SIZE(int32_t height)
{
int32_t saplinght = mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight;
//fprintf(stderr,"MAX_BLOCK_SIZE %d vs. %d\n",height,mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight);
if ( height <= 0 || (saplinght > 0 && height >= saplinght) )
{
return(_MAX_BLOCK_SIZE);
}
else return(2000000);
}
void komodo_setactivation(int32_t height)
{
mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = height;
mainParams.consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = height;
ASSETCHAINS_SAPLING = height;
fprintf(stderr,"SET SAPLING ACTIVATION height.%d\n",height);
}
void *chainparams_commandline(void *ptr)
{
CChainParams::CCheckpointData checkpointData;
while ( ASSETCHAINS_P2PPORT == 0 )
{
#ifdef _WIN32
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
#else
sleep(1);
#endif
}
//fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_P2PPORT);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
if ( ASSETCHAINS_BLOCKTIME != 60 )
{
mainParams.consensus.nMaxFutureBlockTime = 7 * ASSETCHAINS_BLOCKTIME; // 7 blocks
mainParams.consensus.nPowTargetSpacing = ASSETCHAINS_BLOCKTIME;
}
mainParams.SetDefaultPort(ASSETCHAINS_P2PPORT);
if ( ASSETCHAINS_NK[0] != 0 && ASSETCHAINS_NK[1] != 0 )
{
//BOOST_STATIC_ASSERT(equihash_parameters_acceptable(ASSETCHAINS_NK[0], ASSETCHAINS_NK[1]));
mainParams.SetNValue(ASSETCHAINS_NK[0]);
mainParams.SetKValue(ASSETCHAINS_NK[1]);
}
if ( KOMODO_TESTNODE != 0 )
mainParams.SetMiningRequiresPeers(false);
if ( ASSETCHAINS_RPCPORT == 0 )
ASSETCHAINS_RPCPORT = ASSETCHAINS_P2PPORT + 1;
mainParams.pchMessageStart[0] = ASSETCHAINS_MAGIC & 0xff;
mainParams.pchMessageStart[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff;
mainParams.pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff;
mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH)
{
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
// nLwmaAjustedWeight = (N+1)/2 * (0.9989^(500/nPowAveragingWindow)) * nPowTargetSpacing
mainParams.consensus.nLwmaAjustedWeight = 1350;
mainParams.consensus.nPowAveragingWindow = 45;
mainParams.consensus.powAlternate = uint256S("00000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
}
else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1)
{
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
// nLwmaAjustedWeight = (N+1)/2 * (0.9989^(500/nPowAveragingWindow)) * nPowTargetSpacing
mainParams.consensus.nLwmaAjustedWeight = 1350;
mainParams.consensus.nPowAveragingWindow = 45;
mainParams.consensus.powAlternate = uint256S("0000000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
}
if (ASSETCHAINS_LWMAPOS != 0)
{
mainParams.consensus.posLimit = uint256S("000000000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
mainParams.consensus.nPOSAveragingWindow = 45;
// spacing is 1000 units per block to get better resolution, POS is 50% hard coded for now, we can vary it later
// when we get reliable integer math on nLwmaPOSAjustedWeight
mainParams.consensus.nPOSTargetSpacing = VERUS_BLOCK_POSUNITS * 2;
// nLwmaPOSAjustedWeight = (N+1)/2 * (0.9989^(500/nPOSAveragingWindow)) * nPOSTargetSpacing
// this needs to be recalculated if VERUS_BLOCK_POSUNITS is changed
mainParams.consensus.nLwmaPOSAjustedWeight = 46531;
}
// only require coinbase protection on Verus from the Komodo family of coins
if (strcmp(ASSETCHAINS_SYMBOL,"VRSC") == 0)
{
mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = 227520;
mainParams.consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = 227520;
mainParams.consensus.fCoinbaseMustBeProtected = true;
checkpointData = //(Checkpoints::CCheckpointData)
{
boost::assign::map_list_of
(0, mainParams.consensus.hashGenesisBlock)
(10000, uint256S("0xac2cd7d37177140ea4991cf630c0b9c7f94d707b84fb0351bf3a44856d2ae5dc"))
(20000, uint256S("0xb0e8cb9f77aaa7ff5bd90d6c08d06f4c4bf03e00c2b8a35a042e760845590c8a"))
(30000, uint256S("0xf2112ca577338ad7104bf905fa6a63d36b17a86f914c97b73cd31d43fcd7557c"))
(40000, uint256S("0x00000000008f83378dab727864b763ce91a4ea5f75d55939c0c1390cfb8c38f1"))
(49170, uint256S("0x2add646c0089871ec2379f02f7cd60b3af6efd9c152a6f16fc10925458c270cc")),
(int64_t)1529910234, // * UNIX timestamp of last checkpoint block
(int64_t)63661, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
(double)2777 // * estimated number of transactions per day after checkpoint
// total number of tx / (checkpoint block height / (24 * 24))
};
mainParams.consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000001a8f4f23f8b2d1f7e");
}
else
{
if (strcmp(ASSETCHAINS_SYMBOL,"VRSCTEST") == 0 || strcmp(ASSETCHAINS_SYMBOL,"VERUSTEST") == 0)
{
mainParams.consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000001f7e");
}
mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = ASSETCHAINS_SAPLING;
mainParams.consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = ASSETCHAINS_OVERWINTER;
checkpointData = //(Checkpoints::CCheckpointData)
{
boost::assign::map_list_of
(0, mainParams.consensus.hashGenesisBlock),
(int64_t)1231006505,
(int64_t)1,
(double)2777 // * estimated number of transactions per day after checkpoint
// total number of tx / (checkpoint block height / (24 * 24))
};
}
}
else
{
checkpointData = //(Checkpoints::CCheckpointData)
{
boost::assign::map_list_of
(0, mainParams.consensus.hashGenesisBlock)
( 5000, uint256S("0x049cfc91eef411e96603a42c9a77c5e30e9fe96f783ab818f4c00fb56fb29b6c"))
( 10000, uint256S("0x0a0169db3614311cd4181deb73cfcf7f640e7dc956cda34e0121a0351925e9ae"))
( 15000, uint256S("0x00f0bd236790e903321a2d22f85bd6bf8a505f6ef4eddb20458a65d37e14d142"))
( 20000, uint256S("0x01bbf0c38892bdcced62b538329cf63bc7badca3e7e1bff8eb10345436871c6e"))
( 25000, uint256S("0x04ca27808268dda8f942b647a6df844be1b263a661a13740293db962022d1f9e"))
( 30000, uint256S("0x04c9e8cfbcd37399085e529b50147de8afb80c76c48752c122d56f23316a7acb"))
( 35000, uint256S("0x00815f1240354cff7487c67f7dff78e248cb9053ed2c92751d1a9ad42d3eaedf"))
( 40000, uint256S("0x00eafd9dfb1e5f1bf1cca0c49be628538900daf69b665464443d29c2c3b6a2fe"))
( 45000, uint256S("0x0377730632caf694b92f40d03ae0fbe5bd86a1205014b71d975453ac793b0af9"))
( 50000, uint256S("0x00076e16d3fa5194da559c17cf9cf285e21d1f13154ae4f7c7b87919549345aa"))
( 55000, uint256S("0x0005a0701a83e05b639418ea4c87018544a4d22b2b49e5f111161e8ffc455108"))
( 60000, uint256S("0x0000296fc15f8599b7c6561d0e0a96f24766135ed79107b603d6dd6e55142c0d"))
( 65000, uint256S("0x000861f5d7970d5399733b4605074d47f877d6536f74ffae6f08e871ee29e6f2"))
( 70000, uint256S("0x0002af1d487c567526c517b52996944dca344e139cddca77c2e72f746e73b263"))
( 75000, uint256S("0x0d08129659be5f105e70c047769359eaf3475d61a726750859fdca3e1a2bf5cc"))
( 80000, uint256S("0x0af5f3f1caae4f08c74a82689731d1ef8e55107c06f9a996e251b8ecb96989ad"))
( 85000, uint256S("0x00000c8ee29086c5fb39eddad0619773b9ce936c77c13e5e5118a4998e939544"))
( 90000, uint256S("0x06d3bb7f9ee5b55f67b2dc13c680699a2f736f43a44b4e4cfd41a58aa00f063f"))
( 95000, uint256S("0x0670981b269879aae83a88f6f0c4db34763c93fd410d96435f2acb4e6580b976"))
( 100000, uint256S("0x0f02eb1f3a4b89df9909fec81a4bd7d023e32e24e1f5262d9fc2cc36a715be6f"))
( 105000, uint256S("0x018b97d7e6d259add24afe0e08fc125dc21d734e8831b68b430f5c3896deb4af"))
( 110000, uint256S("0x09644ff52734e0e911a9ba7ecd03cf7995b25301840a9637891ef9af69f59c32"))
( 115000, uint256S("0x0ee382b4729b8ceb918a92913f9c144a6a4f8a50bfc0f8b4aac5b12592caed7f"))
( 120000, uint256S("0x082a7918a0dd9cb2df65f55acb8d0a4a535b3fa684d92c3ebcb24ed7019d975b"))
( 125000, uint256S("0x00008f76c4484fd539c9d02fc69c40a50b6f9e00984d33890b85cc0324159e9e"))
( 130000, uint256S("0x011b09e53acfe46f310e8c960a9c4f4f490cc7b2cd3791d7a6a80d6e8ac96b36"))
( 135000, uint256S("0x01e0cd48358fa05646baa6f00e26717474d6049a537c8861b324d1f497dc3d4a"))
( 140000, uint256S("0x0e6db36fd8a9d1b7baf359c8bd5c76635d0bcada973a75b5d2028ca3baea4961"))
( 145000, uint256S("0x00010c40b57316ce6cde076807c9db956452a3c82cb09fe7d56c6bb1a7e24726"))
( 150000, uint256S("0x0a817f15b9da636f453a7a01835cfc534ed1a55ce7f08c566471d167678bedce"))
( 155000, uint256S("0x0528084fd00223bd9747635d7a4d8cc79f158795cad654efb78e4e4cc5f23d6a"))
( 160000, uint256S("0x00003a09f26ae9fb7ebbfa3ef589b81ccd8909a82430f7414bc68d5a5a3316ab"))
( 165000, uint256S("0x00004a0c6a29e7d1f22ea4e44d05e861fec5fcd8eebc5a61574c4ecf29dbb9be"))
( 170000, uint256S("0x0cf9eac27badc0ae9a2b370dd7cc3fcb550f139349551e60978f394a2e1b262b"))
( 175000, uint256S("0x0000137856b825d431da27ff4c3cf22f5482fa21952d45b0db0ec6774fb9b510"))
( 180000, uint256S("0x000000b0afcccf98aa0afb6ac61050892bd9415857d66313d1f67fd1bbac312f"))
( 185000, uint256S("0x00c2af8f88d84de080067f8ae1c25754e32e5516d20c11f85b9adae2d683687b"))
( 190000, uint256S("0x00000033d85b3e7d19e02278ef300b8ab957d3dd3e58b4c81166ba0a58af5c3f"))
( 195000, uint256S("0x000000964b6068be1dd4ee6893d183e86cba82a2744fb5439c463d0ba7e053b6"))
( 200000, uint256S("0x000001763a9337328651ca57ac487cc0507087be5838fb74ca4165ff19f0e84f"))
( 205000, uint256S("0x049fc6832e64a75ae898b32804e151e7561ea49082858c3d4af89a7de4b82f06"))
( 210000, uint256S("0x0000000d9078b9c9604cc663eafafba8f3643bb3f3ddbb78fed4993236e1edb5"))
( 215000, uint256S("0x00060089ecc21bcc62094e2f7f0448fe163415f6ef2f2aafe047757889ca82fe"))
( 220000, uint256S("0x000082c78e6c2a13a9c23dd7a6faaf962fc133142b4a2d07725561f59c03bfa2"))
( 225000, uint256S("0x00030026483167fe13505cf27049307ce42e0d9c5aa093aed10baa4f49edf4ca"))
( 230000, uint256S("0x000183a3e17988060a35776b99c1f0b43393bbe7153b2718dfc57f428191de4e"))
( 235000, uint256S("0x000184995f0ec024ed3783e322c8cfa5e68d9f0c77c3aaea301b22d311619156"))
( 240000, uint256S("0x0000002cc7cf6d0a44ab57f9bd3bfa11a865bbf1cd87a2081095bc90981633a3"))
( 245000, uint256S("0x004c5f19a88c8fe8a604006dbd2d44c94baef2a00876a17d8e2be2124003f979"))
( 250000, uint256S("0x0dd54ef5f816c7fde9d2b1c8c1a26412b3c761cc5dd3901fa5c4cd1900892fba"))
( 255000, uint256S("0x0b6da9e4f50c8bc7a92c539bc7474ffd6c29e0a8531f0dbbbc261fff1f990827"))
( 260000, uint256S("0x0cac8b12bf7233ee5a68fcde9e251852b177833fefa2a9f39ec28474b0851cb9"))
( 265000, uint256S("0x04feb5b4029f3b8b8eb3e6661a78eadd1a26b4af00ac59b5f05b261afcfd2818"))
( 270000, uint256S("0x01bc5897bd20b8b61acf4989987ba85fbc37d9ebe848924aa8effcb08bf48fe0"))
( 275000, uint256S("0x0416bc29eb5a12231826e546ba90fcd38aeef387ff77b45849cd418a9c1a6f12"))
( 280000, uint256S("0x000007593e9880b171d46bce59aa0cec2a1b1f53d1fd7e8f71ccb2b9182374a4"))
( 285000, uint256S("0x05a338b2d90cd79740221fe8635b7a834f2e486fcbb2464a4294f5a21231a5f5"))
( 290000, uint256S("0x064ca3912cdcd833702d07a530e98bc5c6c1cd738a8825c7240b17cd68ca0cc4"))
( 295000, uint256S("0x036b3bb318d743fd78db983a9aadd52869991d48913c4eebe2a074387d67cc5a"))
( 300000, uint256S("0x000000fa5efd1998959926047727519ed7de06dcf9f2cd92a4f71e907e1312dc"))
( 305000, uint256S("0x00003656231e83de2348755153ed175794696a113d7e8a15c01f90fdb7c2f287"))
( 310000, uint256S("0x0cf6baf727eb931da0813ed8b032648c4766be79e146b0d40c643f9d8edf40f7"))
( 315000, uint256S("0x082469974c152ebe69f1787f0d06aa5d9dd1dc69c880febde7eac2bc800146dd"))
( 320000, uint256S("0x0000063df36b99bfb2516f55cb548a5baed1f2d8ae69c3559dc478c5c2eb32df"))
( 325000, uint256S("0x0cb926b303a1514ba0a2f729af88ccb143517f396e9e0bde09b0736900698e0f"))
( 330000, uint256S("0x000000be3d8bb6e31c3b534819aae7014cbbe9a44ab3e799dc1bfc724c6ab184"))
( 335000, uint256S("0x0d0756608189fd5bbd8ec50e76180074e69e973439cc09df49134e4cb970ed4d"))
( 340000, uint256S("0x0d814eacdb9c97003d703c0ff79b1b97b9ed8615fe12b1afaede946e5fdfe0a7"))
( 345000, uint256S("0x000000c2910f510f1de325d300202da1a391f2719dd378173299151c3da94e85"))
( 350000, uint256S("0x0000000228ef321323f81dae00c98d7960fc7486fb2d881007fee60d1e34653f"))
( 355000, uint256S("0x03e6a55e382b478e0fab9c3584da3629fd9b977986a333a406b24b0d3559bf44"))
( 360000, uint256S("0x0859c86dd718bcb5b58af06389197794e2beea6239653f2e6fa7b8a7433d29ea"))
( 365000, uint256S("0x07896332665c707a8f55398a998e7878e8d2681ba79dd95c2859b1dafc9343d0"))
( 370000, uint256S("0x040efd8c64cf5cf96ecf75468741a8880d1386eb5e349bef0a55116d4023944c"))
( 375000, uint256S("0x053029e7599a09fe6c01203997d7ca738dd4c6d216a433695a0d514def1eccc0"))
( 380000, uint256S("0x0cae44e7a421c389b88a5a204d3e39779e93aeacaab1b693741bf279fd0c8acd"))
( 385000, uint256S("0x0b4032d2c799ba93644231ce57134dd24e13ec0dc267c1ed5912389691d2bd72"))
( 390000, uint256S("0x0afd0f166f33a881ef289af7ea7010d58c4bbd560dee10b561c79e1b8dfd0593"))
( 395000, uint256S("0x083774b88cf1b138d67c242d9b33c54f69d7e901b5e8144dc4a2303ab9927102"))
( 400000, uint256S("0x036d294c5be96f4c0efb28e652eb3968231e87204a823991a85c5fdab3c43ae6"))
( 405000, uint256S("0x0522e33bb2161fb1b33acef9a4a438fcf420dcae8a0b472e234d223d731c42b2"))
( 410000, uint256S("0x0361d06aa807c66b87befea8119a485341d1118b694c3dbb4c3cf0b85ac69e9b"))
( 415000, uint256S("0x072d5653d8673f64ef8b9c655f7b8021072070a072b799013ff6e96de99a59e6"))
( 420000, uint256S("0x013b693d66955be69d4501cb1d307ca323a5c8473e25866ae7e700cdce0c654f"))
( 425000, uint256S("0x0ef0c55af27c6971289a790dee2b2ec728fb9c6555ff9306c07f1083cf0fb4b5"))
( 430000, uint256S("0x0ccbeeaba28291e0316a9cf54c005097c61dc67ba6f32283406d6c83b828da00"))
( 435000, uint256S("0x020ed6b7fe1124400baba7feed463ba0c90e7e6903493fdc1a1a18c4a506055a"))
( 440000, uint256S("0x055aaadca1908abeedc831a3f9115aa31284fc223d010590caf7b612960b61a4"))
( 445000, uint256S("0x06d2327fa25ea7e2be742fc0e45fc4f9adb41811f21be0357f8543c5434df715"))
( 450000, uint256S("0x0906ef1e8dc194f1f03bd4ce1ac8c6992fd721ef2c5ccbf4871ec8cdbb456c18"))
( 455000, uint256S("0x0b8b92eec29eb20262dcf9916f0ca36d6abf0c39d321d3f480a5535cb978db71"))
( 460000, uint256S("0x0cb04591f69a255b1127aaff3bbd59eaa21a5d9cca999de197516c251895c536"))
( 465000, uint256S("0x029985ae78d8bb8fd170aeb3ab02ea76134ed0c19ae00211cc28a61fe5755b88"))
( 470000, uint256S("0x01a2f4b56f37b223e75572862ad1ba956ec179332f8cd40590d7253563c86ba8"))
( 475000, uint256S("0x0a34c6f9d4d9cb8c78c14b8041a7cc1874cfcbb22a34a5c068d1d6ff3ed9fdf0"))
( 480000, uint256S("0x0ebab25030179996ae25969f34f6a297c7ffce1994f9b4186082a47032a9a7dc"))
( 485000, uint256S("0x06a096e6bccf3b85537a30f95db6a414deacc0509bc84da264c2830df1a1d9b0"))
( 490000, uint256S("0x0af828930ef13405cb536b88a3d1d4e0d84dc79ee260402c56bfa86e261c74ff"))
( 495000, uint256S("0x09d44905bfd12849d3c2178b2ba882f8e9d6565b6e4d7a97c70a92bd6de7c5e6"))
( 500000, uint256S("0x0bebdb417f7a51fe0c36fcf94e2ed29895a9a862eaa61601272866a7ecd6391b"))
( 505000, uint256S("0x0c1609f4f3561baa1fc975877948af94d2107c88686a9821bc240016cc87d953"))
( 510000, uint256S("0x0cf9a5a4997b871e615e5e398627e45fa15b3e6970ae22b47bdd11b0f5fa0fa7"))
( 515000, uint256S("0x034171d4819e9961de13309743a32a179abede97d60ea64101dc04c97a1a0807"))
( 520000, uint256S("0x0648fa44d5bbc2cc04a782e083c11df64ac06185f0f8e11a7416625ebb6409a6"))
( 525000, uint256S("0x0000000ef17d63af3159e52cd351b6f000536ad88adc3a937bb747955fed58a2"))
( 530000, uint256S("0x08e3af153995ba09e50086b64145cf4cd57db6b29f16f06f28d80d7f6121cfad"))
( 535000, uint256S("0x02a0ffd00b51e2061b85de50a9223d9c84f4e357dc1046397bb9d7d4a827a3fb"))
( 540000, uint256S("0x04bf07d026af29025c1ac2815e067f4a41d2872701ac9780eb3015d51cdcd854"))
( 545000, uint256S("0x0a0d6d86635946792ad0dca57ed227a5360fc8b6d79e47132aac11e90a4963ce"))
( 550000, uint256S("0x06df52fc5f9ba03ccc3a7673b01ab47990bd5c4947f6e1bc0ba14d21cd5bcccd"))
( 555000, uint256S("0x0baf38eea8e08fcad3a9d760f27377e79c291b08e7fb4920cadd5cb7bab547f3"))
( 560000, uint256S("0x00000004c34abbf1366adbae965b644c01debf15409acc715ff51cb221d92dd7"))
( 565000, uint256S("0x067bae7119f083e0fa1820bc8e25dcfa7717e42aabaef18beefd87d974953dfb"))
( 570000, uint256S("0x00000011a7ce7b628b7be17777d8dea2574d83f165e23c9e44aa705975820fd3"))
( 575000, uint256S("0x0e1110a193a30d3f8d369017233a2486b11c748b3d033859a2eb7b37062d303e"))
( 580000, uint256S("0x083cb58484aff80f48e3537e0451d49e544b3efa3da97274800c91e567d33a92"))
( 585000, uint256S("0x0224cf835428d03472edf4f7b6fcc63b9d8d6f1d5a90ad8186bf123d541b4ea8"))
( 590000, uint256S("0x0cfcf3b9517894e4df49db5faf8b74f3a9e01eb83c0cc5051c115d4424615dae"))
( 595000, uint256S("0x0000000a45266983dd81e0df381a3b0455699b2f76d5b4d3f17b87d657a1b56d"))
( 600000, uint256S("0x00000005080d5689c3b4466e551cd1986e5d2024a62a79b1335afe12c42779e4"))
( 605000, uint256S("0x0000001c691da36848542299af859d4eb3fa408a0f425b1fbe6d622d2100623a"))
( 610000, uint256S("0x040d8c7a0ac89e3ed8605a198583a795986aacbf18722a9897d7b925bcf757f6"))
( 615000, uint256S("0x0449cf00fc36206389c14cbf1d762f8b96bb0440ccea5b46703e7c69b0e2bc42"))
( 620000, uint256S("0x07227a41340c25ee1a7e9b60414259780202ffa990079fc91d8faeac9af03e60"))
( 625000, uint256S("0x047c2472fe2afabb3d38decf24bba4ba712b60e7a1782f4afae3ede3f912f493"))
( 630000, uint256S("0x0a7f1f04e66260cf972ab1374a9126b8abc1adaa3ab4669db5d4d4ddb9ad493d"))
( 635000, uint256S("0x048df95165eb821dabf37ef28cf7f3be72e216e95377684253dab806985b50a4"))
( 640000, uint256S("0x066b3c6a6a3c8dc58bef509a972c3e3ade14493b40e1b361ecbc928134e302be"))
( 645000, uint256S("0x07d059888c9ade3bbe16d6b4d70ee9b8302d104b37a3c6cd61f81012aabd0e1e"))
( 650000, uint256S("0x039a3cb760cc6e564974caf69e8ae621c14567f3a36e4991f77fd869294b1d52"))
( 655000, uint256S("0x089350ee8d28b44837eb4b1fe77704953d5de2077f10c74a888d9d3ea1e13c2a"))
( 660000, uint256S("0x000000023f8a582a61ae2f6fab6fe8197e79b7a68aaac67432421b09f1bdd4ba"))
( 665000, uint256S("0x0b16edce865e7a0d662115774e0c0d3abbf9c69004155b693ddc933f051bfb26"))
( 670000, uint256S("0x09070b109b089490bc372fd8358abae352d6db0e46ade6ed2200e4d4ff7aa6af"))
( 675000, uint256S("0x08d9edeed3b6ac55991e9f32af0218ff8fa9dc808078623f4c831eb09d4f186b"))
( 680000, uint256S("0x00000003eb2b30bfac929d3496acecab19625ac9f854a86aaf9678bea99e1cc1"))
( 681777, uint256S("0x0000243296b9b26c040f471fdd9398ef72e57062cf05c19b9ba2fefac8165306")),
(int64_t)1516924927, // * UNIX timestamp of last checkpoint block
(int64_t)1253783, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
(double)2777 // * estimated number of transactions per day after checkpoint
// total number of tx / (checkpoint block height / (24 * 24))
};
}
mainParams.SetCheckpointData(checkpointData);
ASSETCHAIN_INIT = 1;
return(0);
}
/**
* Testnet (v3)
*/
@ -826,3 +537,280 @@ void UpdateNetworkUpgradeParameters(Consensus::UpgradeIndex idx, int nActivation
{
regTestParams.UpdateNetworkUpgradeParameters(idx, nActivationHeight);
}
int32_t MAX_BLOCK_SIZE(int32_t height)
{
int32_t saplinght = pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight;
//fprintf(stderr,"MAX_BLOCK_SIZE %d vs. %d\n",height,mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight);
if ( height <= 0 || (saplinght > 0 && height >= saplinght) )
{
return(_MAX_BLOCK_SIZE);
}
else return(2000000);
}
void komodo_setactivation(int32_t height)
{
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = height;
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = height;
ASSETCHAINS_SAPLING = height;
fprintf(stderr,"SET SAPLING ACTIVATION height.%d\n",height);
}
void *chainparams_commandline()
{
fprintf(stderr,"chainparams_commandline called\n");
CChainParams::CCheckpointData checkpointData;
//fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_P2PPORT);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
if ( ASSETCHAINS_BLOCKTIME != 60 )
{
pCurrentParams->consensus.nMaxFutureBlockTime = 7 * ASSETCHAINS_BLOCKTIME; // 7 blocks
pCurrentParams->consensus.nPowTargetSpacing = ASSETCHAINS_BLOCKTIME;
}
pCurrentParams->SetDefaultPort(ASSETCHAINS_P2PPORT);
if ( ASSETCHAINS_NK[0] != 0 && ASSETCHAINS_NK[1] != 0 )
{
//BOOST_STATIC_ASSERT(equihash_parameters_acceptable(ASSETCHAINS_NK[0], ASSETCHAINS_NK[1]));
pCurrentParams->SetNValue(ASSETCHAINS_NK[0]);
pCurrentParams->SetKValue(ASSETCHAINS_NK[1]);
}
if ( KOMODO_TESTNODE != 0 )
pCurrentParams->SetMiningRequiresPeers(false);
if ( ASSETCHAINS_RPCPORT == 0 )
ASSETCHAINS_RPCPORT = ASSETCHAINS_P2PPORT + 1;
pCurrentParams->pchMessageStart[0] = ASSETCHAINS_MAGIC & 0xff;
pCurrentParams->pchMessageStart[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff;
pCurrentParams->pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff;
pCurrentParams->pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH)
{
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
// nLwmaAjustedWeight = (N+1)/2 * (0.9989^(500/nPowAveragingWindow)) * nPowTargetSpacing
pCurrentParams->consensus.nLwmaAjustedWeight = 1350;
pCurrentParams->consensus.nPowAveragingWindow = 45;
pCurrentParams->consensus.powAlternate = uint256S("00000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
}
else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1)
{
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
// nLwmaAjustedWeight = (N+1)/2 * (0.9989^(500/nPowAveragingWindow)) * nPowTargetSpacing
pCurrentParams->consensus.nLwmaAjustedWeight = 1350;
pCurrentParams->consensus.nPowAveragingWindow = 45;
pCurrentParams->consensus.powAlternate = uint256S("0000000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
}
if (ASSETCHAINS_LWMAPOS != 0)
{
pCurrentParams->consensus.posLimit = uint256S("000000000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
pCurrentParams->consensus.nPOSAveragingWindow = 45;
// spacing is 1000 units per block to get better resolution, POS is 50% hard coded for now, we can vary it later
// when we get reliable integer math on nLwmaPOSAjustedWeight
pCurrentParams->consensus.nPOSTargetSpacing = VERUS_BLOCK_POSUNITS * 2;
// nLwmaPOSAjustedWeight = (N+1)/2 * (0.9989^(500/nPOSAveragingWindow)) * nPOSTargetSpacing
// this needs to be recalculated if VERUS_BLOCK_POSUNITS is changed
pCurrentParams->consensus.nLwmaPOSAjustedWeight = 46531;
}
// only require coinbase protection on Verus from the Komodo family of coins
if (strcmp(ASSETCHAINS_SYMBOL,"VRSC") == 0)
{
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = 227520;
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = 227520;
pCurrentParams->consensus.fCoinbaseMustBeProtected = true;
checkpointData = //(Checkpoints::CCheckpointData)
{
boost::assign::map_list_of
(0, pCurrentParams->consensus.hashGenesisBlock)
(10000, uint256S("0xac2cd7d37177140ea4991cf630c0b9c7f94d707b84fb0351bf3a44856d2ae5dc"))
(20000, uint256S("0xb0e8cb9f77aaa7ff5bd90d6c08d06f4c4bf03e00c2b8a35a042e760845590c8a"))
(30000, uint256S("0xf2112ca577338ad7104bf905fa6a63d36b17a86f914c97b73cd31d43fcd7557c"))
(40000, uint256S("0x00000000008f83378dab727864b763ce91a4ea5f75d55939c0c1390cfb8c38f1"))
(49170, uint256S("0x2add646c0089871ec2379f02f7cd60b3af6efd9c152a6f16fc10925458c270cc")),
(int64_t)1529910234, // * UNIX timestamp of last checkpoint block
(int64_t)63661, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
(double)2777 // * estimated number of transactions per day after checkpoint
// total number of tx / (checkpoint block height / (24 * 24))
};
pCurrentParams->consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000001a8f4f23f8b2d1f7e");
}
else
{
if (strcmp(ASSETCHAINS_SYMBOL,"VRSCTEST") == 0 || strcmp(ASSETCHAINS_SYMBOL,"VERUSTEST") == 0)
{
pCurrentParams->consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000001f7e");
}
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = ASSETCHAINS_SAPLING;
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = ASSETCHAINS_OVERWINTER;
checkpointData = //(Checkpoints::CCheckpointData)
{
boost::assign::map_list_of
(0, pCurrentParams->consensus.hashGenesisBlock),
(int64_t)1231006505,
(int64_t)1,
(double)2777 // * estimated number of transactions per day after checkpoint
// total number of tx / (checkpoint block height / (24 * 24))
};
}
}
else
{
checkpointData = //(Checkpoints::CCheckpointData)
{
boost::assign::map_list_of
(0, pCurrentParams->consensus.hashGenesisBlock)
( 5000, uint256S("0x049cfc91eef411e96603a42c9a77c5e30e9fe96f783ab818f4c00fb56fb29b6c"))
( 10000, uint256S("0x0a0169db3614311cd4181deb73cfcf7f640e7dc956cda34e0121a0351925e9ae"))
( 15000, uint256S("0x00f0bd236790e903321a2d22f85bd6bf8a505f6ef4eddb20458a65d37e14d142"))
( 20000, uint256S("0x01bbf0c38892bdcced62b538329cf63bc7badca3e7e1bff8eb10345436871c6e"))
( 25000, uint256S("0x04ca27808268dda8f942b647a6df844be1b263a661a13740293db962022d1f9e"))
( 30000, uint256S("0x04c9e8cfbcd37399085e529b50147de8afb80c76c48752c122d56f23316a7acb"))
( 35000, uint256S("0x00815f1240354cff7487c67f7dff78e248cb9053ed2c92751d1a9ad42d3eaedf"))
( 40000, uint256S("0x00eafd9dfb1e5f1bf1cca0c49be628538900daf69b665464443d29c2c3b6a2fe"))
( 45000, uint256S("0x0377730632caf694b92f40d03ae0fbe5bd86a1205014b71d975453ac793b0af9"))
( 50000, uint256S("0x00076e16d3fa5194da559c17cf9cf285e21d1f13154ae4f7c7b87919549345aa"))
( 55000, uint256S("0x0005a0701a83e05b639418ea4c87018544a4d22b2b49e5f111161e8ffc455108"))
( 60000, uint256S("0x0000296fc15f8599b7c6561d0e0a96f24766135ed79107b603d6dd6e55142c0d"))
( 65000, uint256S("0x000861f5d7970d5399733b4605074d47f877d6536f74ffae6f08e871ee29e6f2"))
( 70000, uint256S("0x0002af1d487c567526c517b52996944dca344e139cddca77c2e72f746e73b263"))
( 75000, uint256S("0x0d08129659be5f105e70c047769359eaf3475d61a726750859fdca3e1a2bf5cc"))
( 80000, uint256S("0x0af5f3f1caae4f08c74a82689731d1ef8e55107c06f9a996e251b8ecb96989ad"))
( 85000, uint256S("0x00000c8ee29086c5fb39eddad0619773b9ce936c77c13e5e5118a4998e939544"))
( 90000, uint256S("0x06d3bb7f9ee5b55f67b2dc13c680699a2f736f43a44b4e4cfd41a58aa00f063f"))
( 95000, uint256S("0x0670981b269879aae83a88f6f0c4db34763c93fd410d96435f2acb4e6580b976"))
( 100000, uint256S("0x0f02eb1f3a4b89df9909fec81a4bd7d023e32e24e1f5262d9fc2cc36a715be6f"))
( 105000, uint256S("0x018b97d7e6d259add24afe0e08fc125dc21d734e8831b68b430f5c3896deb4af"))
( 110000, uint256S("0x09644ff52734e0e911a9ba7ecd03cf7995b25301840a9637891ef9af69f59c32"))
( 115000, uint256S("0x0ee382b4729b8ceb918a92913f9c144a6a4f8a50bfc0f8b4aac5b12592caed7f"))
( 120000, uint256S("0x082a7918a0dd9cb2df65f55acb8d0a4a535b3fa684d92c3ebcb24ed7019d975b"))
( 125000, uint256S("0x00008f76c4484fd539c9d02fc69c40a50b6f9e00984d33890b85cc0324159e9e"))
( 130000, uint256S("0x011b09e53acfe46f310e8c960a9c4f4f490cc7b2cd3791d7a6a80d6e8ac96b36"))
( 135000, uint256S("0x01e0cd48358fa05646baa6f00e26717474d6049a537c8861b324d1f497dc3d4a"))
( 140000, uint256S("0x0e6db36fd8a9d1b7baf359c8bd5c76635d0bcada973a75b5d2028ca3baea4961"))
( 145000, uint256S("0x00010c40b57316ce6cde076807c9db956452a3c82cb09fe7d56c6bb1a7e24726"))
( 150000, uint256S("0x0a817f15b9da636f453a7a01835cfc534ed1a55ce7f08c566471d167678bedce"))
( 155000, uint256S("0x0528084fd00223bd9747635d7a4d8cc79f158795cad654efb78e4e4cc5f23d6a"))
( 160000, uint256S("0x00003a09f26ae9fb7ebbfa3ef589b81ccd8909a82430f7414bc68d5a5a3316ab"))
( 165000, uint256S("0x00004a0c6a29e7d1f22ea4e44d05e861fec5fcd8eebc5a61574c4ecf29dbb9be"))
( 170000, uint256S("0x0cf9eac27badc0ae9a2b370dd7cc3fcb550f139349551e60978f394a2e1b262b"))
( 175000, uint256S("0x0000137856b825d431da27ff4c3cf22f5482fa21952d45b0db0ec6774fb9b510"))
( 180000, uint256S("0x000000b0afcccf98aa0afb6ac61050892bd9415857d66313d1f67fd1bbac312f"))
( 185000, uint256S("0x00c2af8f88d84de080067f8ae1c25754e32e5516d20c11f85b9adae2d683687b"))
( 190000, uint256S("0x00000033d85b3e7d19e02278ef300b8ab957d3dd3e58b4c81166ba0a58af5c3f"))
( 195000, uint256S("0x000000964b6068be1dd4ee6893d183e86cba82a2744fb5439c463d0ba7e053b6"))
( 200000, uint256S("0x000001763a9337328651ca57ac487cc0507087be5838fb74ca4165ff19f0e84f"))
( 205000, uint256S("0x049fc6832e64a75ae898b32804e151e7561ea49082858c3d4af89a7de4b82f06"))
( 210000, uint256S("0x0000000d9078b9c9604cc663eafafba8f3643bb3f3ddbb78fed4993236e1edb5"))
( 215000, uint256S("0x00060089ecc21bcc62094e2f7f0448fe163415f6ef2f2aafe047757889ca82fe"))
( 220000, uint256S("0x000082c78e6c2a13a9c23dd7a6faaf962fc133142b4a2d07725561f59c03bfa2"))
( 225000, uint256S("0x00030026483167fe13505cf27049307ce42e0d9c5aa093aed10baa4f49edf4ca"))
( 230000, uint256S("0x000183a3e17988060a35776b99c1f0b43393bbe7153b2718dfc57f428191de4e"))
( 235000, uint256S("0x000184995f0ec024ed3783e322c8cfa5e68d9f0c77c3aaea301b22d311619156"))
( 240000, uint256S("0x0000002cc7cf6d0a44ab57f9bd3bfa11a865bbf1cd87a2081095bc90981633a3"))
( 245000, uint256S("0x004c5f19a88c8fe8a604006dbd2d44c94baef2a00876a17d8e2be2124003f979"))
( 250000, uint256S("0x0dd54ef5f816c7fde9d2b1c8c1a26412b3c761cc5dd3901fa5c4cd1900892fba"))
( 255000, uint256S("0x0b6da9e4f50c8bc7a92c539bc7474ffd6c29e0a8531f0dbbbc261fff1f990827"))
( 260000, uint256S("0x0cac8b12bf7233ee5a68fcde9e251852b177833fefa2a9f39ec28474b0851cb9"))
( 265000, uint256S("0x04feb5b4029f3b8b8eb3e6661a78eadd1a26b4af00ac59b5f05b261afcfd2818"))
( 270000, uint256S("0x01bc5897bd20b8b61acf4989987ba85fbc37d9ebe848924aa8effcb08bf48fe0"))
( 275000, uint256S("0x0416bc29eb5a12231826e546ba90fcd38aeef387ff77b45849cd418a9c1a6f12"))
( 280000, uint256S("0x000007593e9880b171d46bce59aa0cec2a1b1f53d1fd7e8f71ccb2b9182374a4"))
( 285000, uint256S("0x05a338b2d90cd79740221fe8635b7a834f2e486fcbb2464a4294f5a21231a5f5"))
( 290000, uint256S("0x064ca3912cdcd833702d07a530e98bc5c6c1cd738a8825c7240b17cd68ca0cc4"))
( 295000, uint256S("0x036b3bb318d743fd78db983a9aadd52869991d48913c4eebe2a074387d67cc5a"))
( 300000, uint256S("0x000000fa5efd1998959926047727519ed7de06dcf9f2cd92a4f71e907e1312dc"))
( 305000, uint256S("0x00003656231e83de2348755153ed175794696a113d7e8a15c01f90fdb7c2f287"))
( 310000, uint256S("0x0cf6baf727eb931da0813ed8b032648c4766be79e146b0d40c643f9d8edf40f7"))
( 315000, uint256S("0x082469974c152ebe69f1787f0d06aa5d9dd1dc69c880febde7eac2bc800146dd"))
( 320000, uint256S("0x0000063df36b99bfb2516f55cb548a5baed1f2d8ae69c3559dc478c5c2eb32df"))
( 325000, uint256S("0x0cb926b303a1514ba0a2f729af88ccb143517f396e9e0bde09b0736900698e0f"))
( 330000, uint256S("0x000000be3d8bb6e31c3b534819aae7014cbbe9a44ab3e799dc1bfc724c6ab184"))
( 335000, uint256S("0x0d0756608189fd5bbd8ec50e76180074e69e973439cc09df49134e4cb970ed4d"))
( 340000, uint256S("0x0d814eacdb9c97003d703c0ff79b1b97b9ed8615fe12b1afaede946e5fdfe0a7"))
( 345000, uint256S("0x000000c2910f510f1de325d300202da1a391f2719dd378173299151c3da94e85"))
( 350000, uint256S("0x0000000228ef321323f81dae00c98d7960fc7486fb2d881007fee60d1e34653f"))
( 355000, uint256S("0x03e6a55e382b478e0fab9c3584da3629fd9b977986a333a406b24b0d3559bf44"))
( 360000, uint256S("0x0859c86dd718bcb5b58af06389197794e2beea6239653f2e6fa7b8a7433d29ea"))
( 365000, uint256S("0x07896332665c707a8f55398a998e7878e8d2681ba79dd95c2859b1dafc9343d0"))
( 370000, uint256S("0x040efd8c64cf5cf96ecf75468741a8880d1386eb5e349bef0a55116d4023944c"))
( 375000, uint256S("0x053029e7599a09fe6c01203997d7ca738dd4c6d216a433695a0d514def1eccc0"))
( 380000, uint256S("0x0cae44e7a421c389b88a5a204d3e39779e93aeacaab1b693741bf279fd0c8acd"))
( 385000, uint256S("0x0b4032d2c799ba93644231ce57134dd24e13ec0dc267c1ed5912389691d2bd72"))
( 390000, uint256S("0x0afd0f166f33a881ef289af7ea7010d58c4bbd560dee10b561c79e1b8dfd0593"))
( 395000, uint256S("0x083774b88cf1b138d67c242d9b33c54f69d7e901b5e8144dc4a2303ab9927102"))
( 400000, uint256S("0x036d294c5be96f4c0efb28e652eb3968231e87204a823991a85c5fdab3c43ae6"))
( 405000, uint256S("0x0522e33bb2161fb1b33acef9a4a438fcf420dcae8a0b472e234d223d731c42b2"))
( 410000, uint256S("0x0361d06aa807c66b87befea8119a485341d1118b694c3dbb4c3cf0b85ac69e9b"))
( 415000, uint256S("0x072d5653d8673f64ef8b9c655f7b8021072070a072b799013ff6e96de99a59e6"))
( 420000, uint256S("0x013b693d66955be69d4501cb1d307ca323a5c8473e25866ae7e700cdce0c654f"))
( 425000, uint256S("0x0ef0c55af27c6971289a790dee2b2ec728fb9c6555ff9306c07f1083cf0fb4b5"))
( 430000, uint256S("0x0ccbeeaba28291e0316a9cf54c005097c61dc67ba6f32283406d6c83b828da00"))
( 435000, uint256S("0x020ed6b7fe1124400baba7feed463ba0c90e7e6903493fdc1a1a18c4a506055a"))
( 440000, uint256S("0x055aaadca1908abeedc831a3f9115aa31284fc223d010590caf7b612960b61a4"))
( 445000, uint256S("0x06d2327fa25ea7e2be742fc0e45fc4f9adb41811f21be0357f8543c5434df715"))
( 450000, uint256S("0x0906ef1e8dc194f1f03bd4ce1ac8c6992fd721ef2c5ccbf4871ec8cdbb456c18"))
( 455000, uint256S("0x0b8b92eec29eb20262dcf9916f0ca36d6abf0c39d321d3f480a5535cb978db71"))
( 460000, uint256S("0x0cb04591f69a255b1127aaff3bbd59eaa21a5d9cca999de197516c251895c536"))
( 465000, uint256S("0x029985ae78d8bb8fd170aeb3ab02ea76134ed0c19ae00211cc28a61fe5755b88"))
( 470000, uint256S("0x01a2f4b56f37b223e75572862ad1ba956ec179332f8cd40590d7253563c86ba8"))
( 475000, uint256S("0x0a34c6f9d4d9cb8c78c14b8041a7cc1874cfcbb22a34a5c068d1d6ff3ed9fdf0"))
( 480000, uint256S("0x0ebab25030179996ae25969f34f6a297c7ffce1994f9b4186082a47032a9a7dc"))
( 485000, uint256S("0x06a096e6bccf3b85537a30f95db6a414deacc0509bc84da264c2830df1a1d9b0"))
( 490000, uint256S("0x0af828930ef13405cb536b88a3d1d4e0d84dc79ee260402c56bfa86e261c74ff"))
( 495000, uint256S("0x09d44905bfd12849d3c2178b2ba882f8e9d6565b6e4d7a97c70a92bd6de7c5e6"))
( 500000, uint256S("0x0bebdb417f7a51fe0c36fcf94e2ed29895a9a862eaa61601272866a7ecd6391b"))
( 505000, uint256S("0x0c1609f4f3561baa1fc975877948af94d2107c88686a9821bc240016cc87d953"))
( 510000, uint256S("0x0cf9a5a4997b871e615e5e398627e45fa15b3e6970ae22b47bdd11b0f5fa0fa7"))
( 515000, uint256S("0x034171d4819e9961de13309743a32a179abede97d60ea64101dc04c97a1a0807"))
( 520000, uint256S("0x0648fa44d5bbc2cc04a782e083c11df64ac06185f0f8e11a7416625ebb6409a6"))
( 525000, uint256S("0x0000000ef17d63af3159e52cd351b6f000536ad88adc3a937bb747955fed58a2"))
( 530000, uint256S("0x08e3af153995ba09e50086b64145cf4cd57db6b29f16f06f28d80d7f6121cfad"))
( 535000, uint256S("0x02a0ffd00b51e2061b85de50a9223d9c84f4e357dc1046397bb9d7d4a827a3fb"))
( 540000, uint256S("0x04bf07d026af29025c1ac2815e067f4a41d2872701ac9780eb3015d51cdcd854"))
( 545000, uint256S("0x0a0d6d86635946792ad0dca57ed227a5360fc8b6d79e47132aac11e90a4963ce"))
( 550000, uint256S("0x06df52fc5f9ba03ccc3a7673b01ab47990bd5c4947f6e1bc0ba14d21cd5bcccd"))
( 555000, uint256S("0x0baf38eea8e08fcad3a9d760f27377e79c291b08e7fb4920cadd5cb7bab547f3"))
( 560000, uint256S("0x00000004c34abbf1366adbae965b644c01debf15409acc715ff51cb221d92dd7"))
( 565000, uint256S("0x067bae7119f083e0fa1820bc8e25dcfa7717e42aabaef18beefd87d974953dfb"))
( 570000, uint256S("0x00000011a7ce7b628b7be17777d8dea2574d83f165e23c9e44aa705975820fd3"))
( 575000, uint256S("0x0e1110a193a30d3f8d369017233a2486b11c748b3d033859a2eb7b37062d303e"))
( 580000, uint256S("0x083cb58484aff80f48e3537e0451d49e544b3efa3da97274800c91e567d33a92"))
( 585000, uint256S("0x0224cf835428d03472edf4f7b6fcc63b9d8d6f1d5a90ad8186bf123d541b4ea8"))
( 590000, uint256S("0x0cfcf3b9517894e4df49db5faf8b74f3a9e01eb83c0cc5051c115d4424615dae"))
( 595000, uint256S("0x0000000a45266983dd81e0df381a3b0455699b2f76d5b4d3f17b87d657a1b56d"))
( 600000, uint256S("0x00000005080d5689c3b4466e551cd1986e5d2024a62a79b1335afe12c42779e4"))
( 605000, uint256S("0x0000001c691da36848542299af859d4eb3fa408a0f425b1fbe6d622d2100623a"))
( 610000, uint256S("0x040d8c7a0ac89e3ed8605a198583a795986aacbf18722a9897d7b925bcf757f6"))
( 615000, uint256S("0x0449cf00fc36206389c14cbf1d762f8b96bb0440ccea5b46703e7c69b0e2bc42"))
( 620000, uint256S("0x07227a41340c25ee1a7e9b60414259780202ffa990079fc91d8faeac9af03e60"))
( 625000, uint256S("0x047c2472fe2afabb3d38decf24bba4ba712b60e7a1782f4afae3ede3f912f493"))
( 630000, uint256S("0x0a7f1f04e66260cf972ab1374a9126b8abc1adaa3ab4669db5d4d4ddb9ad493d"))
( 635000, uint256S("0x048df95165eb821dabf37ef28cf7f3be72e216e95377684253dab806985b50a4"))
( 640000, uint256S("0x066b3c6a6a3c8dc58bef509a972c3e3ade14493b40e1b361ecbc928134e302be"))
( 645000, uint256S("0x07d059888c9ade3bbe16d6b4d70ee9b8302d104b37a3c6cd61f81012aabd0e1e"))
( 650000, uint256S("0x039a3cb760cc6e564974caf69e8ae621c14567f3a36e4991f77fd869294b1d52"))
( 655000, uint256S("0x089350ee8d28b44837eb4b1fe77704953d5de2077f10c74a888d9d3ea1e13c2a"))
( 660000, uint256S("0x000000023f8a582a61ae2f6fab6fe8197e79b7a68aaac67432421b09f1bdd4ba"))
( 665000, uint256S("0x0b16edce865e7a0d662115774e0c0d3abbf9c69004155b693ddc933f051bfb26"))
( 670000, uint256S("0x09070b109b089490bc372fd8358abae352d6db0e46ade6ed2200e4d4ff7aa6af"))
( 675000, uint256S("0x08d9edeed3b6ac55991e9f32af0218ff8fa9dc808078623f4c831eb09d4f186b"))
( 680000, uint256S("0x00000003eb2b30bfac929d3496acecab19625ac9f854a86aaf9678bea99e1cc1"))
( 681777, uint256S("0x0000243296b9b26c040f471fdd9398ef72e57062cf05c19b9ba2fefac8165306")),
(int64_t)1516924927, // * UNIX timestamp of last checkpoint block
(int64_t)1253783, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
(double)2777 // * estimated number of transactions per day after checkpoint
// total number of tx / (checkpoint block height / (24 * 24))
};
}
pCurrentParams->SetCheckpointData(checkpointData);
ASSETCHAIN_INIT = 1;
return(0);
}

4
src/clientversion.h

@ -33,7 +33,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 !
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_MINOR 2
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 50
@ -56,7 +56,7 @@
#define DO_STRINGIZE(X) #X
//! Copyright string used in Windows .rc files
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers, The Zcash developers, Komodo developers, and Verus developers"
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers, The Zcash developers, Komodo developers, Hush developers and Verus developers"
/**
* bitcoind-res.rc includes this file, but it cannot cope with real c++ code.

2
src/fiat/coqui

@ -1,2 +0,0 @@
#!/bin/bash
./komodo-cli -ac_name=COQUI $1 $2 $3 $4 $5 $6

2
src/fiat/coquicash

@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=COQUICASH $1 $2 $3 $4 $5 $6

2
src/fiat/thc

@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=THC $1 $2 $3 $4 $5 $6

2
src/fiat/vote2018

@ -1,2 +0,0 @@
#!/bin/bash
./komodo-cli -ac_name=VOTE2018 $1 $2 $3 $4 $5 $6

2
src/fiat/vote2019

@ -1,2 +0,0 @@
#!/bin/bash
./komodo-cli -ac_name=VOTE2019 $1 $2 $3 $4 $5 $6

25
src/init.cpp

@ -75,7 +75,9 @@
#include <boost/function.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/thread.hpp>
#include <chrono>
#include <openssl/crypto.h>
#include <thread>
#include <libsnark/common/profiling.hpp>
@ -95,6 +97,7 @@ using namespace std;
extern void ThreadSendAlert();
extern bool komodo_dailysnapshot(int32_t height);
extern int32_t KOMODO_LOADINGBLOCKS;
extern void komodo_init(int32_t height);
ZCJoinSplit* pzcashParams = NULL;
@ -728,6 +731,22 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
}
}
void ThreadNotifyRecentlyAdded()
{
while (true) {
// Run the notifier on an integer second in the steady clock.
auto now = std::chrono::steady_clock::now().time_since_epoch();
auto nextFire = std::chrono::duration_cast<std::chrono::seconds>(
now + std::chrono::seconds(1));
std::this_thread::sleep_until(
std::chrono::time_point<std::chrono::steady_clock>(nextFire));
boost::this_thread::interruption_point();
mempool.NotifyRecentlyAdded();
}
}
/** Sanity checks
* Ensure that Bitcoin is running in a usable environment with all
* necessary library support.
@ -1653,7 +1672,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// (we're likely using a testnet datadir, or the other way around).
if (!mapBlockIndex.empty() && mapBlockIndex.count(chainparams.GetConsensus().hashGenesisBlock) == 0)
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
komodo_init(1);
// Initialize the block index (no-op if non-empty database was already loaded)
if (!InitBlockIndex()) {
strLoadError = _("Error initializing block database");
@ -1994,6 +2013,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
#endif
// Start the thread that notifies listeners of transactions that have been
// recently added to the mempool.
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "txnotify", &ThreadNotifyRecentlyAdded));
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
StartTorControl(threadGroup, scheduler);

6
src/komodo-tx.cpp

@ -80,10 +80,10 @@ static int AppInitRawTx(int argc, char* argv[])
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help"))
{
// First part of help message is specific to this utility
std::string strUsage = _("Zcash zcash-tx utility version") + " " + FormatFullVersion() + "\n\n" +
std::string strUsage = _("Hush komodo-tx utility version") + " " + FormatFullVersion() + "\n\n" +
_("Usage:") + "\n" +
" zcash-tx [options] <hex-tx> [commands] " + _("Update hex-encoded zcash transaction") + "\n" +
" zcash-tx [options] -create [commands] " + _("Create hex-encoded zcash transaction") + "\n" +
" komodo-tx [options] <hex-tx> [commands] " + _("Update hex-encoded zcash transaction") + "\n" +
" komodo-tx [options] -create [commands] " + _("Create hex-encoded zcash transaction") + "\n" +
"\n";
fprintf(stdout, "%s", strUsage.c_str());

3
src/komodo_nSPV_defs.h

@ -17,7 +17,7 @@
#ifndef KOMODO_NSPV_DEFSH
#define KOMODO_NSPV_DEFSH
#define NSPV_PROTOCOL_VERSION 0x00000003
#define NSPV_PROTOCOL_VERSION 0x00000004
#define NSPV_POLLITERS 200
#define NSPV_POLLMICROS 50000
#define NSPV_MAXVINS 64
@ -49,6 +49,7 @@
#define NSPV_MEMPOOL_ISSPENT 2
#define NSPV_MEMPOOL_INMEMPOOL 3
#define NSPV_MEMPOOL_CCEVALCODE 4
#define NSPV_CC_TXIDS 16
int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int32_t height,CTransaction &tx,uint256 &hashblock,int32_t &txheight,int32_t &currentheight,int64_t extradata,uint32_t tiptime,int64_t &rewardsum);
UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis);

84
src/komodo_nSPV_fullnode.h

@ -208,13 +208,8 @@ int32_t NSPV_getaddressutxos(struct NSPV_utxosresp *ptr,char *coinaddr,bool isCC
int32_t NSPV_getaddresstxids(struct NSPV_txidsresp *ptr,char *coinaddr,bool isCC,int32_t skipcount,uint32_t filter)
{
int32_t maxlen,txheight,ind=0,n = 0,len = 0; CTransaction tx; uint256 hashBlock,filtertxid;
int32_t maxlen,txheight,ind=0,n = 0,len = 0; CTransaction tx; uint256 hashBlock;
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
if (ptr->txids!=0)
{
filtertxid=ptr->txids[0].txid;
free(ptr->txids);
}
SetCCtxids(txids,coinaddr,isCC);
ptr->nodeheight = chainActive.LastTip()->GetHeight();
maxlen = MAX_BLOCK_SIZE(ptr->nodeheight) - 512;
@ -236,32 +231,6 @@ int32_t NSPV_getaddresstxids(struct NSPV_txidsresp *ptr,char *coinaddr,bool isCC
{
if ( n >= skipcount )
{
if (filter&0xFF!=0)
{
myGetTransaction(it->first.txhash,tx,hashBlock);
std::vector<std::pair<uint8_t, vscript_t>> oprets; uint256 tokenid,txid;
std::vector<uint8_t> vopret,vOpretExtra; uint8_t *script,e,f,tokenevalcode;
std::vector<CPubKey> pubkeys;
if (DecodeTokenOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,tokenevalcode,tokenid,pubkeys,oprets)!=0 && GetOpretBlob(oprets, OPRETID_CHANNELSDATA, vOpretExtra) && tokenevalcode==EVAL_TOKENS && vOpretExtra.size()>0)
{
vopret=vOpretExtra;
}
else GetOpReturnData(tx.vout[tx.vout.size()-1].scriptPubKey, vopret);
script = (uint8_t *)vopret.data();
if ( vopret.size() > 2 && script[0]==filter&0xFF )
{
switch (filter&0xFF)
{
case EVAL_CHANNELS:EVAL_PEGS:EVAL_ORACLES:
E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> txid;);
if (txid!=filtertxid && e==filter&0xFF) continue;
break;
default:
break;
}
}
}
ptr->txids[ind].txid = it->first.txhash;
ptr->txids[ind].vout = (int32_t)it->first.index;
ptr->txids[ind].satoshis = (int64_t)it->second;
@ -286,6 +255,57 @@ int32_t NSPV_mempoolfuncs(bits256 *satoshisp,int32_t *vindexp,std::vector<uint25
int32_t num = 0,vini = 0,vouti = 0; uint8_t evalcode=0,func=0; std::vector<uint8_t> vopret; char destaddr[64];
*vindexp = -1;
memset(satoshisp,0,sizeof(*satoshisp));
if ( funcid == NSPV_CC_TXIDS)
{
std::vector<std::pair<CAddressIndexKey, CAmount> > tmp_txids; uint256 tmp_txid,hashBlock;
int32_t n=0,skipcount=vout>>16; uint8_t eval=(vout>>8)&0xFF, func=vout&0xFF;
CTransaction tx;
SetCCtxids(tmp_txids,coinaddr,isCC);
if ( skipcount < 0 ) skipcount = 0;
if ( skipcount >= tmp_txids.size() )
skipcount = tmp_txids.size()-1;
if ( tmp_txids.size()-skipcount > 0 )
{
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=tmp_txids.begin(); it!=tmp_txids.end(); it++)
{
if (txid!=zeroid || func!=0)
{
myGetTransaction(it->first.txhash,tx,hashBlock);
std::vector<std::pair<uint8_t, vscript_t>> oprets; uint256 tokenid,txid;
std::vector<uint8_t> vopret,vOpretExtra; uint8_t *script,e,f,tokenevalcode;
std::vector<CPubKey> pubkeys;
if (DecodeTokenOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,tokenevalcode,tokenid,pubkeys,oprets)!=0 && GetOpretBlob(oprets, OPRETID_CHANNELSDATA, vOpretExtra) && tokenevalcode==EVAL_TOKENS && vOpretExtra.size()>0)
{
vopret=vOpretExtra;
}
else GetOpReturnData(tx.vout[tx.vout.size()-1].scriptPubKey, vopret);
script = (uint8_t *)vopret.data();
if ( vopret.size() > 2 && script[0]==eval )
{
switch (eval)
{
case EVAL_CHANNELS:EVAL_PEGS:EVAL_ORACLES:EVAL_GAMES:EVAL_IMPORTGATEWAY:EVAL_ROGUE:
E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> tmp_txid;);
if (e!=eval || (txid!=zeroid && txid!=tmp_txid) || (func!=0 && f!=func)) continue;
break;
case EVAL_TOKENS:EVAL_DICE:EVAL_DILITHIUM:EVAL_FAUCET:EVAL_LOTO:EVAL_PAYMENTS:EVAL_REWARDS:
E_UNMARSHAL(vopret,ss >> e; ss >> f;);
if (e!=eval || (func!=0 && f!=func)) continue;
break;
default:
break;
}
}
}
if ( n >= skipcount ) txids.push_back(it->first.txhash);
n++;
}
return (n-skipcount);
}
return (0);
}
if ( mempool.size() == 0 )
return(0);
if ( funcid == NSPV_MEMPOOL_CCEVALCODE )

46
src/komodo_nSPV_superlite.h

@ -621,7 +621,7 @@ UniValue NSPV_addressutxos(char *coinaddr,int32_t CCflag,int32_t skipcount,int32
return(result);
}
UniValue NSPV_addresstxids(char *coinaddr,int32_t CCflag,int32_t skipcount,int32_t filter, uint256 filtertxid)
UniValue NSPV_addresstxids(char *coinaddr,int32_t CCflag,int32_t skipcount,int32_t filter)
{
UniValue result(UniValue::VOBJ); uint8_t msg[512]; int32_t i,iter,slen,len = 0;
if ( NSPV_txidsresult.nodeheight >= NSPV_inforesult.height && strcmp(coinaddr,NSPV_txidsresult.coinaddr) == 0 && CCflag == NSPV_txidsresult.CCflag && skipcount == NSPV_txidsresult.skipcount )
@ -642,11 +642,6 @@ UniValue NSPV_addresstxids(char *coinaddr,int32_t CCflag,int32_t skipcount,int32
msg[len++] = (CCflag != 0);
len += iguana_rwnum(1,&msg[len],sizeof(skipcount),&skipcount);
len += iguana_rwnum(1,&msg[len],sizeof(filter),&filter);
if (filtertxid!=zeroid)
{
NSPV_txidsresult.txids = (struct NSPV_txidresp *)malloc(sizeof(NSPV_txidsresult.txids));
NSPV_txidsresult.txids[0].txid=filtertxid;
}
//fprintf(stderr,"skipcount.%d\n",skipcount);
for (iter=0; iter<3; iter++)
if ( NSPV_req(0,msg,len,NODE_ADDRINDEX,msg[0]>>1) != 0 )
@ -664,6 +659,45 @@ UniValue NSPV_addresstxids(char *coinaddr,int32_t CCflag,int32_t skipcount,int32
return(result);
}
UniValue NSPV_ccaddresstxids(char *coinaddr,int32_t CCflag,int32_t skipcount,uint256 filtertxid,uint8_t evalcode, uint8_t func)
{
UniValue result(UniValue::VOBJ); uint8_t msg[512],funcid=NSPV_CC_TXIDS; char zeroes[64]; int32_t i,iter,slen,len = 0,vout;
NSPV_mempoolresp_purge(&NSPV_mempoolresult);
memset(zeroes,0,sizeof(zeroes));
if ( coinaddr == 0 )
coinaddr = zeroes;
if ( coinaddr[0] != 0 && bitcoin_base58decode(msg,coinaddr) != 25 )
{
result.push_back(Pair("result","error"));
result.push_back(Pair("error","invalid address"));
return(result);
}
vout=skipcount << 16 | evalcode << 8 | func;
msg[len++] = NSPV_MEMPOOL;
msg[len++] = (CCflag != 0);
len += iguana_rwnum(1,&msg[len],sizeof(funcid),&funcid);
len += iguana_rwnum(1,&msg[len],sizeof(vout),&vout);
len += iguana_rwbignum(1,&msg[len],sizeof(filtertxid),(uint8_t *)&filtertxid);
slen = (int32_t)strlen(coinaddr);
msg[len++] = slen;
memcpy(&msg[len],coinaddr,slen), len += slen;
fprintf(stderr,"(%s) func.%d CC.%d %s skipcount.%d len.%d\n",coinaddr,NSPV_CC_TXIDS,CCflag,filtertxid.GetHex().c_str(),skipcount,len);
for (iter=0; iter<3; iter++)
if ( NSPV_req(0,msg,len,NODE_NSPV,msg[0]>>1) != 0 )
{
for (i=0; i<NSPV_POLLITERS; i++)
{
usleep(NSPV_POLLMICROS);
if ( NSPV_mempoolresult.nodeheight >= NSPV_inforesult.height && strcmp(coinaddr,NSPV_mempoolresult.coinaddr) == 0 && CCflag == NSPV_mempoolresult.CCflag && filtertxid == NSPV_mempoolresult.txid && vout == NSPV_mempoolresult.vout && funcid == NSPV_mempoolresult.funcid )
return(NSPV_mempoolresp_json(&NSPV_mempoolresult));
}
} else sleep(1);
result.push_back(Pair("result","error"));
result.push_back(Pair("error","no txid result"));
result.push_back(Pair("lastpeer",NSPV_lastpeer));
return(result);
}
UniValue NSPV_mempooltxids(char *coinaddr,int32_t CCflag,uint8_t funcid,uint256 txid,int32_t vout)
{
UniValue result(UniValue::VOBJ); uint8_t msg[512]; char zeroes[64]; int32_t i,iter,slen,len = 0;

9
src/komodo_nSPV_wallet.h

@ -522,15 +522,14 @@ void NSPV_CCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentVa
void NSPV_CCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &txids,char *coinaddr,bool ccflag)
{
int32_t filter = 0;
NSPV_addresstxids(coinaddr,ccflag,0,filter,zeroid);
NSPV_addresstxids(coinaddr,ccflag,0,filter);
NSPV_txids2CCtxids(&NSPV_txidsresult,txids);
}
void NSPV_CCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &txids,char *coinaddr,bool ccflag, uint8_t evalcode,uint256 filtertxid)
void NSPV_CCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_t evalcode,uint256 filtertxid, uint8_t func)
{
int32_t filter = evalcode;
NSPV_addresstxids(coinaddr,ccflag,0,filter,filtertxid);
NSPV_txids2CCtxids(&NSPV_txidsresult,txids);
NSPV_ccaddresstxids(coinaddr,ccflag,0,filtertxid,evalcode,func);
for(int i=0;i<NSPV_mempoolresult.numtxids;i++) txids.push_back(NSPV_mempoolresult.txids[i]);
}
#endif // KOMODO_NSPVWALLET_H

33
src/komodo_notary.h

@ -339,33 +339,44 @@ int32_t komodo_prevMoMheight()
int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp)
{
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
*prevMoMheightp = 0;
memset(hashp,0,sizeof(*hashp));
memset(txidp,0,sizeof(*txidp));
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
{
*hashp = sp->NOTARIZED_HASH;
*txidp = sp->NOTARIZED_DESTTXID;
*prevMoMheightp = komodo_prevMoMheight();
CBlockIndex *pindex;
if ( (pindex= komodo_blockindex(sp->NOTARIZED_HASH)) == 0 || pindex->GetHeight() < 0 )
{
//fprintf(stderr,"found orphaned notarization at ht.%d pindex.%p\n",sp->NOTARIZED_HEIGHT,(void *)pindex);
memset(&sp->NOTARIZED_HASH,0,sizeof(sp->NOTARIZED_HASH));
memset(&sp->NOTARIZED_DESTTXID,0,sizeof(sp->NOTARIZED_DESTTXID));
sp->NOTARIZED_HEIGHT = 0;
}
else
{
*hashp = sp->NOTARIZED_HASH;
*txidp = sp->NOTARIZED_DESTTXID;
*prevMoMheightp = komodo_prevMoMheight();
}
return(sp->NOTARIZED_HEIGHT);
}
else
{
*prevMoMheightp = 0;
memset(hashp,0,sizeof(*hashp));
memset(txidp,0,sizeof(*txidp));
return(0);
}
} else return(0);
}
int32_t komodo_dpowconfs(int32_t txheight,int32_t numconfs)
{
static int32_t hadnotarization;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
if ( KOMODO_DPOWCONFS != 0 && txheight > 0 && numconfs > 0 && (sp= komodo_stateptr(symbol,dest)) != 0 )
{
if ( sp->NOTARIZED_HEIGHT > 0 )
{
hadnotarization = 1;
if ( txheight < sp->NOTARIZED_HEIGHT )
return(numconfs);
else return(1);
}
else if ( hadnotarization != 0 )
return(1);
}
return(numconfs);
}

24
src/main.cpp

@ -1923,7 +1923,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// Bring the best block into scope
view.GetBestBlock();
nValueIn = view.GetValueIn(chainActive.LastTip()->GetHeight(),&interest,tx,chainActive.LastTip()->nTime);
if (!fSkipExpiry)
nValueIn = view.GetValueIn(chainActive.LastTip()->GetHeight(),&interest,tx,chainActive.LastTip()->nTime);
if ( 0 && interest != 0 )
fprintf(stderr,"add interest %.8f\n",(double)interest/COIN);
// we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool
@ -1931,7 +1932,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
}
// Check for non-standard pay-to-script-hash in inputs
if (Params().RequireStandard() && !AreInputsStandard(tx, view, consensusBranchId))
if (!fSkipExpiry && Params().RequireStandard() && !AreInputsStandard(tx, view, consensusBranchId))
return error("AcceptToMemoryPool: reject nonstandard transaction input");
// Check that the transaction doesn't have an excessive number of
@ -1940,7 +1941,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// MAX_BLOCK_SIGOPS; we still consider this an invalid rather than
// merely non-standard transaction.
unsigned int nSigOps = GetLegacySigOpCount(tx);
nSigOps += GetP2SHSigOpCount(tx, view);
if (!fSkipExpiry)
nSigOps += GetP2SHSigOpCount(tx, view);
if (nSigOps > MAX_STANDARD_TX_SIGOPS)
{
fprintf(stderr,"accept failure.4\n");
@ -1949,7 +1951,13 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
CAmount nValueOut = tx.GetValueOut();
CAmount nFees = nValueIn-nValueOut;
double dPriority = view.GetPriority(tx, chainActive.Height());
double dPriority = 0;
if (!fSkipExpiry)
{
dPriority = view.GetPriority(tx, chainActive.Height());
nFees = 0;
}
if ( nValueOut > 777777*COIN && KOMODO_VALUETOOBIG(nValueOut - 777777*COIN) != 0 ) // some room for blockreward and txfees
return state.DoS(100, error("AcceptToMemoryPool: GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
@ -1997,7 +2005,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// Continuously rate-limit free (really, very-low-fee) transactions
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to
// be annoying or make others' transactions take longer to confirm.
if (fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) && !tx.IsCoinImport() && !tx.IsPegsImport())
if ( !fSkipExpiry && fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) && !tx.IsCoinImport() && !tx.IsPegsImport())
{
static CCriticalSection csFreeLimiter;
static double dFreeCount;
@ -2020,7 +2028,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
dFreeCount += nSize;
}
if (!tx.IsCoinImport() && !tx.IsPegsImport() && fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000 && nFees > nValueOut/19)
if (!fSkipExpiry && !tx.IsCoinImport() && !tx.IsPegsImport() && fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000 && nFees > nValueOut/19)
{
string errmsg = strprintf("absurdly high fees %s, %d > %d",
hash.ToString(),
@ -2067,7 +2075,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// Store transaction in memory
pool.addUnchecked(hash, entry, !IsInitialBlockDownload());
if (!tx.IsCoinImport())
if (!fSkipExpiry && !tx.IsCoinImport())
{
// Add memory address index
if (fAddressIndex) {
@ -2081,8 +2089,6 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
}
}
SyncWithWallets(tx, NULL);
return true;
}

4
src/rpc/blockchain.cpp

@ -1908,6 +1908,10 @@ UniValue mempoolInfoToJSON()
ret.push_back(Pair("bytes", (int64_t) mempool.GetTotalTxSize()));
ret.push_back(Pair("usage", (int64_t) mempool.DynamicMemoryUsage()));
if (Params().NetworkIDString() == "regtest") {
ret.push_back(Pair("fullyNotified", mempool.IsFullyNotified()));
}
return ret;
}

1
src/rpc/client.cpp

@ -151,6 +151,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "z_mergetoaddress", 2},
{ "z_mergetoaddress", 3},
{ "z_mergetoaddress", 4},
{ "z_viewtransaction", 1},
{ "z_sendmany", 1},
{ "z_sendmany", 2},
{ "z_sendmany", 3},

4
src/rpc/mining.cpp

@ -884,8 +884,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
result.push_back(Pair("origtarget", hashTarget.GetHex()));
}
/*else if ( ASSETCHAINS_ADAPTIVEPOW > 0 )
result.push_back(Pair("target",komodo_adaptivepow_target((int32_t)(pindexPrev->GetHeight()+1),hashTarget,pblock->nTime).GetHex()));
else*/
result.push_back(Pair("target",komodo_adaptivepow_target((int32_t)(pindexPrev->GetHeight()+1),hashTarget,pblock->nTime).GetHex()));*/
else
result.push_back(Pair("target", hashTarget.GetHex()));
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1));
result.push_back(Pair("mutable", aMutable));

47
src/txmempool.cpp

@ -29,6 +29,7 @@
#include "timedata.h"
#include "util.h"
#include "utilmoneystr.h"
#include "validationinterface.h"
#include "version.h"
#define _COINBASE_MATURITY 100
@ -119,6 +120,8 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry,
LOCK(cs);
mapTx.insert(entry);
const CTransaction& tx = mapTx.find(hash)->GetTx();
mapRecentlyAddedTx[tx.GetHash()] = &tx;
nRecentlyAddedSequence += 1;
if (!tx.IsCoinImport()) {
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
@ -365,6 +368,7 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& rem
txToRemove.push_back(it->second.ptx->GetHash());
}
}
mapRecentlyAddedTx.erase(hash);
BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapNextTx.erase(txin.prevout);
BOOST_FOREACH(const JSDescription& joinsplit, tx.vjoinsplit) {
@ -838,6 +842,49 @@ bool CTxMemPool::nullifierExists(const uint256& nullifier, ShieldedType type) co
}
}
void CTxMemPool::NotifyRecentlyAdded()
{
uint64_t recentlyAddedSequence;
std::vector<CTransaction> txs;
{
LOCK(cs);
recentlyAddedSequence = nRecentlyAddedSequence;
for (const auto& kv : mapRecentlyAddedTx) {
txs.push_back(*(kv.second));
}
mapRecentlyAddedTx.clear();
}
// A race condition can occur here between these SyncWithWallets calls, and
// the ones triggered by block logic (in ConnectTip and DisconnectTip). It
// is harmless because calling SyncWithWallets(_, NULL) does not alter the
// wallet transaction's block information.
for (auto tx : txs) {
try {
SyncWithWallets(tx, NULL);
} catch (const boost::thread_interrupted&) {
throw;
} catch (const std::exception& e) {
PrintExceptionContinue(&e, "CTxMemPool::NotifyRecentlyAdded()");
} catch (...) {
PrintExceptionContinue(NULL, "CTxMemPool::NotifyRecentlyAdded()");
}
}
// Update the notified sequence number. We only need this in regtest mode,
// and should not lock on cs after calling SyncWithWallets otherwise.
if (Params().NetworkIDString() == "regtest") {
LOCK(cs);
nNotifiedSequence = recentlyAddedSequence;
}
}
bool CTxMemPool::IsFullyNotified() {
assert(Params().NetworkIDString() == "regtest");
LOCK(cs);
return nRecentlyAddedSequence == nNotifiedSequence;
}
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView *baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
bool CCoinsViewMemPool::GetNullifier(const uint256 &nf, ShieldedType type) const

7
src/txmempool.h

@ -148,6 +148,10 @@ private:
uint64_t totalTxSize = 0; //! sum of all mempool tx' byte sizes
uint64_t cachedInnerUsage; //! sum of dynamic memory usage of all the map elements (NOT the maps themselves)
std::map<uint256, const CTransaction*> mapRecentlyAddedTx;
uint64_t nRecentlyAddedSequence = 0;
uint64_t nNotifiedSequence = 0;
std::map<uint256, const CTransaction*> mapSproutNullifiers;
std::map<uint256, const CTransaction*> mapSaplingNullifiers;
@ -234,6 +238,9 @@ public:
bool nullifierExists(const uint256& nullifier, ShieldedType type) const;
void NotifyRecentlyAdded();
bool IsFullyNotified();
unsigned long size()
{
LOCK(cs);

6
src/wallet/rpcdump.cpp

@ -983,7 +983,7 @@ uint256 zeroid;
UniValue NSPV_getinfo_req(int32_t reqht);
UniValue NSPV_login(char *wifstr);
UniValue NSPV_logout();
UniValue NSPV_addresstxids(char *coinaddr,int32_t CCflag,int32_t skipcount,int32_t filter, uint256 filtertxid);
UniValue NSPV_addresstxids(char *coinaddr,int32_t CCflag,int32_t skipcount,int32_t filter);
UniValue NSPV_addressutxos(char *coinaddr,int32_t CCflag,int32_t skipcount,int32_t filter);
UniValue NSPV_mempooltxids(char *coinaddr,int32_t CCflag,uint8_t funcid,uint256 txid,int32_t vout);
UniValue NSPV_broadcast(char *hex);
@ -1080,7 +1080,7 @@ UniValue nspv_listtransactions(const UniValue& params, bool fHelp)
if ( params.size() == 0 )
{
if ( NSPV_address.size() != 0 )
return(NSPV_addresstxids((char *)NSPV_address.c_str(),0,0,0,zeroid));
return(NSPV_addresstxids((char *)NSPV_address.c_str(),0,0,0));
else throw runtime_error("nspv_listtransactions [address [isCC [skipcount]]]\n");
}
if ( params.size() >= 1 )
@ -1090,7 +1090,7 @@ UniValue nspv_listtransactions(const UniValue& params, bool fHelp)
if ( params.size() == 3 )
skipcount = atoi((char *)params[2].get_str().c_str());
//fprintf(stderr,"call txids cc.%d skip.%d\n",CCflag,skipcount);
return(NSPV_addresstxids((char *)params[0].get_str().c_str(),CCflag,skipcount,0,zeroid));
return(NSPV_addresstxids((char *)params[0].get_str().c_str(),CCflag,skipcount,0));
}
else throw runtime_error("nspv_listtransactions [address [isCC [skipcount]]]\n");
}

256
src/wallet/rpcwallet.cpp

@ -53,6 +53,7 @@
#include <stdint.h>
#include <boost/assign/list_of.hpp>
#include <utf8.h>
#include <univalue.h>
@ -342,7 +343,7 @@ UniValue setaccount(const UniValue& params, bool fHelp)
CTxDestination dest = DecodeDestination(params[0].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!");
}
string strAccount;
@ -389,7 +390,7 @@ UniValue getaccount(const UniValue& params, bool fHelp)
CTxDestination dest = DecodeDestination(params[0].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!");
}
std::string strAccount;
@ -449,7 +450,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
if (nValue > curBalance)
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
// Parse Zcash address
// Parse Hush address
CScript scriptPubKey = GetScriptForDestination(address);
// Create and send the transaction
@ -523,7 +524,7 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp)
CTxDestination dest = DecodeDestination(params[0].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!");
}
// Amount
@ -935,7 +936,7 @@ UniValue getreceivedbyaddress(const UniValue& params, bool fHelp)
// Bitcoin address
CTxDestination dest = DecodeDestination(params[0].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!");
}
CScript scriptPubKey = GetScriptForDestination(dest);
if (!IsMine(*pwalletMain, scriptPubKey)) {
@ -1389,7 +1390,7 @@ UniValue sendfrom(const UniValue& params, bool fHelp)
std::string strAccount = AccountFromValue(params[0]);
CTxDestination dest = DecodeDestination(params[1].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!");
}
CAmount nAmount = AmountFromValue(params[2]);
if (nAmount <= 0)
@ -1486,7 +1487,7 @@ UniValue sendmany(const UniValue& params, bool fHelp)
for (const std::string& name_ : keys) {
CTxDestination dest = DecodeDestination(name_);
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Zcash address: ") + name_);
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Hush address: ") + name_);
}
CScript scriptPubKey = GetScriptForDestination(dest);
@ -2859,7 +2860,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
" \"txid\" : \"txid\", (string) the transaction id \n"
" \"vout\" : n, (numeric) the vout value\n"
" \"generated\" : true|false (boolean) true if txout is a coinbase transaction output\n"
" \"address\" : \"address\", (string) the Zcash address\n"
" \"address\" : \"address\", (string) the Hush address\n"
" \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n"
" \"scriptPubKey\" : \"key\", (string) the script key\n"
" \"amount\" : x.xxx, (numeric) the transaction amount in " + CURRENCY_UNIT + "\n"
@ -2893,7 +2894,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
const UniValue& input = inputs[idx];
CTxDestination dest = DecodeDestination(input.get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Zcash address: ") + input.get_str());
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Hush address: ") + input.get_str());
}
if (!destinations.insert(dest).second) {
throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated address: ") + input.get_str());
@ -3017,13 +3018,12 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
"Optionally filter to only include notes sent to specified addresses.\n"
"When minconf is 0, unspent notes with zero confirmations are returned, even though they are not immediately spendable.\n"
"Results are an array of Objects, each of which has:\n"
"{txid, jsindex, jsoutindex, confirmations, address, amount, memo} (Sprout)\n"
"{txid, outindex, confirmations, address, amount, memo} (Sapling)\n"
"\nArguments:\n"
"1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
"2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"
"3. includeWatchonly (bool, optional, default=false) Also include watchonly addresses (see 'z_importviewingkey')\n"
"4. \"addresses\" (string) A json array of zaddrs (both Sprout and Sapling) to filter on. Duplicate addresses not allowed.\n"
"4. \"addresses\" (string) A json array of zaddrs to filter on. Duplicate addresses not allowed.\n"
" [\n"
" \"address\" (string) zaddr\n"
" ,...\n"
@ -3033,7 +3033,6 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
" {\n"
" \"txid\" : \"txid\", (string) the transaction id \n"
" \"jsindex\" : n (numeric) the joinsplit index\n"
" \"jsoutindex\" (sprout) : n (numeric) the output index of the joinsplit\n"
" \"outindex\" (sapling) : n (numeric) the output index\n"
" \"confirmations\" : n (numeric) the number of confirmations\n"
" \"spendable\" : true|false (boolean) true if note can be spent by wallet, false if note has zero confirmations, false if address is watchonly\n"
@ -3095,7 +3094,7 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
string address = o.get_str();
auto zaddr = DecodePaymentAddress(address);
if (!IsValidPaymentAddress(zaddr)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, address is not a valid zaddr: ") + address);
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, address is not a valid Hush zaddr: ") + address);
}
auto hasSpendingKey = boost::apply_visitor(HaveSpendingKeyForPaymentAddress(pwalletMain), zaddr);
if (!fIncludeWatchonly && !hasSpendingKey) {
@ -3111,14 +3110,9 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
}
else {
// User did not provide zaddrs, so use default i.e. all addresses
std::set<libzcash::SproutPaymentAddress> sproutzaddrs = {};
pwalletMain->GetSproutPaymentAddresses(sproutzaddrs);
// Sapling support
std::set<libzcash::SaplingPaymentAddress> saplingzaddrs = {};
pwalletMain->GetSaplingPaymentAddresses(saplingzaddrs);
zaddrs.insert(sproutzaddrs.begin(), sproutzaddrs.end());
zaddrs.insert(saplingzaddrs.begin(), saplingzaddrs.end());
}
@ -3130,32 +3124,6 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, zaddrs, nMinDepth, nMaxDepth, true, !fIncludeWatchonly, false);
std::set<std::pair<PaymentAddress, uint256>> nullifierSet = pwalletMain->GetNullifiersForAddresses(zaddrs);
for (auto & entry : sproutEntries) {
UniValue obj(UniValue::VOBJ);
int nHeight = tx_height(entry.jsop.hash);
int dpowconfs = komodo_dpowconfs(nHeight, entry.confirmations);
// Only return notarized results when minconf>1
if (nMinDepth > 1 && dpowconfs == 1)
continue;
obj.push_back(Pair("txid", entry.jsop.hash.ToString()));
obj.push_back(Pair("jsindex", (int)entry.jsop.js ));
obj.push_back(Pair("jsoutindex", (int)entry.jsop.n));
obj.push_back(Pair("confirmations", dpowconfs));
obj.push_back(Pair("rawconfirmations", entry.confirmations));
bool hasSproutSpendingKey = pwalletMain->HaveSproutSpendingKey(boost::get<libzcash::SproutPaymentAddress>(entry.address));
obj.push_back(Pair("spendable", hasSproutSpendingKey));
obj.push_back(Pair("address", EncodePaymentAddress(entry.address)));
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value()))));
std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end());
obj.push_back(Pair("memo", HexStr(data)));
if (hasSproutSpendingKey) {
obj.push_back(Pair("change", pwalletMain->IsNoteSproutChange(nullifierSet, entry.address, entry.jsop)));
}
results.push_back(obj);
}
for (auto & entry : saplingEntries) {
UniValue obj(UniValue::VOBJ);
@ -4121,6 +4089,167 @@ UniValue z_gettotalbalance(const UniValue& params, bool fHelp)
return result;
}
UniValue z_viewtransaction(const UniValue& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
if (fHelp || params.size() != 1)
throw runtime_error(
"z_viewtransaction \"txid\"\n"
"\nGet detailed shielded information about in-wallet transaction <txid>\n"
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n"
"\nResult:\n"
"{\n"
" \"txid\" : \"transactionid\", (string) The transaction id\n"
" \"spends\" : [\n"
" {\n"
" \"type\" : \"sapling\", (string) The type of address\n"
" \"spend\" : n, (numeric) the index of the spend within vShieldedSpend\n"
" \"txidPrev\" : \"transactionid\", (string) The id for the transaction this note was created in\n"
" \"nullifier\" : \"nullifier\", (string) The nullifier\n"
" \"anchor\" : \"anchor\", (string) The anchor\n"
" \"commitment\" : \"commitment\", (string) The commitment\n"
" \"rk\" : \"rk\", (string) The rk\n"
" \"outputPrev\" : n, (numeric) the index of the output within the vShieldedOutput\n"
" \"address\" : \"zcashaddress\", (string) The Hush shielded address involved in the transaction\n"
" \"value\" : x.xxx (numeric) The amount in " + CURRENCY_UNIT + "\n"
" \"valueZat\" : xxxx (numeric) The amount in zatoshis\n"
" }\n"
" ,...\n"
" ],\n"
" \"outputs\" : [\n"
" {\n"
" \"type\" : \"sapling\", (string) The type of address\n"
" \"output\" : n, (numeric) the index of the output within the vShieldedOutput\n"
" \"address\" : \"hushaddress\", (string) The Hush address involved in the transaction\n"
" \"recovered\" : true|false (boolean) True if the output is not for an address in the wallet\n"
" \"value\" : x.xxx (numeric) The amount in " + CURRENCY_UNIT + "\n"
" \"valueZat\" : xxxx (numeric) The amount in zatoshis\n"
" \"memo\" : \"hexmemo\", (string) Hexademical string representation of the memo field\n"
" \"memoStr\" : \"memo\", (string) Only returned if memo contains valid UTF-8 text.\n"
" }\n"
" ,...\n"
" ],\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("z_viewtransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
+ HelpExampleCli("z_viewtransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" true")
+ HelpExampleRpc("z_viewtransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
);
LOCK2(cs_main, pwalletMain->cs_wallet);
uint256 hash;
hash.SetHex(params[0].get_str());
UniValue entry(UniValue::VOBJ);
if (!pwalletMain->mapWallet.count(hash))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid or non-wallet Hush transaction id!");
const CWalletTx& wtx = pwalletMain->mapWallet[hash];
entry.push_back(Pair("txid", hash.GetHex()));
UniValue spends(UniValue::VARR);
UniValue outputs(UniValue::VARR);
char str[64];
// Sapling spends
std::set<uint256> ovks;
for (size_t i = 0; i < wtx.vShieldedSpend.size(); ++i) {
auto spend = wtx.vShieldedSpend[i];
// Fetch the note that is being spent
auto res = pwalletMain->mapSaplingNullifiersToNotes.find(spend.nullifier);
if (res == pwalletMain->mapSaplingNullifiersToNotes.end()) {
fprintf(stderr,"Could not find spending note %s", uint256_str(str, spend.nullifier));
continue;
}
auto op = res->second;
auto wtxPrev = pwalletMain->mapWallet.at(op.hash);
auto decrypted = wtxPrev.DecryptSaplingNote(op).get();
auto notePt = decrypted.first;
auto pa = decrypted.second;
// Store the OutgoingViewingKey for recovering outputs
libzcash::SaplingFullViewingKey fvk;
assert(pwalletMain->GetSaplingFullViewingKey(wtxPrev.mapSaplingNoteData.at(op).ivk, fvk));
ovks.insert(fvk.ovk);
UniValue entry(UniValue::VOBJ);
entry.push_back(Pair("type", ADDR_TYPE_SAPLING));
entry.push_back(Pair("spend", (int)i));
entry.push_back(Pair("nullifier", uint256_str(str,spend.nullifier)));
entry.push_back(Pair("anchor", uint256_str(str,spend.anchor)));
entry.push_back(Pair("commitment", uint256_str(str,spend.cv)));
entry.push_back(Pair("rk", uint256_str(str,spend.rk)));
//TODO: how to get list of wtinesses and height?
//entry.push_back(Pair("witnessHeight", op.witnessHeight));
entry.push_back(Pair("spendAuthSig", HexStr(spend.spendAuthSig.begin(), spend.spendAuthSig.end())));
entry.push_back(Pair("zkproof", HexStr(spend.zkproof.begin(), spend.zkproof.end())));
entry.push_back(Pair("txidPrev", op.hash.GetHex()));
entry.push_back(Pair("outputPrev", (int)op.n));
entry.push_back(Pair("address", EncodePaymentAddress(pa)));
entry.push_back(Pair("value", ValueFromAmount(notePt.value())));
entry.push_back(Pair("valueZat", notePt.value()));
spends.push_back(entry);
}
// Sapling outputs
for (uint32_t i = 0; i < wtx.vShieldedOutput.size(); ++i) {
auto op = SaplingOutPoint(hash, i);
SaplingNotePlaintext notePt;
SaplingPaymentAddress pa;
bool isRecovered;
auto decrypted = wtx.DecryptSaplingNote(op);
if (decrypted) {
notePt = decrypted->first;
pa = decrypted->second;
isRecovered = false;
} else {
// Try recovering the output
auto recovered = wtx.RecoverSaplingNote(op, ovks);
if (recovered) {
notePt = recovered->first;
pa = recovered->second;
isRecovered = true;
} else {
// Unreadable
fprintf(stderr,"Could not recover Sapling note!");
continue;
}
}
auto memo = notePt.memo();
UniValue entry(UniValue::VOBJ);
entry.push_back(Pair("type", ADDR_TYPE_SAPLING));
entry.push_back(Pair("output", (int)op.n));
entry.push_back(Pair("recovered", isRecovered));
entry.push_back(Pair("address", EncodePaymentAddress(pa)));
entry.push_back(Pair("value", ValueFromAmount(notePt.value())));
entry.push_back(Pair("valueZat", notePt.value()));
entry.push_back(Pair("memo", HexStr(memo)));
if (memo[0] <= 0xf4) {
auto end = std::find_if(memo.rbegin(), memo.rend(), [](unsigned char v) { return v != 0; });
std::string memoStr(memo.begin(), end.base());
if (utf8::is_valid(memoStr)) {
entry.push_back(Pair("memoStr", memoStr));
}
}
outputs.push_back(entry);
}
entry.push_back(Pair("spends", spends));
entry.push_back(Pair("outputs", outputs));
return entry;
}
UniValue z_getoperationresult(const UniValue& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
@ -5544,7 +5673,7 @@ UniValue channelsaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_CHANNELS);
if ( fHelp || params.size() != 1 )
throw runtime_error("channelsaddress pubkey\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
pubkey = ParseHex(params[0].get_str().c_str());
return(CCaddress(cp,(char *)"Channels",pubkey));
@ -5555,8 +5684,6 @@ UniValue cclibaddress(const UniValue& params, bool fHelp)
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey; uint8_t evalcode = EVAL_FIRSTUSER;
if ( fHelp || params.size() > 2 )
throw runtime_error("cclibaddress [evalcode] [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() >= 1 )
{
evalcode = atoi(params[0].get_str().c_str());
@ -5566,6 +5693,8 @@ UniValue cclibaddress(const UniValue& params, bool fHelp)
pubkey = ParseHex(params[1].get_str().c_str());
}
cp = CCinit(&C,evalcode);
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( cp == 0 )
throw runtime_error("error creating *cp\n");
return(CCaddress(cp,(char *)"CClib",pubkey));
@ -5742,7 +5871,7 @@ UniValue oraclesaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_ORACLES);
if ( fHelp || params.size() > 1 )
throw runtime_error("oraclesaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5756,7 +5885,7 @@ UniValue pricesaddress(const UniValue& params, bool fHelp)
assetscp = CCinit(&C2,EVAL_PRICES);
if ( fHelp || params.size() > 1 )
throw runtime_error("pricesaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5778,7 +5907,7 @@ UniValue pegsaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_PEGS);
if ( fHelp || params.size() > 1 )
throw runtime_error("pegssaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5791,7 +5920,7 @@ UniValue marmaraaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_MARMARA);
if ( fHelp || params.size() > 1 )
throw runtime_error("Marmaraaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5804,7 +5933,7 @@ UniValue paymentsaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_PAYMENTS);
if ( fHelp || params.size() > 1 )
throw runtime_error("paymentsaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5817,7 +5946,7 @@ UniValue gatewaysaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_GATEWAYS);
if ( fHelp || params.size() > 1 )
throw runtime_error("gatewaysaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5830,7 +5959,7 @@ UniValue heiraddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_HEIR);
if ( fHelp || params.size() > 1 )
throw runtime_error("heiraddress pubkey\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
pubkey = ParseHex(params[0].get_str().c_str());
return(CCaddress(cp,(char *)"Heir",pubkey));
@ -5842,7 +5971,7 @@ UniValue lottoaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_LOTTO);
if ( fHelp || params.size() > 1 )
throw runtime_error("lottoaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5855,7 +5984,7 @@ UniValue FSMaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_FSM);
if ( fHelp || params.size() > 1 )
throw runtime_error("FSMaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5868,7 +5997,7 @@ UniValue auctionaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_AUCTION);
if ( fHelp || params.size() > 1 )
throw runtime_error("auctionaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5881,7 +6010,7 @@ UniValue diceaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_DICE);
if ( fHelp || params.size() > 1 )
throw runtime_error("diceaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5895,7 +6024,7 @@ UniValue faucetaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_FAUCET);
if ( fHelp || params.size() > 1 )
throw runtime_error("faucetaddress [pubkey]\n");
error = ensure_CCrequirements(0);
error = ensure_CCrequirements(cp->evalcode);
if ( error < 0 )
throw runtime_error(strprintf("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet. ERR=%d\n", error));
if ( params.size() == 1 )
@ -5909,7 +6038,7 @@ UniValue rewardsaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_REWARDS);
if ( fHelp || params.size() > 1 )
throw runtime_error("rewardsaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5922,7 +6051,7 @@ UniValue assetsaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C, EVAL_ASSETS);
if (fHelp || params.size() > 1)
throw runtime_error("assetsaddress [pubkey]\n");
if (ensure_CCrequirements(0) < 0)
if (ensure_CCrequirements(cp->evalcode) < 0)
throw runtime_error(CC_REQUIREMENTS_MSG);
if (params.size() == 1)
pubkey = ParseHex(params[0].get_str().c_str());
@ -5935,7 +6064,7 @@ UniValue tokenaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_TOKENS);
if ( fHelp || params.size() > 1 )
throw runtime_error("tokenaddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -5948,7 +6077,7 @@ UniValue importgatewayaddress(const UniValue& params, bool fHelp)
cp = CCinit(&C,EVAL_IMPORTGATEWAY);
if ( fHelp || params.size() > 1 )
throw runtime_error("importgatewayddress [pubkey]\n");
if ( ensure_CCrequirements(0) < 0 )
if ( ensure_CCrequirements(cp->evalcode) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
if ( params.size() == 1 )
pubkey = ParseHex(params[0].get_str().c_str());
@ -8287,6 +8416,7 @@ static const CRPCCommand commands[] =
{ "wallet", "z_importviewingkey", &z_importviewingkey, true },
{ "wallet", "z_exportwallet", &z_exportwallet, true },
{ "wallet", "z_importwallet", &z_importwallet, true },
{ "wallet", "z_viewtransaction", &z_viewtransaction, true },
// TODO: rearrange into another category
{ "disclosure", "z_getpaymentdisclosure", &z_getpaymentdisclosure, true },
{ "disclosure", "z_validatepaymentdisclosure", &z_validatepaymentdisclosure, true }

78
src/wallet/wallet.cpp

@ -1841,7 +1841,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
void CWallet::SyncTransaction(const CTransaction& tx, const CBlock* pblock)
{
LOCK2(cs_main, cs_wallet);
LOCK(cs_wallet);
if (!AddToWalletIfInvolvingMe(tx, pblock, true))
return; // Not one of ours
@ -2487,6 +2487,68 @@ void CWalletTx::SetSaplingNoteData(mapSaplingNoteData_t &noteData)
}
}
boost::optional<std::pair<
SaplingNotePlaintext,
SaplingPaymentAddress>> CWalletTx::DecryptSaplingNote(SaplingOutPoint op) const
{
// Check whether we can decrypt this SaplingOutPoint
if (this->mapSaplingNoteData.count(op) == 0) {
return boost::none;
}
auto output = this->vShieldedOutput[op.n];
auto nd = this->mapSaplingNoteData.at(op);
auto maybe_pt = SaplingNotePlaintext::decrypt(
output.encCiphertext,
nd.ivk,
output.ephemeralKey,
output.cm);
assert(static_cast<bool>(maybe_pt));
auto notePt = maybe_pt.get();
auto maybe_pa = nd.ivk.address(notePt.d);
assert(static_cast<bool>(maybe_pa));
auto pa = maybe_pa.get();
return std::make_pair(notePt, pa);
}
boost::optional<std::pair<
SaplingNotePlaintext,
SaplingPaymentAddress>> CWalletTx::RecoverSaplingNote(
SaplingOutPoint op, std::set<uint256>& ovks) const
{
auto output = this->vShieldedOutput[op.n];
for (auto ovk : ovks) {
auto outPt = SaplingOutgoingPlaintext::decrypt(
output.outCiphertext,
ovk,
output.cv,
output.cm,
output.ephemeralKey);
if (!outPt) {
continue;
}
auto maybe_pt = SaplingNotePlaintext::decrypt(
output.encCiphertext,
output.ephemeralKey,
outPt->esk,
outPt->pk_d,
output.cm);
assert(static_cast<bool>(maybe_pt));
auto notePt = maybe_pt.get();
return std::make_pair(notePt, SaplingPaymentAddress(notePt.d, outPt->pk_d));
}
// Couldn't recover with any of the provided OutgoingViewingKeys
return boost::none;
}
int64_t CWalletTx::GetTxTime() const
{
int64_t n = nTimeSmart;
@ -4830,9 +4892,8 @@ CWalletKey::CWalletKey(int64_t nExpires)
nTimeExpires = nExpires;
}
int CMerkleTx::SetMerkleBranch(const CBlock& block)
void CMerkleTx::SetMerkleBranch(const CBlock& block)
{
AssertLockHeld(cs_main);
CBlock blockTmp;
// Update the tx's hashBlock
@ -4847,21 +4908,10 @@ int CMerkleTx::SetMerkleBranch(const CBlock& block)
vMerkleBranch.clear();
nIndex = -1;
LogPrintf("ERROR: SetMerkleBranch(): couldn't find tx in block\n");
return 0;
}
// Fill in merkle branch
vMerkleBranch = block.GetMerkleBranch(nIndex);
// Is the tx in a block that's in the main chain
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
if (mi == mapBlockIndex.end())
return 0;
const CBlockIndex* pindex = (*mi).second;
if (!pindex || !chainActive.Contains(pindex))
return 0;
return chainActive.Height() - pindex->GetHeight() + 1;
}
int CMerkleTx::GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const

12
src/wallet/wallet.h

@ -386,7 +386,7 @@ public:
READWRITE(nIndex);
}
int SetMerkleBranch(const CBlock& block);
void SetMerkleBranch(const CBlock& block);
/**
@ -567,6 +567,16 @@ public:
void SetSproutNoteData(mapSproutNoteData_t &noteData);
void SetSaplingNoteData(mapSaplingNoteData_t &noteData);
std::pair<libzcash::SproutNotePlaintext, libzcash::SproutPaymentAddress> DecryptSproutNote(
JSOutPoint jsop) const;
boost::optional<std::pair<
libzcash::SaplingNotePlaintext,
libzcash::SaplingPaymentAddress>> DecryptSaplingNote(SaplingOutPoint op) const;
boost::optional<std::pair<
libzcash::SaplingNotePlaintext,
libzcash::SaplingPaymentAddress>> RecoverSaplingNote(
SaplingOutPoint op, std::set<uint256>& ovks) const;
//! filter decides which addresses will count towards the debit
CAmount GetDebit(const isminefilter& filter) const;
CAmount GetCredit(const isminefilter& filter) const;

50
src/zcash/Note.cpp

@ -173,15 +173,21 @@ boost::optional<SaplingOutgoingPlaintext> SaplingOutgoingPlaintext::decrypt(
}
// Deserialize from the plaintext
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << pt.get();
try {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << pt.get();
SaplingOutgoingPlaintext ret;
ss >> ret;
SaplingOutgoingPlaintext ret;
ss >> ret;
assert(ss.size() == 0);
assert(ss.size() == 0);
return ret;
return ret;
} catch (const boost::thread_interrupted&) {
throw;
} catch (...) {
return boost::none;
}
}
boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
@ -197,13 +203,17 @@ boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
}
// Deserialize from the plaintext
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << pt.get();
SaplingNotePlaintext ret;
ss >> ret;
assert(ss.size() == 0);
try {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << pt.get();
ss >> ret;
assert(ss.size() == 0);
} catch (const boost::thread_interrupted&) {
throw;
} catch (...) {
return boost::none;
}
uint256 pk_d;
if (!librustzcash_ivk_to_pkd(ivk.begin(), ret.d.data(), pk_d.begin())) {
@ -243,11 +253,17 @@ boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
}
// Deserialize from the plaintext
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << pt.get();
SaplingNotePlaintext ret;
ss >> ret;
try {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << pt.get();
ss >> ret;
assert(ss.size() == 0);
} catch (const boost::thread_interrupted&) {
throw;
} catch (...) {
return boost::none;
}
uint256 cmu_expected;
if (!librustzcash_sapling_compute_cm(
@ -265,8 +281,6 @@ boost::optional<SaplingNotePlaintext> SaplingNotePlaintext::decrypt(
return boost::none;
}
assert(ss.size() == 0);
return ret;
}

432
zcutil/VerusCoin.xml

@ -1,432 +0,0 @@
<project>
<shortName>VerusCoin</shortName>
<fullName>VerusCoin</fullName>
<version>0.3.12</version>
<installerFilename>${product_shortname}-v${product_version}-${platform_name}-installer.${platform_exec_suffix}</installerFilename>
<licenseFile>../COPYING</licenseFile>
<leftImage>../assets/imgs/VRSC_256x256.png</leftImage>
<logoImage>../assets/imgs/VRSC_256x256.png</logoImage>
<splashImage>../assets/imgs/VRSC_256x256.png</splashImage>
<allowLanguageSelection>1</allowLanguageSelection>
<componentList>
<componentGroup>
<name>VerusCoin</name>
<description>VerusCoin CLI</description>
<canBeEdited>1</canBeEdited>
<downloadable>1</downloadable>
<selected>1</selected>
<show>1</show>
<componentList>
<component>
<name>Agama</name>
<description>Verus-Enhanced Agama Wallet</description>
<canBeEdited>1</canBeEdited>
<downloadable>1</downloadable>
<selected>1</selected>
<show>1</show>
<desktopShortcutList>
<shortcut>
<comment>Start Agama App</comment>
<exec></exec>
<icon>../assets/icons/agama_icons/256x256.png</icon>
<name>Agama App</name>
<path></path>
<platforms>all</platforms>
<runAsAdmin>0</runAsAdmin>
<runInTerminal>0</runInTerminal>
<windowsExec>${installdir}/Agama/Agama-win32-x64/Agama.exe</windowsExec>
<windowsExecArgs></windowsExecArgs>
<windowsIcon></windowsIcon>
<windowsPath>${windows_folder_common_programs}/</windowsPath>
</shortcut>
</desktopShortcutList>
<folderList>
<folder>
<description>Verus-Enhanced Agama Wallet</description>
<destination>${installdir}/Agama</destination>
<name>Agama</name>
<platforms>all</platforms>
<distributionFileList>
<distributionDirectory>
<origin>../Agama-win32-x64</origin>
</distributionDirectory>
</distributionFileList>
</folder>
</folderList>
</component>
</componentList>
<folderList>
<folder>
<description>Program Files</description>
<destination>${installdir}</destination>
<name>programfiles</name>
<platforms>all</platforms>
<shortcutList>
<shortcut>
<comment>Uninstall</comment>
<exec>${installdir}/${uninstallerName}</exec>
<icon></icon>
<name>Uninstall ${product_fullname}</name>
<path>${installdir}</path>
<platforms>all</platforms>
<runAsAdmin>0</runAsAdmin>
<runInTerminal>0</runInTerminal>
<windowsExec>${installdir}/${uninstallerName}.exe</windowsExec>
<windowsExecArgs></windowsExecArgs>
<windowsIcon></windowsIcon>
<windowsPath>${installdir}</windowsPath>
</shortcut>
</shortcutList>
</folder>
<folder>
<description>VerusCoin</description>
<destination>${installdir}/</destination>
<name>VerusCoin</name>
<platforms>all</platforms>
<distributionFileList>
<distributionDirectory>
<origin>../verus-cli</origin>
</distributionDirectory>
</distributionFileList>
</folder>
</folderList>
</componentGroup>
</componentList>
<preInstallationActionList>
<registryGetMatch>
<key>HKEY_LOCAL_MACHINE\SOFTWARE\${project.shortname}</key>
<name>uninstaller_path</name>
<variable>uninstaller_path</variable>
</registryGetMatch>
<setInstallerVariable>
<name>previous_installation_exists</name>
<value>1</value>
<ruleList>
<fileTest condition="exists" path="${uninstaller_path}"/>
</ruleList>
</setInstallerVariable>
</preInstallationActionList>
<readyToInstallActionList>
<runProgram>
<program>${uninstaller_path}</program>
<programArguments></programArguments>
<ruleList>
<compareValues>
<logic>equals</logic>
<value1>${previous_installation_exists}</value1>
<value2>1</value2>
</compareValues>
</ruleList>
</runProgram>
<deleteFile>
<explanation>Deleting user data</explanation>
<path>${windows_folder_appdata}/Agama</path>
<progressText>Deleting user data</progressText>
<ruleList>
<compareValues>
<logic>equals</logic>
<value1>${previous_installation_exists}</value1>
<value2>1</value2>
</compareValues>
<compareValues>
<logic>equals</logic>
<value1>${installation_type}</value1>
<value2>uninstall</value2>
</compareValues>
<compareValues>
<logic>equals</logic>
<value1>${delete_user_data}</value1>
<value2>1</value2>
</compareValues>
</ruleList>
</deleteFile>
<deleteFile>
<explanation>Deleting iguana config json</explanation>
<path>${windows_folder_appdata}/Iguana/config.json</path>
<progressText>Deleting iguana config</progressText>
<ruleList>
<compareValues>
<logic>equals</logic>
<value1>${previous_installation_exists}</value1>
<value2>1</value2>
</compareValues>
<compareValues>
<logic>equals</logic>
<value1>${installation_type}</value1>
<value2>uninstall</value2>
</compareValues>
<compareValues>
<logic>equals</logic>
<value1>${delete_config_data}</value1>
<value2>1</value2>
</compareValues>
</ruleList>
</deleteFile>
<exit>
<explanation>Uninstalled</explanation>
<progressText>Uninstalled</progressText>
<ruleList>
<compareValues>
<logic>equals</logic>
<value1>${previous_installation_exists}</value1>
<value2>1</value2>
</compareValues>
<compareValues>
<logic>equals</logic>
<value1>${installation_type}</value1>
<value2>uninstall</value2>
</compareValues>
</ruleList>
</exit>
<showProgressDialog>
<title>Downloading files</title>
<actionList>
<httpGet>
<abortOnError>0</abortOnError>
<explanation>Visual C++ Redistributable for Visual Studio 2015 library files are needed for Agama daemon</explanation>
<filename>${system_temp_directory}/vc_redist.x64.exe</filename>
<progressText>Downloading Visual C++ Redistributable for Visual Studio 2015</progressText>
<showMessageOnError>0</showMessageOnError>
<url>https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe</url>
</httpGet>
</actionList>
<ruleList>
<fileExists>
<negate>1</negate>
<path>${system_temp_directory}/vc_redist.x64.exe</path>
</fileExists>
</ruleList>
</showProgressDialog>
<runProgram>
<abortOnError>0</abortOnError>
<explanation>Visual C++ Redistributable for Visual Studio 2015 library files are needed for Agama daemon</explanation>
<program>${system_temp_directory}/vc_redist.x64.exe</program>
<programArguments>/install /passive</programArguments>
<progressText>Downloading Visual C++ Redistributable for Visual Studio 2015</progressText>
<showMessageOnError>0</showMessageOnError>
</runProgram>
<showProgressDialog>
<title>Downloading files</title>
<actionList>
<httpGet>
<abortOnError>0</abortOnError>
<explanation>Visual C++ Redistributable for Visual Studio 2015 library files are needed for Agama daemon</explanation>
<filename>${system_temp_directory}/vc_redist.x86.exe</filename>
<progressText>Downloading Visual C++ Redistributable for Visual Studio 2015</progressText>
<showMessageOnError>0</showMessageOnError>
<url>https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe</url>
</httpGet>
</actionList>
<ruleList>
<fileExists>
<negate>1</negate>
<path>${system_temp_directory}/vc_redist.x86.exe</path>
</fileExists>
</ruleList>
</showProgressDialog>
<runProgram>
<abortOnError>0</abortOnError>
<explanation>Visual C++ Redistributable for Visual Studio 2015 library files are needed for Agama daemon</explanation>
<program>${system_temp_directory}/vc_redist.x86.exe</program>
<programArguments>/install /passive</programArguments>
<progressText>Downloading Visual C++ Redistributable for Visual Studio 2015</progressText>
<showMessageOnError>0</showMessageOnError>
</runProgram>
<createDirectory>
<abortOnError>0</abortOnError>
<explanation>Creating ZcashParam directory</explanation>
<path>${windows_folder_appdata}/ZcashParams/</path>
<progressText>Creating ZcashParam directory</progressText>
<showMessageOnError>0</showMessageOnError>
</createDirectory>
<showProgressDialog>
<abortOnError>0</abortOnError>
<explanation>Zcash Params file: sprout-proving.key</explanation>
<progressText>Zcash Params file: sprout-proving.key</progressText>
<showMessageOnError>0</showMessageOnError>
<title>Downloading Zcash Params file</title>
<actionList>
<httpGet>
<abortOnError>0</abortOnError>
<explanation>Zcash Params file: sprout-proving.key</explanation>
<filename>${windows_folder_appdata}/ZcashParams/sprout-proving.key</filename>
<progressText>Zcash Params file: sprout-proving.key</progressText>
<showMessageOnError>0</showMessageOnError>
<url>https://z.cash/downloads/sprout-proving.key</url>
</httpGet>
</actionList>
<ruleList>
<fileExists>
<negate>1</negate>
<path>${windows_folder_appdata}/ZcashParams/sprout-proving.key</path>
</fileExists>
</ruleList>
</showProgressDialog>
<showProgressDialog>
<abortOnError>0</abortOnError>
<explanation>Zcash Params file: sprout-verifying.key</explanation>
<progressText>Zcash Params file: sprout-verifying.key</progressText>
<title>Downloading Zcash Params files</title>
<actionList>
<httpGet>
<abortOnError>0</abortOnError>
<explanation>Zcash Params file: sprout-verifying.key</explanation>
<filename>${windows_folder_appdata}/ZcashParams/sprout-verifying.key</filename>
<progressText>Zcash Params file: sprout-verifying.key</progressText>
<showMessageOnError>0</showMessageOnError>
<url>https://z.cash/downloads/sprout-verifying.key</url>
</httpGet>
</actionList>
<ruleList>
<fileExists>
<negate>1</negate>
<path>${windows_folder_appdata}/ZcashParams/sprout-verifying.key</path>
</fileExists>
</ruleList>
</showProgressDialog>
</readyToInstallActionList>
<postInstallationActionList>
<addEnvironmentVariable>
<name>VERUS_HOME</name>
<scope>system</scope>
<value>${installdir}/verus-cli/</value>
</addEnvironmentVariable>
<registrySet>
<key>HKEY_LOCAL_MACHINE\SOFTWARE\${project.shortname}</key>
<name>uninstaller_path</name>
<type>REG_SZ</type>
<value>${installdir}/${uninstallerName}.exe</value>
</registrySet>
<actionGroup>
<actionList>
<copyFile>
<destination>C:\Windows\System32\</destination>
<explanation>Copying ReqCopying Required DLL filesuired DLL files</explanation>
<origin>${installdir}/resources/app/windeps/x86/vcruntime140d.dll</origin>
<progressText>Copying ReqCopying Required DLL filesuired DLL files</progressText>
</copyFile>
</actionList>
<ruleList>
<platformTest type="windows-x86"/>
</ruleList>
</actionGroup>
<actionGroup>
<actionList>
<copyFile>
<destination>C:\Windows\System32\</destination>
<explanation>Copying ReqCopying Required DLL filesuired DLL files</explanation>
<origin>${installdir}/resources/app/windeps/x64/ucrtbased.dll</origin>
<progressText>Copying ReqCopying Required DLL filesuired DLL files</progressText>
</copyFile>
<copyFile>
<destination>C:\Windows\System32\</destination>
<explanation>Copying ReqCopying Required DLL filesuired DLL files</explanation>
<origin>${installdir}/resources/app/windeps/x64/vcruntime140d.dll</origin>
<progressText>Copying ReqCopying Required DLL filesuired DLL files</progressText>
</copyFile>
<copyFile>
<destination>C:\Windows\SysWOW64\</destination>
<explanation>Copying ReqCopying Required DLL filesuired DLL files</explanation>
<origin>${installdir}/resources/app/windeps/x86/ucrtbased.dll</origin>
<progressText>Copying ReqCopying Required DLL filesuired DLL files</progressText>
</copyFile>
<copyFile>
<destination>C:\Windows\SysWOW64\</destination>
<explanation>Copying ReqCopying Required DLL filesuired DLL files</explanation>
<origin>${installdir}/resources/app/windeps/x86/vcruntime140d.dll</origin>
<progressText>Copying ReqCopying Required DLL filesuired DLL files</progressText>
</copyFile>
</actionList>
<ruleList>
<platformTest type="windows-x64"/>
</ruleList>
</actionGroup>
</postInstallationActionList>
<postUninstallationActionList>
<registryDelete>
<key>HKEY_LOCAL_MACHINE\SOFTWARE\${project.shortname}</key>
<name>uninstaller_path</name>
</registryDelete>
</postUninstallationActionList>
<allowAddRemoveComponents>1</allowAddRemoveComponents>
<allowComponentSelection>1</allowComponentSelection>
<enableDebugger>1</enableDebugger>
<enableRollback>1</enableRollback>
<enableTimestamp>1</enableTimestamp>
<outputDirectory>../builds</outputDirectory>
<replaceLockedFilesOnReboot>1</replaceLockedFilesOnReboot>
<rollbackBackupDirectory>${windows_folder_appdata}</rollbackBackupDirectory>
<saveRelativePaths>1</saveRelativePaths>
<singleInstanceCheck>1</singleInstanceCheck>
<vendor>VerusCoin</vendor>
<windows64bitMode>1</windows64bitMode>
<parameterList>
<directoryParameter>
<name>installdir</name>
<description>Installer.Parameter.installdir.description</description>
<explanation>Installer.Parameter.installdir.explanation</explanation>
<value></value>
<default>${platform_install_prefix}/${product_shortname}</default>
<allowEmptyValue>0</allowEmptyValue>
<cliOptionName>prefix</cliOptionName>
<mustBeWritable>1</mustBeWritable>
<mustExist>0</mustExist>
<width>30</width>
<validationActionList>
<throwError>
<text>You don't have enough disk space to install the application,
please select another installation directory</text>
<ruleList>
<checkFreeDiskSpace>
<logic>less</logic>
<path>${installdir}</path>
<size>${required_diskspace}</size>
</checkFreeDiskSpace>
</ruleList>
</throwError>
</validationActionList>
</directoryParameter>
<choiceParameterGroup>
<name>installation_type</name>
<title>Instalation type</title>
<description>Existing instalation is detected</description>
<explanation>Existing instalation is detected</explanation>
<value>uninstall</value>
<default>uninstall</default>
<parameterList>
<parameterGroup>
<name>uninstall</name>
<title>Uninstall</title>
<explanation>Uninstall</explanation>
<value></value>
<default></default>
<parameterList>
<booleanParameter name="delete_user_data" description="Delete user data" displayStyle="checkbox-left">
<explanation></explanation>
<value>0</value>
<default>0</default>
</booleanParameter>
<booleanParameter name="delete_zcash_params" description="Delete Zcash params" displayStyle="checkbox-left">
<explanation></explanation>
<value>0</value>
<default>0</default>
</booleanParameter>
</parameterList>
</parameterGroup>
<labelParameter name="Upgrade" description="Upgrade to current version">
<title>Upgrade</title>
<explanation></explanation>
<image></image>
</labelParameter>
</parameterList>
<ruleList>
<compareValues>
<logic>equals</logic>
<value1>${previous_installation_exists}</value1>
<value2>1</value2>
</compareValues>
</ruleList>
</choiceParameterGroup>
</parameterList>
</project>

67
zcutil/build-debian-package.sh

@ -1,12 +1,15 @@
#!/bin/bash
# Copyright 2019 Hush Developers
## Usage:
## ./zcutil/build-debian-package.sh
echo "Let There Be Debian Packages"
set -e
set -x
BUILD_PATH="/tmp/verus-cli"
PACKAGE_NAME="verus-cli"
BUILD_PATH="/tmp/hush-debian-$$"
PACKAGE_NAME="hush"
SRC_PATH=`pwd`
SRC_DEB=$SRC_PATH/contrib/debian
SRC_DOC=$SRC_PATH/doc
@ -18,12 +21,8 @@ if [ ! -d $BUILD_PATH ]; then
fi
## PACKAGE_VERSION=$($SRC_PATH/src/zcashd --version | grep version | cut -d' ' -f4 | tr -d v)
## Need version setting from environment
PACKAGE_VERSION=0.3.10-beta
##
## Also, what does the sed end up doing?
#PACKAGE_VERSION=0.3.10-beta
PACKAGE_VERSION=$($SRC_PATH/src/hushd --version|head -n1|cut -d' ' -f4|cut -d- -f1|sed 's/v//g')
DEBVERSION=$(echo $PACKAGE_VERSION | sed 's/-beta/~beta/' | sed 's/-rc/~rc/' | sed 's/-/+/')
BUILD_DIR="$BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64"
@ -31,7 +30,7 @@ if [ -d $BUILD_DIR ]; then
rm -R $BUILD_DIR
fi
DEB_BIN=$BUILD_DIR/usr/bin
DEB_BIN=$BUILD_DIR/usr/local/bin
DEB_CMP=$BUILD_DIR/usr/share/bash-completion/completions
DEB_DOC=$BUILD_DIR/usr/share/doc/$PACKAGE_NAME
DEB_MAN=$BUILD_DIR/usr/share/man/man1
@ -43,37 +42,49 @@ chmod 0755 -R $BUILD_DIR/*
#cp $SRC_DEB/postrm $BUILD_DIR/DEBIAN
#cp $SRC_DEB/preinst $BUILD_DIR/DEBIAN
#cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN
# Copy binaries
cp $SRC_PATH/src/komodod $DEB_BIN
strip $DEB_BIN/komodod
cp $SRC_PATH/src/verusd $DEB_BIN
cp $SRC_PATH/src/komodo-cli $DEB_BIN
strip $DEB_BIN/komodo-cli
cp $SRC_PATH/src/verus $DEB_BIN
cp $SRC_PATH/zcutil/fetch-params.sh $DEB_BIN/zcash-fetch-params
# Copy docs
cp $SRC_PATH/doc/release-notes/release-notes-1.0.0.md $DEB_DOC/changelog
# Copy binaries. We prefix our komodod binaries with hush- to prevent conflicting with
# a stock komodod or other flavors of KMD
cp $SRC_PATH/src/komodod $DEB_BIN/hush-komodo
strip $DEB_BIN/hush-komodod
cp $SRC_PATH/src/hushd $DEB_BIN
cp $SRC_PATH/src/hush-cli $DEB_BIN
cp $SRC_PATH/src/hush-tx $DEB_BIN
cp $SRC_PATH/src/komodo-cli $DEB_BIN/hush-komodo-cli
strip $DEB_BIN/hush-komodo-cli
#cp $SRC_PATH/zcutil/fetch-params.sh $DEB_BIN/zcash-fetch-params
cp $SRC_DEB/changelog $DEB_DOC/changelog.Debian
cp $SRC_DEB/copyright $DEB_DOC
cp -r $SRC_DEB/examples $DEB_DOC
# Copy manpages
cp $SRC_DOC/man/komodod.1 $DEB_MAN
cp $SRC_DOC/man/komodo-cli.1 $DEB_MAN
cp $SRC_DOC/man/zcash-fetch-params.1 $DEB_MAN
cp $SRC_DOC/man/komodod.1 $DEB_MAN/hush-komodod.1
cp $SRC_DOC/man/komodo-cli.1 $DEB_MAN/hush-komodo-cli.1
cp $SRC_DOC/man/komodo-tx.1 $DEB_MAN/hush-komodo-tx.1
cp $SRC_DOC/man/komodod.1 $DEB_MAN/hushd.1
cp $SRC_DOC/man/komodo-cli.1 $DEB_MAN/hush-cli.1
cp $SRC_DOC/man/komodo-tx.1 $DEB_MAN/hush-tx.1
#TODO: process these copies and update names/binaries/etc
#cp $SRC_DOC/man/zcash-fetch-params.1 $DEB_MAN
# Copy bash completion files
cp $SRC_PATH/contrib/zcashd.bash-completion $DEB_CMP/zcashd
cp $SRC_PATH/contrib/zcash-cli.bash-completion $DEB_CMP/zcash-cli
cp $SRC_PATH/contrib/hushd.bash-completion $DEB_CMP/hushd
cp $SRC_PATH/contrib/hush-cli.bash-completion $DEB_CMP/hush-cli
cp $SRC_PATH/contrib/hush-tx.bash-completion $DEB_CMP/hush-tx
# Gzip files
gzip --best -n $DEB_DOC/changelog
gzip --best -n $DEB_DOC/changelog.Debian
gzip --best -n $DEB_MAN/komodod.1
gzip --best -n $DEB_MAN/komodo-cli.1
gzip --best -n $DEB_MAN/zcash-fetch-params.1
gzip --best -n $DEB_MAN/hush-komodod.1
gzip --best -n $DEB_MAN/hush-komodo-cli.1
gzip --best -n $DEB_MAN/hush-komodo-tx.1
gzip --best -n $DEB_MAN/hush-komodod.1
gzip --best -n $DEB_MAN/hush-komodo-cli.1
gzip --best -n $DEB_MAN/hush-komodo-tx.1
#gzip --best -n $DEB_MAN/zcash-fetch-params.1
cd $SRC_PATH/contrib
# Create the control file
dpkg-shlibdeps $DEB_BIN/komodod $DEB_BIN/komodo-cli
dpkg-shlibdeps $DEB_BIN/hush-komodod $DEB_BIN/hush-komodo-cli
dpkg-gencontrol -P$BUILD_DIR -v$DEBVERSION
# Create the Debian package

Loading…
Cancel
Save