tests: test for coinbase wallet spend.

Attempt to spend a coinbase transaction, expected to fail.
This commit is contained in:
niftynei 2022-10-17 13:10:12 -05:00 committed by Christian Decker
parent ae3550cb00
commit d60dbba43b

View file

@ -1907,3 +1907,22 @@ def test_zeroreserve_alldust(node_factory):
# Now try with just a bit more
l1.connect(l2)
l1.rpc.fundchannel(l2.info['id'], minfunding + 1)
@pytest.mark.xfail
def test_coinbase_unspendable(node_factory, bitcoind):
""" A node should not be able to spend a coinbase output
before it's mature """
[l1] = node_factory.get_nodes(1)
addr = l1.rpc.newaddr()["bech32"]
bitcoind.rpc.generatetoaddress(1, addr)
addr2 = l1.rpc.newaddr()["bech32"]
# Wait til money in wallet
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 1)
l1.rpc.withdraw(addr2, "all")
# Nothing sent to the mempool!
assert len(bitcoind.rpc.getrawmempool()) == 0