btcsuite / btcutil

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

use defaultnet params instead of btc chaincfg for decode address #133

Closed dannypaz closed 5 years ago

dannypaz commented 5 years ago

This PR fixes a bug where BTCs default chain params from chaincfg are being used instead of the defaultNet when trying to decode a wallet address in DecodeAddress.

A user may want to override the default values of chaincfg by passing in a different set of defaultNet params, however DecodeAddress will currently throw ErrUnknownAddressType if the P2PKH or P2SH values do not match the default hardcoded values found in btcd/chaincfg.

An additional benefit to this change is that P2PKH and P2SH values are scoped to the network instead of checking ALL values that were configured with chaincfg

ecurrencyhodler commented 5 years ago

@cfromknecht Could you take a look at this? Would this be the best way to resolve this issue? It's a critical bug that prevents people from sending LTC out of lnd on-chain.

dannypaz commented 5 years ago

@cfromknecht thanks for the review. I've updated the PR

dannypaz commented 5 years ago

@Roasbeef Are you able to merge this PR?

jogc commented 5 years ago

+1 please look into merging this. i have LTC locked in a node that i need to get out ASAP. thanks

Roasbeef commented 5 years ago

The proper solution is to correct our LTC integration within lnd, but in the short term, merging this in order to make it useable again.