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

Function test_withdraw_bech32m

tests/test_wallet.py:2324–2352  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

2322
2323@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "Uses regtest addresses")
2324def test_withdraw_bech32m(node_factory, bitcoind):
2325 l1 = node_factory.get_node()
2326 l1.fundwallet(10000000)
2327
2328 # Based on BIP-350, but all changed to valid regtest.
2329 addrs = ("BCRT1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KYGT080",
2330 "bcrt1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qzf4jry",
2331 "bcrt1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k0ylj56",
2332 "BCRT1SW50QT2UWHA",
2333 "bcrt1zw508d6qejxtdg4y5r3zarvaryv2wuatf",
2334 "bcrt1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvseswlauz7",
2335 "bcrt1pqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesyga46z",
2336 "bcrt1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqc8gma6")
2337
2338 for addr in addrs:
2339 l1.rpc.withdraw(addr, 10**3)
2340 bitcoind.generate_block(1, wait_for_mempool=1)
2341 print(l1.rpc.listfunds()['outputs'])
2342 wait_for(lambda: [o for o in l1.rpc.listfunds()['outputs'] if o['status'] == 'confirmed' and not o['reserved']] != [])
2343
2344 # Test multiwithdraw
2345 args = []
2346 for addr in addrs:
2347 args += [{addr: 10**3}]
2348 res = l1.rpc.multiwithdraw(args)
2349
2350 # Let's check to make sure outputs are as expected (plus change)
2351 outputs = bitcoind.rpc.decoderawtransaction(res['tx'])["vout"]
2352 assert set([output['scriptPubKey']['address'] for output in outputs]).issuperset([addr.lower() for addr in addrs])
2353
2354
2355@unittest.skipIf(TEST_NETWORK != 'regtest', "Elements-based schnorr is not yet supported")

Callers

nothing calls this directly

Calls 7

wait_forFunction · 0.90
fundwalletMethod · 0.80
generate_blockMethod · 0.80
multiwithdrawMethod · 0.80
get_nodeMethod · 0.45
withdrawMethod · 0.45
listfundsMethod · 0.45

Tested by

no test coverage detected