Test that we don't set the nLockTime to 0 for withdrawal and txprepare transactions.
(node_factory)
| 2172 | |
| 2173 | |
| 2174 | def 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.") |