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

Function test_withdraw_nlocktime

tests/test_wallet.py:2174–2197  ·  view source on GitHub ↗

Test that we don't set the nLockTime to 0 for withdrawal and txprepare transactions.

(node_factory)

Source from the content-addressed store, hash-verified

2172
2173
2174def test_withdraw_nlocktime(node_factory):
2175 """
2176 Test that we don't set the nLockTime to 0 for withdrawal and
2177 txprepare transactions.
2178 """
2179 l1 = node_factory.get_node(1)
2180 l1.fundwallet(10**4)
2181 l1.fundwallet(10**4)
2182
2183 # withdraw
2184 addr = l1.rpc.newaddr("bech32")["bech32"]
2185 tx = l1.rpc.withdraw(addr, 10**3)["tx"]
2186 nlocktime = node_factory.bitcoind.rpc.decoderawtransaction(tx)["locktime"]
2187 tip = node_factory.bitcoind.rpc.getblockcount()
2188
2189 assert nlocktime > 0 and nlocktime <= tip
2190
2191 # txprepare
2192 txid = l1.rpc.txprepare([{addr: 10**3}])["txid"]
2193 tx = l1.rpc.txsend(txid)["tx"]
2194 nlocktime = node_factory.bitcoind.rpc.decoderawtransaction(tx)["locktime"]
2195 tip = node_factory.bitcoind.rpc.getblockcount()
2196
2197 assert nlocktime > 0 and nlocktime <= tip
2198
2199
2200@unittest.skipIf(VALGRIND, "A big loop is used to check fuzz.")

Callers

nothing calls this directly

Calls 6

fundwalletMethod · 0.80
txprepareMethod · 0.80
txsendMethod · 0.80
get_nodeMethod · 0.45
newaddrMethod · 0.45
withdrawMethod · 0.45

Tested by

no test coverage detected