Skip to content

Commit 4ce192f

Browse files
committed
Use custom reward address in mnvaults.py.
Custom reward addresses are one of the core features needed for proper masternode vaults. With them implemented now, we can update the mnvaults.py test (resolving two FIXME's in there) to actually make use of an explicit reward address so that the masternode rewards are received and not lost (as we want them to be in practice).
1 parent 1d11013 commit 4ce192f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

divi/qa/rpc-tests/mnvaults.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2020 The DIVI developers
2+
# Copyright (c) 2020-2021 The DIVI developers
33
# Distributed under the MIT/X11 software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -31,6 +31,7 @@ def __init__ (self):
3131
self.cfg = None
3232

3333
def setup_chain (self):
34+
print("Initializing test directory " + self.options.tmpdir)
3435
for i in range (7):
3536
initialize_datadir (self.options.tmpdir, i)
3637

@@ -78,7 +79,7 @@ def start_node (self, n):
7879
args.append ("-masternodeprivkey=%s" % self.cfg.privkey)
7980

8081
if self.cfg:
81-
cfg = [self.cfg.line]
82+
cfg = [self.cfg.getLine ()]
8283
else:
8384
cfg = []
8485

@@ -153,8 +154,7 @@ def fund_vault (self):
153154

154155
self.cfg = fund_masternode (self.nodes[0], "mn", "copper", txid,
155156
"localhost:%d" % p2p_port (1))
156-
# FIXME: Use reward address from node 0.
157-
self.cfg.rewardAddr = addr
157+
self.cfg.rewardAddr = self.nodes[0].getnewaddress ("reward")
158158

159159
for i in [0, 2]:
160160
self.stop_node (i)
@@ -233,6 +233,9 @@ def get_payments (self):
233233
self.advance_time (10)
234234
time.sleep(0.01)
235235

236+
# Mine some blocks normally to make sure the rewards are mature.
237+
self.mine_blocks (20)
238+
236239
# Check that some payments were made.
237240
winners = self.nodes[3].getmasternodewinners ()
238241
found = False
@@ -242,7 +245,9 @@ def get_payments (self):
242245
break
243246
assert_equal (found, True)
244247

245-
# FIXME: Check in wallet when we have a custom reward address.
248+
# The payments should have been received at the reward address
249+
# and in particular not be lost in the "destroyed" vault.
250+
assert_greater_than (self.nodes[0].getbalance ("reward"), 0)
246251

247252
def unvault (self):
248253
print ("Unvaulting the funds...")

0 commit comments

Comments
 (0)