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

multi: add new pullanchor command #100

Merged
merged 1 commit into from Dec 28, 2023
Merged

multi: add new pullanchor command #100

merged 1 commit into from Dec 28, 2023

Conversation

guggero
Copy link
Member

@guggero guggero commented Dec 14, 2023

Allows users to pull down (CPFP) an anchor output of a channel force close transaction that has a too low fee.

Example use:

chantools pullanchor \
    --sponsorinput <txid:vout> \        # must be an input from lncli listunspent that is confirmed and has enough funds to pay for fees
    --anchoraddr bc1q... \        # this is the on-chain address of the anchor output (the one with 330 satoshis)
    --changeaddr bc1q... \        # this is a p2wkh address from your lnd wallet where the change goes to (lncli newaddress p2wkh)
    --feerate xx        # the desired fee rate in sat/vByte, must be high enough to sponsor both transactions, so must be higher than the "effective" fee rate currently is

Copy link
Contributor

@bitromortac bitromortac left a comment

Choose a reason for hiding this comment

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

Very cool 🚀, this will be very useful! It worked for me in my local tests, but I had to publish with bitcoind in order to get a better error message (my fees were set too low):
lncli wallet publishtx <rawtx>:
[lncli] rpc error: code = Unknown desc = transaction rejected: output already spent

bitcoin-cli sendrawtransaction <rawtx>:
insufficient fee, rejecting replacement 20965f18add93b50540657f194d0d6222c6633e8a1859ee67f694a473f11d054; new feerate 0.00030000 BTC/kvB <= old feerate 0.00108518 BTC/kvB

I couldn't find a way to tell which anchor output is the local one, is there an easy way to see this, or does one just have to try?

Tested this with a p2wpkh and p2tr sponsor.

cmd/chantools/pullanchor.go Outdated Show resolved Hide resolved
@guggero
Copy link
Member Author

guggero commented Dec 14, 2023

I couldn't find a way to tell which anchor output is the local one, is there an easy way to see this, or does one just have to try?

Unfortunately there is no way to tell AFAIK. But since we try to derive the address first, it will fail if no match can be found, then you know to use the other one.

@lightninglabs-deploy
Copy link

@guggero, remember to re-request review from reviewers when ready

@guggero
Copy link
Member Author

guggero commented Dec 28, 2023

Updated to be compatible with Taproot Channel anchors and added the ability to pull multiple anchors with a single TX.

@guggero guggero merged commit 92fdb15 into master Dec 28, 2023
2 checks passed
@guggero guggero deleted the pullanchor branch December 28, 2023 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants