lightninglabs / chantools

A loose collection of tools all somehow related to lnd and Lightning Network channels.
MIT License
221 stars 32 forks source link

Produced import file for bitcoin code w/ taproot wont work with Bitcoin Core #64

Closed Overtorment closed 1 year ago

Overtorment commented 1 year ago

I was recovering LND, and generated an import file for BitcoinCore. All was well, file was imported, however i noticed that BitcoinCore didnt see funds on a taproot address.

import line looked like this:

PRIV KEY HERE 2023-04-01T00:00:01Z label=m/86'/0'/0'/1/52/ # addr=LEGACY ADR,WRAPPED,BECH32,BECH32TAPROOT

Attempting to import only this one line produces following in bitcoin log:

2023-04-20T22:46:48Z [lnd] Importing LEGACE ADDRESS HERE...
2023-04-20T22:46:48Z [lnd] Already have key with pubkey  PUBKEY HEX HERE
2023-04-20T22:46:48Z [lnd] RescanFromTime: Rescanning last 2918 blocks

not sure where the issue is. maybe some additional steps needed for bitcoincore to recognize taproot funds? bitcoin version 24.0.1 chantools - latest binaries from the release page

guggero commented 1 year ago

My bad... I added P2TR addresses to genimportscript without testing whether they would be picked up by bitcoind. It turns out bitcoind doesn't support P2TR addresses in "legacy" wallets, only in "descriptor" wallets. So I added a new --format bitcoin-descriptors to genimportscript that should work with NP2WKH, P2WKH and P2TR. Can you try with the latest master branch please? Note that you will need to create a descriptor wallet in bitcoind first.

Overtorment commented 1 year ago

thanks! not gona try that now, but next time i will be recovering something.

guggero commented 1 year ago

Okay, sounds good. Going to close the issue as I tested it myself. Feel free to reopen if something doesn't work for you.