insightexplorer: formatting, pyflakes cleanups
This commit is contained in:
parent
5fd1f5afc0
commit
7c5a791b73
|
@ -1,8 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Copyright (c) 2019 The Zcash developers
|
# Copyright (c) 2019 The Zcash developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test addressindex generation and fetching for insightexplorer
|
# Test addressindex generation and fetching for insightexplorer
|
||||||
#
|
#
|
||||||
|
@ -13,23 +12,20 @@
|
||||||
# getaddressdeltas
|
# getaddressdeltas
|
||||||
# getaddressutxos
|
# getaddressutxos
|
||||||
# getaddressmempool
|
# getaddressmempool
|
||||||
#
|
|
||||||
|
|
||||||
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. Please use Python 2.7.x."
|
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. Please use Python 2.7.x."
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
|
|
||||||
|
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
assert_equal,
|
assert_equal,
|
||||||
initialize_chain_clean,
|
initialize_chain_clean,
|
||||||
start_nodes,
|
start_nodes,
|
||||||
stop_nodes,
|
stop_nodes,
|
||||||
connect_nodes,
|
connect_nodes,
|
||||||
|
wait_bitcoinds,
|
||||||
)
|
)
|
||||||
|
|
||||||
from test_framework.util import wait_bitcoinds
|
|
||||||
|
|
||||||
from test_framework.script import (
|
from test_framework.script import (
|
||||||
CScript,
|
CScript,
|
||||||
OP_HASH160,
|
OP_HASH160,
|
||||||
|
@ -38,8 +34,11 @@ from test_framework.script import (
|
||||||
OP_DROP,
|
OP_DROP,
|
||||||
)
|
)
|
||||||
|
|
||||||
from test_framework.mininode import COIN, CTransaction
|
from test_framework.mininode import (
|
||||||
from test_framework.mininode import CTxIn, CTxOut, COutPoint
|
COIN,
|
||||||
|
CTransaction,
|
||||||
|
CTxIn, CTxOut, COutPoint,
|
||||||
|
)
|
||||||
|
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,28 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Copyright (c) 2019 The Zcash developers
|
# Copyright (c) 2019 The Zcash developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
|
||||||
|
|
||||||
#
|
|
||||||
# Test spentindex generation and fetching
|
|
||||||
#
|
#
|
||||||
|
# Test spentindex generation and fetching for insightexplorer
|
||||||
|
|
||||||
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. Please use Python 2.7.x."
|
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. Please use Python 2.7.x."
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
|
|
||||||
from test_framework.util import assert_equal
|
from test_framework.util import (
|
||||||
from test_framework.util import initialize_chain_clean
|
assert_equal,
|
||||||
from test_framework.util import start_nodes, stop_nodes, connect_nodes
|
initialize_chain_clean,
|
||||||
from test_framework.util import wait_bitcoinds
|
start_nodes,
|
||||||
from test_framework.util import fail
|
stop_nodes,
|
||||||
|
connect_nodes,
|
||||||
|
wait_bitcoinds,
|
||||||
|
fail,
|
||||||
|
)
|
||||||
|
|
||||||
from test_framework.mininode import COIN
|
from test_framework.mininode import COIN
|
||||||
|
|
||||||
|
|
||||||
class SpentIndexTest(BitcoinTestFramework):
|
class SpentIndexTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def setup_chain(self):
|
def setup_chain(self):
|
||||||
|
@ -29,7 +32,8 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
# -insightexplorer causes spentindex to be enabled (fSpentIndex = true)
|
# -insightexplorer causes spentindex to be enabled (fSpentIndex = true)
|
||||||
|
|
||||||
self.nodes = start_nodes(3, self.options.tmpdir,
|
self.nodes = start_nodes(
|
||||||
|
3, self.options.tmpdir,
|
||||||
[['-debug', '-txindex', '-experimentalfeatures', '-insightexplorer']]*3)
|
[['-debug', '-txindex', '-experimentalfeatures', '-insightexplorer']]*3)
|
||||||
connect_nodes(self.nodes[0], 1)
|
connect_nodes(self.nodes[0], 1)
|
||||||
connect_nodes(self.nodes[0], 2)
|
connect_nodes(self.nodes[0], 2)
|
||||||
|
@ -178,5 +182,6 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||||
assert_equal(len(out), 1)
|
assert_equal(len(out), 1)
|
||||||
assert_equal(out[0]['address'], addr2)
|
assert_equal(out[0]['address'], addr2)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
SpentIndexTest().main()
|
SpentIndexTest().main()
|
||||||
|
|
|
@ -1077,8 +1077,8 @@ UniValue getspentinfo(const UniValue& params, bool fHelp)
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
+ HelpExampleCli("getspentinfo", "'{\"txid\": \"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9\", \"index\": 0}'")
|
+ HelpExampleCli("getspentinfo", "'{\"txid\": \"33990288fb116981260be1de10b8c764f997674545ab14f9240f00346333b780\", \"index\": 4}'")
|
||||||
+ HelpExampleRpc("getspentinfo", "{\"txid\": \"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9\", \"index\": 0}")
|
+ HelpExampleRpc("getspentinfo", "{\"txid\": \"33990288fb116981260be1de10b8c764f997674545ab14f9240f00346333b780\", \"index\": 4}")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
|
|
Loading…
Reference in New Issue