MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_withdraw_nlocktime_fuzz

Function test_withdraw_nlocktime_fuzz

tests/test_wallet.py:2201–2220  ·  view source on GitHub ↗

Test that we eventually fuzz nLockTime for withdrawal transactions.

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

2199
2200@unittest.skipIf(VALGRIND, "A big loop is used to check fuzz.")
2201def test_withdraw_nlocktime_fuzz(node_factory, bitcoind):
2202 """
2203 Test that we eventually fuzz nLockTime for withdrawal transactions.
2204 """
2205 l1 = node_factory.get_node(1)
2206 l1.fundwallet(10**8)
2207
2208 for i in range(100):
2209 addr = l1.rpc.newaddr("bech32")["bech32"]
2210 withdraw = l1.rpc.withdraw(addr, 10**3)
2211 bitcoind.generate_block(1)
2212 l1.daemon.wait_for_log('Owning output .* txid {} CONFIRMED'.
2213 format(withdraw["txid"]))
2214 decoded = bitcoind.rpc.decoderawtransaction(withdraw["tx"])
2215 tip = node_factory.bitcoind.rpc.getblockcount()
2216 assert decoded["locktime"] > 0
2217 if decoded["locktime"] < tip:
2218 return
2219 else:
2220 raise Exception("No transaction with fuzzed nLockTime !")
2221
2222
2223def test_multiwithdraw_simple(node_factory, bitcoind, chainparams):

Callers

nothing calls this directly

Calls 6

fundwalletMethod · 0.80
generate_blockMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45
newaddrMethod · 0.45
withdrawMethod · 0.45

Tested by

no test coverage detected