Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track coinbases in wallet #5664

Merged
merged 4 commits into from
Nov 9, 2022

Conversation

niftynei
Copy link
Collaborator

@niftynei niftynei commented Oct 17, 2022

Mark outputs as coinbases; don't spend them until they're mature.

Fixes #5564
Fixes #5696

@niftynei niftynei force-pushed the nifty/coinbase-utxos branch 2 times, most recently from cc267eb to a53ed79 Compare October 18, 2022 17:50
@@ -1898,3 +1898,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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is junk, it would fail even after you fix the problem!

The difference is that currently it fails with "Error broadcasting transaction: error code: -26\nerror message:\nbad-txns-premature-spend-of-coinbase, tried to spend coinbase at depth 1.", and you want a better error.

Don't change the test when you fix the problem! (Or maybe, just append to it!).

How about two inputs, one mature one not, and try to send 1000 sats and it should work? (We probably naively spend first input, so you should mine 100 blocks,then mine one to l1, then send another from bitcoind -> l1).

tests/test_opening.py Outdated Show resolved Hide resolved
lightningd/dual_open_control.c Outdated Show resolved Hide resolved
tests/test_opening.py Outdated Show resolved Hide resolved
wallet/wallet.c Outdated Show resolved Hide resolved
wallet/wallet.c Outdated Show resolved Hide resolved
wallet/walletrpc.c Outdated Show resolved Hide resolved
wallet/walletrpc.c Outdated Show resolved Hide resolved
wallet/wallet.c Outdated Show resolved Hide resolved
wallet/wallet.c Outdated Show resolved Hide resolved
@cdecker cdecker added this to the v22.11 milestone Nov 1, 2022
Attempt to spend a coinbase transaction, expected to fail.
@cdecker cdecker force-pushed the nifty/coinbase-utxos branch 2 times, most recently from beda83e to a29dcf4 Compare November 8, 2022 16:37
niftynei and others added 3 commits November 8, 2022 17:54
Changelog-Changed: JSON-RPC: `listfunds` now lists coinbase outputs as 'immature' until they're spendable
Changelog-Changed: JSON-RPC: UTXOs aren't spendable while immature
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f9280cc

Sorry for delay here but I only got the meaning of this while reading this issue #5696

@cdecker cdecker merged commit eb12282 into ElementsProject:master Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants