aboutsummaryrefslogtreecommitdiff
path: root/test/functional/interface_rest.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2018-03-22 16:41:22 -0400
committerRoman Zeyde <me@romanzey.de>2018-04-03 10:53:52 +0300
commitade5964e3f8c5039878e1296311bb0337c152d2f (patch)
tree6c41d0d482d587eb92c491a9f0a6489b325ee662 /test/functional/interface_rest.py
parentad00fbed3cfcfe7e921500179183589ac4aad419 (diff)
[tests] only use 2 nodes in interface_rest.py
Diffstat (limited to 'test/functional/interface_rest.py')
-rwxr-xr-xtest/functional/interface_rest.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py
index 1af986a05e..0a924e3149 100755
--- a/test/functional/interface_rest.py
+++ b/test/functional/interface_rest.py
@@ -18,7 +18,6 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_greater_than,
- connect_nodes_bi,
hex_str_to_bytes,
)
@@ -40,13 +39,8 @@ def filter_output_indices_by_value(vouts, value):
class RESTTest (BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
- self.num_nodes = 3
- self.extra_args = [["-rest"]] * self.num_nodes
-
- def setup_network(self, split=False):
- super().setup_network()
- connect_nodes_bi(self.nodes, 0, 2)
- self.url = urllib.parse.urlparse(self.nodes[0].url)
+ self.num_nodes = 2
+ self.extra_args = [["-rest"], []]
def test_rest_request(self, uri, http_method='GET', req_type=ReqType.JSON, body='', status=200, ret_type=RetType.JSON):
rest_uri = '/rest' + uri
@@ -75,18 +69,22 @@ class RESTTest (BitcoinTestFramework):
return json.loads(resp.read().decode('utf-8'), parse_float=Decimal)
def run_test(self):
+ self.url = urllib.parse.urlparse(self.nodes[0].url)
self.log.info("Mine blocks and send Bitcoin to node 1")
+ # Random address so node1's balance doesn't increase
+ not_related_address = "2MxqoHEdNQTyYeX1mHcbrrpzgojbosTpCvJ"
+
self.nodes[0].generate(1)
self.sync_all()
- self.nodes[2].generate(100)
+ self.nodes[1].generatetoaddress(100, not_related_address)
self.sync_all()
assert_equal(self.nodes[0].getbalance(), 50)
txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)
self.sync_all()
- self.nodes[2].generate(1)
+ self.nodes[1].generatetoaddress(1, not_related_address)
self.sync_all()
bb_hash = self.nodes[0].getbestblockhash()
@@ -260,9 +258,9 @@ class RESTTest (BitcoinTestFramework):
# Make 3 tx and mine them on node 1
txs = []
- txs.append(self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11))
- txs.append(self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11))
- txs.append(self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11))
+ txs.append(self.nodes[0].sendtoaddress(not_related_address, 11))
+ txs.append(self.nodes[0].sendtoaddress(not_related_address, 11))
+ txs.append(self.nodes[0].sendtoaddress(not_related_address, 11))
self.sync_all()
# Check that there are exactly 3 transactions in the TX memory pool before generating the block