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

Function test_minconf_withdraw

tests/test_wallet.py:241–266  ·  view source on GitHub ↗

Issue 2518: ensure that ridiculous confirmation levels don't overflow The number of confirmations is used to compute a maximum height that is to be accepted. If the current height is smaller than the number of confirmations we wrap around and just select everything. The fix is to cl

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

239
240
241def test_minconf_withdraw(node_factory, bitcoind):
242 """Issue 2518: ensure that ridiculous confirmation levels don't overflow
243
244 The number of confirmations is used to compute a maximum height that is to
245 be accepted. If the current height is smaller than the number of
246 confirmations we wrap around and just select everything. The fix is to
247 clamp the maxheight parameter to a positive small number.
248
249 """
250 amount = 1000000
251 # Don't get any funds from previous runs.
252 l1 = node_factory.get_node(random_hsm=True)
253 addr = l1.rpc.newaddr(good_addrtype())[good_addrtype()]
254
255 # Add some funds to withdraw later
256 for i in range(10):
257 l1.bitcoin.rpc.sendtoaddress(addr, amount / 10**8 + 0.01)
258
259 bitcoind.generate_block(1)
260
261 wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 10)
262 # This violates the request schema!
263 l1.rpc.check_request_schemas = False
264
265 with pytest.raises(RpcError):
266 l1.rpc.withdraw(destination=addr, satoshi=10000, feerate='normal', minconf=9999999)
267
268
269@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "BIP86 random_hsm not compatible with liquid-regtest bech32")

Callers

nothing calls this directly

Calls 7

wait_forFunction · 0.90
good_addrtypeFunction · 0.85
generate_blockMethod · 0.80
get_nodeMethod · 0.45
newaddrMethod · 0.45
listfundsMethod · 0.45
withdrawMethod · 0.45

Tested by

no test coverage detected