Stuck in the grind
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
import binascii
|
||||
import calendar
|
||||
import json
|
||||
@@ -10,13 +13,13 @@ import sys
|
||||
import tarfile
|
||||
import time
|
||||
|
||||
ZCASH_CLI = './src/zcash-cli'
|
||||
HUSH_CLI = './src/hush-cli'
|
||||
USAGE = """
|
||||
Requirements:
|
||||
- find
|
||||
- xz
|
||||
- %s (edit ZCASH_CLI in this script to alter the path)
|
||||
- A running mainnet zcashd using the default datadir with -txindex=1
|
||||
- %s (edit HUSH_CLI in this script to alter the path)
|
||||
- A running mainnet hushd using the default datadir with -txindex=1
|
||||
|
||||
Example usage:
|
||||
|
||||
@@ -25,11 +28,11 @@ virtualenv venv
|
||||
. venv/bin/activate
|
||||
pip install --global-option=build_ext --global-option="-L$(pwd)/src/leveldb/" --global-option="-I$(pwd)/src/leveldb/include/" plyvel
|
||||
pip install progressbar2
|
||||
LD_LIBRARY_PATH=src/leveldb python qa/zcash/create_benchmark_archive.py
|
||||
""" % ZCASH_CLI
|
||||
LD_LIBRARY_PATH=src/leveldb python qa/hush/create_benchmark_archive.py
|
||||
""" % HUSH_CLI
|
||||
|
||||
def check_deps():
|
||||
if subprocess.call(['which', 'find', 'xz', ZCASH_CLI], stdout=subprocess.PIPE):
|
||||
if subprocess.call(['which', 'find', 'xz', HUSH_CLI], stdout=subprocess.PIPE):
|
||||
print USAGE
|
||||
sys.exit()
|
||||
|
||||
@@ -154,15 +157,15 @@ def deterministic_filter(tarinfo):
|
||||
return tarinfo
|
||||
|
||||
def create_benchmark_archive(blk_hash):
|
||||
blk = json.loads(subprocess.check_output([ZCASH_CLI, 'getblock', blk_hash]))
|
||||
blk = json.loads(subprocess.check_output([HUSH_CLI, 'getblock', blk_hash]))
|
||||
print 'Height: %d' % blk['height']
|
||||
print 'Transactions: %d' % len(blk['tx'])
|
||||
|
||||
os.mkdir('benchmark')
|
||||
with open('benchmark/block-%d.dat' % blk['height'], 'wb') as f:
|
||||
f.write(binascii.unhexlify(subprocess.check_output([ZCASH_CLI, 'getblock', blk_hash, 'false']).strip()))
|
||||
f.write(binascii.unhexlify(subprocess.check_output([HUSH_CLI, 'getblock', blk_hash, 'false']).strip()))
|
||||
|
||||
txs = [json.loads(subprocess.check_output([ZCASH_CLI, 'getrawtransaction', tx, '1'])
|
||||
txs = [json.loads(subprocess.check_output([HUSH_CLI, 'getrawtransaction', tx, '1'])
|
||||
) for tx in blk['tx']]
|
||||
|
||||
js_txs = len([tx for tx in txs if len(tx['vjoinsplit']) > 0])
|
||||
@@ -187,7 +190,7 @@ def create_benchmark_archive(blk_hash):
|
||||
bar = progressbar.ProgressBar(redirect_stdout=True)
|
||||
print 'Collecting input coins for block'
|
||||
for tx in bar(unique_inputs.keys()):
|
||||
rawtx = json.loads(subprocess.check_output([ZCASH_CLI, 'getrawtransaction', tx, '1']))
|
||||
rawtx = json.loads(subprocess.check_output([HUSH_CLI, 'getrawtransaction', tx, '1']))
|
||||
|
||||
mask_size = 0
|
||||
mask_code = 0
|
||||
@@ -235,7 +238,7 @@ def create_benchmark_archive(blk_hash):
|
||||
binascii.unhexlify(rawtx['vout'][i]['scriptPubKey']['hex'])))
|
||||
# - VARINT(nHeight)
|
||||
coins.extend(encode_varint(json.loads(
|
||||
subprocess.check_output([ZCASH_CLI, 'getblockheader', rawtx['blockhash']])
|
||||
subprocess.check_output([HUSH_CLI, 'getblockheader', rawtx['blockhash']])
|
||||
)['height']))
|
||||
|
||||
db_key = b'c' + bytes(binascii.unhexlify(tx)[::-1])
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
#
|
||||
# Create a large wallet
|
||||
#
|
||||
# To use:
|
||||
@@ -11,7 +10,6 @@
|
||||
# - Add wallet_large.py to RPC tests list
|
||||
# - ./qa/pull-tester/rpc-tests.sh wallet_large --nocleanup
|
||||
# - Archive the resulting /tmp/test###### directory
|
||||
#
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
# Execute all of the automated tests related to Hush
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
#
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
# Execute all of the automated tests related to Hush
|
||||
#
|
||||
|
||||
import argparse
|
||||
from glob import glob
|
||||
|
||||
@@ -20,10 +20,9 @@ Possible options:
|
||||
|
||||
```
|
||||
-h, --help show this help message and exit
|
||||
--nocleanup Leave komodods and test.* datadir on exit or error
|
||||
--noshutdown Don't stop komodods after the test execution
|
||||
--srcdir=SRCDIR Source directory containing hushd/hush-cli (default:
|
||||
../../src)
|
||||
--nocleanup Leave binaries and test.* datadir on exit or error
|
||||
--noshutdown Don't stop full node after the test execution
|
||||
--srcdir=SRCDIR Source directory containing hushd/hush-cli (default: ../../src)
|
||||
--tmpdir=TMPDIR Root directory for datadirs
|
||||
--tracerpc Print out all RPC calls as they are made
|
||||
```
|
||||
@@ -39,8 +38,7 @@ After the first run, the cache/ blockchain and wallets are
|
||||
copied into a temporary directory and used as the initial
|
||||
test state.
|
||||
|
||||
If you get into a bad state, you should be able
|
||||
to recover with:
|
||||
If you get into a bad state, you should be able to recover with:
|
||||
|
||||
```bash
|
||||
rm -rf cache
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2018-2020 The Hush developers
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Released under the GPLv3
|
||||
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
#
|
||||
# Test addressindex generation and fetching
|
||||
#
|
||||
|
||||
import time
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Distributed under the GPLv3/X11 software license, see the accompanying
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#
|
||||
|
||||
from test_framework.test_framework import ComparisonTestFramework
|
||||
from test_framework.util import start_nodes
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3/X11 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 SuperNET developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2016 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
|
||||
#
|
||||
# Test hard fork detection
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
#
|
||||
# Distributed under the GPLv3/X11 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2019 Bartlomiej Lisiecki
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
#
|
||||
# Distributed under the GPLv3/X11 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
import sys
|
||||
sys.path.append('../../src/tui')
|
||||
|
||||
from lib import tuilib
|
||||
# tuilib was removed, tests left here as inspiration
|
||||
#sys.path.append('../../src/tui')
|
||||
#from lib import tuilib
|
||||
import unittest
|
||||
import time
|
||||
|
||||
@@ -14,14 +18,14 @@ added 1 second sleep after each case to surely not face the nSPV server limitati
|
||||
wif = ''
|
||||
dest_address = ''
|
||||
amount = '0.01'
|
||||
chain = 'ILN'
|
||||
chain = 'HUSH3'
|
||||
|
||||
if not wif or not dest_address:
|
||||
raise Exception("Please set test wif and address to send transactions to")
|
||||
|
||||
rpc_proxy = tuilib.def_credentials(chain)
|
||||
|
||||
chain_params = {"KMD": {
|
||||
chain_params = {"HUSH3": {
|
||||
'tx_list_address': 'RGShWG446Pv24CKzzxjA23obrzYwNbs1kA',
|
||||
'min_chain_height': 1468080,
|
||||
'notarization_height': '1468000',
|
||||
@@ -33,19 +37,6 @@ chain_params = {"KMD": {
|
||||
'tx_proof_id': 'f7beb36a65bc5bcbc9c8f398345aab7948160493955eb4a1f05da08c4ac3784f',
|
||||
'tx_spent_height': 1456212,
|
||||
'tx_proof_height': '1468520',
|
||||
},
|
||||
"ILN": {
|
||||
'tx_list_address': 'RUp3xudmdTtxvaRnt3oq78FJBjotXy55uu',
|
||||
'min_chain_height': 3689,
|
||||
'notarization_height': '2000',
|
||||
'prev_notarization_h': 1998,
|
||||
'next_notarization_h': 2008,
|
||||
'hdrs_proof_low': '2000',
|
||||
'hdrs_proof_high': '2100',
|
||||
'numhdrs_expected': 113,
|
||||
'tx_proof_id': '67ffe0eaecd6081de04675c492a59090b573ee78955c4e8a85b8ac0be0e8e418',
|
||||
'tx_spent_height': 2681,
|
||||
'tx_proof_height': '2690',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +89,7 @@ class TestNspvClient(unittest.TestCase):
|
||||
print("testing nspv_login")
|
||||
result = rpc_proxy.nspv_login(wif)
|
||||
self.assertEqual(result["result"], "success")
|
||||
self.assertEqual(result["status"], "wif will expire in 777 seconds")
|
||||
self.assertEqual(result["status"], "wif will expire in 555 seconds")
|
||||
time.sleep(1)
|
||||
|
||||
def test_nspv_listunspent(self):
|
||||
@@ -156,9 +147,9 @@ class TestNspvClient(unittest.TestCase):
|
||||
time.sleep(1)
|
||||
|
||||
def test_nspv_login_timout(self):
|
||||
print("testing auto-logout in 777 seconds")
|
||||
print("testing auto-logout in 555 seconds")
|
||||
rpc_proxy.nspv_login(wif)
|
||||
time.sleep(778)
|
||||
time.sleep(556)
|
||||
result = rpc_proxy.nspv_spend(dest_address, amount)
|
||||
self.assertEqual(result["result"], "error")
|
||||
self.assertEqual(result["error"], "wif expired")
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
#
|
||||
# Distributed under the GPLv3/X11 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
#
|
||||
# Distributed under the GPLv3/X11 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, assert_true, initialize_chain_clean, start_node
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
"""
|
||||
Copyright 2011 Jeff Garzik
|
||||
@@ -47,10 +50,8 @@ try:
|
||||
except ImportError:
|
||||
import urlparse
|
||||
|
||||
USER_AGENT = "AuthServiceProxy/0.1"
|
||||
|
||||
USER_AGENT = "FUCKjl777LULZ"
|
||||
HTTP_TIMEOUT = 600
|
||||
|
||||
log = logging.getLogger("BitcoinRPC")
|
||||
|
||||
class JSONRPCException(Exception):
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
#
|
||||
#
|
||||
# bignum.py
|
||||
#
|
||||
# This file is copied from python-bitcoinlib.
|
||||
#
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#
|
||||
# This file is from python-bitcoinlib.
|
||||
|
||||
"""Bignum routines"""
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
# BlockStore: a helper class that keeps a map of blocks and implements
|
||||
# helper functions for responding to getheaders and getdata,
|
||||
# and for constructing a getheaders message
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
# blocktools.py - utilities for manipulating blocks and transactions
|
||||
#
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#
|
||||
|
||||
# blocktools.py - utilities for manipulating blocks and transactions
|
||||
from mininode import CBlock, CTransaction, CTxIn, CTxOut, COutPoint
|
||||
from script import CScript, OP_0, OP_EQUAL, OP_HASH160
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#
|
||||
|
||||
from mininode import CBlock, CTransaction, CInv, NodeConn, NodeConnCB, \
|
||||
msg_inv, msg_getheaders, msg_ping, msg_mempool, mininode_lock, MAX_INV_SZ
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
from operator import itemgetter
|
||||
import struct
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# mininode.py - Bitcoin P2P network half-a-node
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Lovingly maintained and released under the GPLv3
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
# mininode.py - Bitcoin P2P network half-a-node
|
||||
#
|
||||
# This python code was modified from ArtForz' public domain half-a-node, as
|
||||
# found in the mini-node branch of http://github.com/jgarzik/pynode.
|
||||
@@ -43,14 +44,10 @@ from .equihash import (
|
||||
OVERWINTER_PROTO_VERSION = 170003
|
||||
BIP0031_VERSION = 60000
|
||||
SPROUT_PROTO_VERSION = 170002 # past bip-31 for ping/pong
|
||||
SAPLING_PROTO_VERSION = 170006
|
||||
MY_SUBVERSION = "/python-mininode-hush-tester:3.3.0/"
|
||||
|
||||
SAPLING_PROTO_VERSION = 1987420
|
||||
MY_SUBVERSION = "/SpicySand/"
|
||||
OVERWINTER_VERSION_GROUP_ID = 0x03C48270
|
||||
|
||||
MAX_INV_SZ = 50000
|
||||
|
||||
|
||||
COIN = 100000000 # 1 HUSH in puposhis
|
||||
|
||||
# Keep our own socket map for asyncore, so that we can track disconnects
|
||||
@@ -417,14 +414,14 @@ ZC_NOTEPLAINTEXT_LEADING = 1
|
||||
ZC_V_SIZE = 8
|
||||
ZC_RHO_SIZE = 32
|
||||
ZC_R_SIZE = 32
|
||||
ZC_MEMO_SIZE = 512
|
||||
HUSH_MEMO_SIZE = 512
|
||||
|
||||
ZC_NOTEPLAINTEXT_SIZE = (
|
||||
ZC_NOTEPLAINTEXT_LEADING +
|
||||
ZC_V_SIZE +
|
||||
ZC_RHO_SIZE +
|
||||
ZC_R_SIZE +
|
||||
ZC_MEMO_SIZE
|
||||
HUSH_MEMO_SIZE
|
||||
)
|
||||
|
||||
NOTEENCRYPTION_AUTH_BYTES = 16
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
#
|
||||
# script.py
|
||||
#
|
||||
# This file is modified from python-bitcoinlib.
|
||||
#
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#
|
||||
# This file is modified from python-bitcoinlib.
|
||||
|
||||
"""Scripts
|
||||
|
||||
Functionality to build scripts, as well as SignatureHash().
|
||||
Functionality to build Bitcoin style Scripts, as well as SignatureHash().
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
@@ -32,9 +28,7 @@ from test_framework import bignum
|
||||
MAX_SCRIPT_SIZE = 10000
|
||||
MAX_SCRIPT_ELEMENT_SIZE = 520
|
||||
MAX_SCRIPT_OPCODES = 201
|
||||
|
||||
OPCODE_NAMES = {}
|
||||
|
||||
_opcode_instances = []
|
||||
class CScriptOp(int):
|
||||
"""A single script opcode"""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
# Base class for RPC testing
|
||||
|
||||
# Add python-bitcoinrpc to module search path:
|
||||
import os
|
||||
import sys
|
||||
|
||||
import shutil
|
||||
import tempfile
|
||||
import traceback
|
||||
@@ -19,7 +17,6 @@ from util import assert_equal, check_json_precision, \
|
||||
start_nodes, connect_nodes_bi, stop_nodes, \
|
||||
sync_blocks, sync_mempools, wait_bitcoinds
|
||||
|
||||
|
||||
class BitcoinTestFramework(object):
|
||||
|
||||
# These may be over-ridden by subclasses:
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
# Copyright (c) 2018-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2018-2019 The SuperNET developers
|
||||
# Copyright (c) 2018-2020 The Hush developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#
|
||||
# Helpful routines for regression testing
|
||||
#
|
||||
|
||||
# Add python-bitcoinrpc to module search path:
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
#
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
# Test timestampindex generation and fetching
|
||||
#
|
||||
|
||||
import time
|
||||
|
||||
from test_framework.test_framework import HushTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
|
||||
class TimestampIndexTest(HushTestFramework):
|
||||
|
||||
def setup_chain(self):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2016 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2016 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2016 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.authproxy import JSONRPCException
|
||||
from test_framework.mininode import COIN
|
||||
@@ -217,7 +217,7 @@ class WalletProtectCoinbaseTest (BitcoinTestFramework):
|
||||
# UTXO selection in z_sendmany sorts in ascending order, so smallest utxos are consumed first.
|
||||
# At this point in time, unspent notes all have a value of 10.0 and standard z_sendmany fee is 0.0001.
|
||||
recipients = []
|
||||
amount = Decimal('10.0') - Decimal('0.00010000') - Decimal('0.00000001') # this leaves change at 1 zatoshi less than dust threshold
|
||||
amount = Decimal('10.0') - Decimal('0.00010000') - Decimal('0.00000001') # this leaves change at 1 puposhi less than dust threshold
|
||||
recipients.append({"address":self.nodes[0].getnewaddress(), "amount":amount })
|
||||
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
|
||||
wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "Insufficient transparent funds, have 10.00, need 0.00000053 more to avoid creating invalid change output 0.00000001 (dust threshold is 0.00000054)")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.authproxy import JSONRPCException
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
import inspect
|
||||
import os
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2016 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
#
|
||||
# Test ZMQ interface
|
||||
#
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, bytes_to_hex_str, start_nodes
|
||||
|
||||
130
src/alert.cpp
130
src/alert.cpp
@@ -3,7 +3,6 @@
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -18,20 +17,16 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alert.h"
|
||||
|
||||
#include "clientversion.h"
|
||||
#include "net.h"
|
||||
#include "pubkey.h"
|
||||
#include "timedata.h"
|
||||
#include "ui_interface.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
@@ -118,7 +113,7 @@ uint256 CAlert::GetHash() const
|
||||
|
||||
bool CAlert::IsInEffect() const
|
||||
{
|
||||
return (GetTime() < nExpiration);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAlert::Cancels(const CAlert& alert) const
|
||||
@@ -138,146 +133,31 @@ bool CAlert::AppliesTo(int nVersion, const std::string& strSubVerIn) const
|
||||
|
||||
bool CAlert::AppliesToMe() const
|
||||
{
|
||||
return AppliesTo(PROTOCOL_VERSION, FormatSubVersion(GetArg("-clientname","MagicBean"), CLIENT_VERSION, std::vector<std::string>()));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAlert::RelayTo(CNode* pnode) const
|
||||
{
|
||||
if (!IsInEffect())
|
||||
return false;
|
||||
// don't relay to nodes which haven't sent their version message
|
||||
if (pnode->nVersion == 0)
|
||||
return false;
|
||||
// returns true if wasn't already contained in the set
|
||||
if (pnode->setKnown.insert(GetHash()).second)
|
||||
{
|
||||
if (AppliesTo(pnode->nVersion, pnode->strSubVer) ||
|
||||
AppliesToMe() ||
|
||||
GetTime() < nRelayUntil)
|
||||
{
|
||||
pnode->PushMessage("alert", *this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAlert::CheckSignature(const std::vector<unsigned char>& alertKey) const
|
||||
{
|
||||
CPubKey key(alertKey);
|
||||
if (!key.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig))
|
||||
return error("CAlert::CheckSignature(): verify signature failed");
|
||||
|
||||
// Now unserialize the data
|
||||
CDataStream sMsg(vchMsg, SER_NETWORK, PROTOCOL_VERSION);
|
||||
sMsg >> *(CUnsignedAlert*)this;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
CAlert CAlert::getAlertByHash(const uint256 &hash)
|
||||
{
|
||||
CAlert retval;
|
||||
{
|
||||
LOCK(cs_mapAlerts);
|
||||
map<uint256, CAlert>::iterator mi = mapAlerts.find(hash);
|
||||
if(mi != mapAlerts.end())
|
||||
retval = mi->second;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool CAlert::ProcessAlert(const std::vector<unsigned char>& alertKey, bool fThread)
|
||||
{
|
||||
if (!CheckSignature(alertKey))
|
||||
return false;
|
||||
if (!IsInEffect())
|
||||
return false;
|
||||
|
||||
// alert.nID=max is reserved for if the alert key is
|
||||
// compromised. It must have a pre-defined message,
|
||||
// must never expire, must apply to all versions,
|
||||
// and must cancel all previous
|
||||
// alerts or it will be ignored (so an attacker can't
|
||||
// send an "everything is OK, don't panic" version that
|
||||
// cannot be overridden):
|
||||
int maxInt = std::numeric_limits<int>::max();
|
||||
if (nID == maxInt)
|
||||
{
|
||||
if (!(
|
||||
nExpiration == maxInt &&
|
||||
nCancel == (maxInt-1) &&
|
||||
nMinVer == 0 &&
|
||||
nMaxVer == maxInt &&
|
||||
setSubVer.empty() &&
|
||||
nPriority == maxInt &&
|
||||
strStatusBar == "URGENT: Alert key compromised, upgrade required"
|
||||
))
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
LOCK(cs_mapAlerts);
|
||||
// Cancel previous alerts
|
||||
for (map<uint256, CAlert>::iterator mi = mapAlerts.begin(); mi != mapAlerts.end();)
|
||||
{
|
||||
const CAlert& alert = (*mi).second;
|
||||
if (Cancels(alert))
|
||||
{
|
||||
LogPrint("alert", "cancelling alert %d\n", alert.nID);
|
||||
uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED);
|
||||
mapAlerts.erase(mi++);
|
||||
}
|
||||
else if (!alert.IsInEffect())
|
||||
{
|
||||
LogPrint("alert", "expiring alert %d\n", alert.nID);
|
||||
uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED);
|
||||
mapAlerts.erase(mi++);
|
||||
}
|
||||
else
|
||||
mi++;
|
||||
}
|
||||
|
||||
// Check if this alert has been cancelled
|
||||
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
|
||||
{
|
||||
const CAlert& alert = item.second;
|
||||
if (alert.Cancels(*this))
|
||||
{
|
||||
LogPrint("alert", "alert already cancelled by %d\n", alert.nID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to mapAlerts
|
||||
mapAlerts.insert(make_pair(GetHash(), *this));
|
||||
// Notify UI and -alertnotify if it applies to me
|
||||
if(AppliesToMe())
|
||||
{
|
||||
uiInterface.NotifyAlertChanged(GetHash(), CT_NEW);
|
||||
Notify(strStatusBar, fThread);
|
||||
}
|
||||
}
|
||||
|
||||
LogPrint("alert", "accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe());
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CAlert::Notify(const std::string& strMessage, bool fThread)
|
||||
void CAlert::Notify(const std::string& strMessage, bool fThread)
|
||||
{
|
||||
std::string strCmd = GetArg("-alertnotify", "");
|
||||
if (strCmd.empty()) return;
|
||||
|
||||
// Alert text should be plain ascii coming from a trusted source, but to
|
||||
// be safe we first strip anything not in safeChars, then add single quotes around
|
||||
// the whole string before passing it to the shell:
|
||||
std::string singleQuote("'");
|
||||
std::string safeStatus = SanitizeString(strMessage);
|
||||
safeStatus = singleQuote+safeStatus+singleQuote;
|
||||
boost::replace_all(strCmd, "%s", safeStatus);
|
||||
|
||||
if (fThread)
|
||||
boost::thread t(runCommand, strCmd); // thread runs free
|
||||
else
|
||||
runCommand(strCmd);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
|
||||
extern void GetKomodoEarlytxidScriptPub();
|
||||
extern CScript KOMODO_EARLYTXID_SCRIPTPUB;
|
||||
extern CScript HUSH_EARLYTXID_SCRIPTPUB;
|
||||
|
||||
// #define PRICES_DAYWINDOW ((3600*24/ASSETCHAINS_BLOCKTIME) + 1) // defined in hush_defs.h
|
||||
#define PRICES_TXFEE 10000
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef CC_INCLUDE_H
|
||||
#define CC_INCLUDE_H
|
||||
|
||||
@@ -32,7 +31,7 @@ Details.
|
||||
/// this script's hash is what the p2sh address was.
|
||||
/// All of the above are the standard bitcoin vout types and there should be plenty of materials about it.
|
||||
///
|
||||
/// What I did with the cryptoconditions (CC) contracts (now rebranded as Antara modules) is created a fourth type of vout, the CC vout. This is using the cryptoconditions standard and it is even a different signature mechanism,
|
||||
/// Cryptoconditions (CC) contracts created a fourth type of vout, the CC vout. This is using the cryptoconditions standard and it is even a different signature mechanism,
|
||||
/// ed25519 instead of secp256k1. It is basically a big extension to the bitcoin script. There is a special opcode that is added that says it is a CC script.
|
||||
///
|
||||
/// But it gets more interesting. Each CC script has an evalcode.
|
||||
@@ -49,7 +48,7 @@ Details.
|
||||
/// However, it is a CC output, so in addition to the signature, whatever constraints a CC contract implements must also be satistifed.
|
||||
/// This allows funds to be locked and yet anybody is able to spend it, assuming they satisfy the CC's rules.
|
||||
///
|
||||
/// One other technical note is that komodod has the insight-explorer extensions built in
|
||||
/// One other technical note is that Hush has the insight-explorer extensions built in
|
||||
/// so it can lookup directly all transactions to any address.
|
||||
/// This is a key performance boosting thing as if it wasnt there, trying to get all the utxo for an address not in the wallet is quite time consuming.
|
||||
///
|
||||
@@ -138,8 +137,6 @@ struct CC_utxo
|
||||
/// \endcond
|
||||
|
||||
/// \cond INTERNAL
|
||||
// these are the parameters stored after Verus crypto-condition vouts. new versions may change
|
||||
// the format
|
||||
struct CC_meta
|
||||
{
|
||||
std::vector<unsigned char> version;
|
||||
@@ -774,7 +771,7 @@ bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
|
||||
/// @returns true if success
|
||||
bool GetCustomscriptaddress(char *destaddr,const CScript &scriptPubKey,uint8_t taddr,uint8_t prefix,uint8_t prefix2);
|
||||
|
||||
/// Returns my pubkey, that is set by -pubkey komodod parameter
|
||||
/// Returns my pubkey, that is set by -pubkey hushd parameter
|
||||
/// @returns public key as byte array
|
||||
std::vector<uint8_t> Mypubkey();
|
||||
|
||||
@@ -825,7 +822,7 @@ std::string FinalizeCCTx(uint64_t skipmask,struct CCcontract_info *cp,CMutableTr
|
||||
|
||||
/// FinalizeCCTx is a very useful function that will properly sign both CC and normal inputs, adds normal change and might add an opreturn output.
|
||||
/// This allows for Antara module transaction creation rpc functions to create an CMutableTransaction object, add the appropriate vins and vouts to it and use FinalizeCCTx to properly sign the transaction.
|
||||
/// By using -addressindex=1 of komodod daemon, it allows tracking of all the CC addresses.
|
||||
/// By using -addressindex=1 of hushd daemon, it allows tracking of all the CC addresses.
|
||||
///
|
||||
/// For signing the vins the function builds several default probe scriptPubKeys and checks them against the referred previous transactions (vintx) vouts.
|
||||
/// For cryptocondition vins the function creates a basic set of probe cryptconditions with mypk and module global pubkey, both for coins and tokens cases.
|
||||
@@ -893,7 +890,7 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
|
||||
int64_t AddNormalinputsLocal(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs);
|
||||
|
||||
/// AddNormalinputs2 adds normal (not cc) inputs to the transaction object vin array for the specified total amount using utxos on my pubkey's TX_PUBKEY address (my pubkey is set by -pubkey command line parameter), to fund the transaction.
|
||||
/// 'My pubkey' is the -pubkey parameter of komodod.
|
||||
/// 'My pubkey' is the -pubkey parameter of hushd.
|
||||
/// @param mtx mutable transaction object
|
||||
/// @param total amount of inputs to add. If total equals to 0 the function does not add inputs but returns amount of all available normal inputs in the wallet
|
||||
/// @param maxinputs maximum number of inputs to add
|
||||
@@ -972,7 +969,7 @@ void CCLogPrintStream(const char *category, int level, const char *functionName,
|
||||
}
|
||||
/// Macro for logging messages using bitcoin LogAcceptCategory and LogPrintStr functions.
|
||||
/// Supports error, info and three levels of debug messages.
|
||||
/// Logging category is set by -debug=category komodod param.
|
||||
/// Logging category is set by -debug=category hushd param.
|
||||
/// To set debug level pass -debug=category-1, -debug=category-2 or -debug=category-3 param. If some level is enabled lower level messages also will be printed.
|
||||
/// To print info-level messages pass just -debug=category parameter, with no level.
|
||||
/// Error-level messages will always be printed, even if -debug parameter is not set
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user