cryptoadvance / specter-diy

DIY airgapped hardware wallet that uses QR codes for communication with the host
MIT License
446 stars 76 forks source link

Support partial derivations in psbt #221

Open stepansnigirev opened 1 year ago

stepansnigirev commented 1 year ago

In some cases software wallets don't add a full derivation path to the psbt, but only last non-hardened derivation after known xpub. For example if normal derivation looks like m/84h/0h/0h/0/3 software that is using only xpub may provide only m/0/3 part. And fingerprint can be either a fingerprint of the xpub (btcpay) or a fingerprint filled with zeroes (blue wallet). Makes sense to check if existing wallets can derive correct keys even with a short derivation. I think we can limit support to 2-index derivations. I thought we had this supported but it looks like it's broken now, so also makes sense to add tests for it.