bernardladenthin/BitcoinAddressFinder

Try to parse P2TR more properly

bernardladenthin opened this issue · 0 comments

In a newer release P2TR might be supported.
https://bitcoinj.org/release-notes
Implement Taproot BIP341 – send to P2TR addresses. Receiving to and spending from P2TR addresses and chains will be implemented in a future release.

In AddressTxtLine the code SegwitAddress.fromBech32(keyUtility.networkParameters, address); is not correct for P2TR addresses and throws an

org.bitcoinj.core.AddressFormatException$InvalidChecksum: Checksum does not validate
	at org.bitcoinj.core.Bech32.decode(Bech32.java:156)
	at org.bitcoinj.core.SegwitAddress.fromBech32(SegwitAddress.java:167)

A workaround is used to catch the exception.

The goal is to prevent this exception.
See StaticUnsupportedAddress and BitcoinP2TR for the test.