Skip to content

Commit 74d85c4

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 68cf8a1 commit 74d85c4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

divi/qa/rpc-tests/mnvaults.py

Lines changed: 9 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

@@ -75,7 +75,7 @@ def start_node (self, n):
7575
args.append ("-masternodeprivkey=%s" % self.cfg.privkey)
7676

7777
if self.cfg:
78-
cfg = [self.cfg.line]
78+
cfg = [self.cfg.getLine ()]
7979
else:
8080
cfg = []
8181

@@ -156,8 +156,7 @@ def fund_vault (self):
156156

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

162161
for i in [0, 1, 2]:
163162
self.stop_node (i)
@@ -235,6 +234,9 @@ def get_payments (self):
235234
self.advance_time (10)
236235
time.sleep(0.01)
237236

237+
# Mine some blocks normally to make sure the rewards are mature.
238+
self.mine_blocks (20)
239+
238240
# Check that some payments were made.
239241
winners = self.nodes[3].getmasternodewinners ()
240242
found = False
@@ -244,7 +246,9 @@ def get_payments (self):
244246
break
245247
assert_equal (found, True)
246248

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

249253
def unvault (self):
250254
print ("Unvaulting the funds...")

0 commit comments

Comments
 (0)