MCPcopy Create free account
hub / github.com/ElementsProject/elements / run_test

Method run_test

test/functional/wallet_timelock.py:17–46  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

15 self.skip_if_no_wallet()
16
17 def run_test(self):
18 node = self.nodes[0]
19
20 mtp_tip = node.getblockheader(node.getbestblockhash())["mediantime"]
21
22 self.log.info("Get new address with label")
23 label = "timelock⌛🔓"
24 address = node.getnewaddress(label=label)
25
26 self.log.info("Send to new address with locktime")
27 node.send(
28 outputs=[{address: 5}],
29 options={"locktime": mtp_tip - 1},
30 )
31 self.generate(node, 1)
32
33 self.log.info("Check that clock cannot change finality of confirmed txs")
34 amount_before_ad = node.getreceivedbyaddress(address)
35 amount_before_lb = node.getreceivedbylabel(label)
36 list_before_ad = node.listreceivedbyaddress(address_filter=address)
37 list_before_lb = node.listreceivedbylabel(include_empty=False)
38 balance_before = node.getbalances()["mine"]["trusted"]
39 coin_before = node.listunspent(maxconf=1)
40 node.setmocktime(mtp_tip - 1)
41 assert_equal(node.getreceivedbyaddress(address), amount_before_ad)
42 assert_equal(node.getreceivedbylabel(label), amount_before_lb)
43 assert_equal(node.listreceivedbyaddress(address_filter=address), list_before_ad)
44 assert_equal(node.listreceivedbylabel(include_empty=False), list_before_lb)
45 assert_equal(node.getbalances()["mine"]["trusted"], balance_before)
46 assert_equal(node.listunspent(maxconf=1), coin_before)
47
48
49if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
infoMethod · 0.80
setmocktimeMethod · 0.80
generateMethod · 0.45

Tested by

no test coverage detected