From 289f6581cccefad42afa870b382fc22eb0c5e46c Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Thu, 20 Jul 2023 13:41:06 +0200 Subject: [PATCH] qa: functional test createspend refuses immature outpoints --- tests/test_rpc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_rpc.py b/tests/test_rpc.py index 4d1cf06b..119b04c9 100644 --- a/tests/test_rpc.py +++ b/tests/test_rpc.py @@ -132,6 +132,16 @@ def test_create_spend(lianad, bitcoind): # We can sign it and broadcast it. sign_and_broadcast(lianad, bitcoind, PSBT.from_base64(res["psbt"])) + # Try creating a transaction that spends an immature coinbase deposit. + addr = lianad.rpc.getnewaddress()["address"] + bitcoind.rpc.generatetoaddress(1, addr) + wait_for( + lambda: lianad.rpc.getinfo()["block_height"] == bitcoind.rpc.getblockcount() + ) + imma_coin = next(c for c in lianad.rpc.listcoins()["coins"] if c["is_immature"]) + with pytest.raises(RpcError, match=".*is from an immature coinbase transaction."): + lianad.rpc.createspend(destinations, [imma_coin["outpoint"]], 1) + def test_list_spend(lianad, bitcoind): # Start by creating two conflicting Spend PSBTs. The first one will have a change