btcsuite / btcutil

Provides bitcoin-specific convenience functions and types
477 stars 410 forks source link

add test case for litecoin bech32 addresses #151

Closed michael1011 closed 4 years ago

michael1011 commented 4 years ago

I noticed that the Litecoin LND wallet on regtest, simnet, testnet and mainnet doesn't support sending to Litecoin bech32 addresses because the list of valid bech32 prefixes is hardcoded in btcd and, of course, doesn't include the Litecoin ones.

Therefore I am opening this PR that fixes sending to bech32 Litecoin addresses in the LND wallet by comparing the bech32 prefix to the one specified in the parameter defaultNet *chaincfg.Params.

losh11 commented 4 years ago

It's a small fix and without this fix it's blocking litecoin lightning apps on our side so 👍

Roasbeef commented 4 years ago

This should live in the ltcsuite repos instead.

michael1011 commented 4 years ago

This should live in the ltcsuite repos instead.

@Roasbeef as far as I understand it, LND is always using btcutil as dependency and merging this fix in ltcsuite/ltcutil would have no effect on LND. But feel free to correct me if I am wrong.

michael1011 commented 4 years ago

@onyb your suggestion worked! I guess that the issue in lnd is related to not calling chaincfg.Register() when using a litecoin network then...

I removed my changes in address.go but updated and left the tests for the bech32 litecoin address.