diff --git a/backend/accounts/account.go b/backend/accounts/account.go index 3c65feb04e..34fcbfb849 100644 --- a/backend/accounts/account.go +++ b/backend/accounts/account.go @@ -16,7 +16,6 @@ package accounts import ( "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcutil" "github.com/digitalbitbox/bitbox-wallet-app/backend/coins/coin" "github.com/digitalbitbox/bitbox-wallet-app/backend/keystore" "github.com/digitalbitbox/bitbox-wallet-app/backend/rates" @@ -49,7 +48,6 @@ type Interface interface { GetUnusedReceiveAddresses() []Address CanVerifyAddresses() (bool, bool, error) VerifyAddress(addressID string) (bool, error) - ConvertToLegacyAddress(addressID string) (btcutil.Address, error) Keystores() *keystore.Keystores RateUpdater() *rates.RateUpdater } diff --git a/backend/coins/btc/account.go b/backend/coins/btc/account.go index 2612f5ea09..aac484c1ce 100644 --- a/backend/coins/btc/account.go +++ b/backend/coins/btc/account.go @@ -716,23 +716,6 @@ func (account *Account) CanVerifyAddresses() (bool, bool, error) { return account.Keystores().CanVerifyAddresses(account.signingConfiguration, account.Coin()) } -// ConvertToLegacyAddress converts a ltc p2sh address to the legacy format (starting with -// '3'). Returns an error for non litecoin p2sh accounts. -func (account *Account) ConvertToLegacyAddress(addressID string) (btcutil.Address, error) { - account.synchronizer.WaitSynchronized() - defer account.RLock()() - scriptHashHex := blockchain.ScriptHashHex(addressID) - address := account.receiveAddresses.LookupByScriptHashHex(scriptHashHex) - if address == nil { - return nil, errp.New("unknown address not found") - } - if account.coin.Net() != <c.MainNetParams || address.Configuration.ScriptType() != signing.ScriptTypeP2WPKHP2SH { - return nil, errp.New("must be an ltc p2sh address") - } - hash := address.Address.(*btcutil.AddressScriptHash).Hash160() - return btcutil.NewAddressScriptHashFromHash(hash[:], &chaincfg.MainNetParams) -} - // Keystores returns the keystores of the account. func (account *Account) Keystores() *keystore.Keystores { return account.keystores diff --git a/backend/coins/btc/handlers/handlers.go b/backend/coins/btc/handlers/handlers.go index 60143860f1..89ae608063 100644 --- a/backend/coins/btc/handlers/handlers.go +++ b/backend/coins/btc/handlers/handlers.go @@ -67,7 +67,6 @@ func NewHandlers( handleFunc("/can-verify-extended-public-key", handlers.ensureAccountInitialized(handlers.getCanVerifyExtendedPublicKey)).Methods("GET") handleFunc("/verify-extended-public-key", handlers.ensureAccountInitialized(handlers.postVerifyExtendedPublicKey)).Methods("POST") handleFunc("/has-secure-output", handlers.ensureAccountInitialized(handlers.getHasSecureOutput)).Methods("GET") - handleFunc("/convert-to-legacy-address", handlers.ensureAccountInitialized(handlers.postConvertToLegacyAddress)).Methods("POST") return handlers } @@ -500,15 +499,3 @@ func (handlers *Handlers) getHasSecureOutput(r *http.Request) (interface{}, erro "optional": optional, }, nil } - -func (handlers *Handlers) postConvertToLegacyAddress(r *http.Request) (interface{}, error) { - var addressID string - if err := json.NewDecoder(r.Body).Decode(&addressID); err != nil { - return nil, errp.WithStack(err) - } - address, err := handlers.account.ConvertToLegacyAddress(addressID) - if err != nil { - return nil, err - } - return address.EncodeAddress(), nil -} diff --git a/backend/coins/eth/account.go b/backend/coins/eth/account.go index 2b07fd760c..f9f811f857 100644 --- a/backend/coins/eth/account.go +++ b/backend/coins/eth/account.go @@ -23,7 +23,6 @@ import ( "time" "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcutil" "github.com/digitalbitbox/bitbox-wallet-app/backend/accounts" "github.com/digitalbitbox/bitbox-wallet-app/backend/accounts/errors" "github.com/digitalbitbox/bitbox-wallet-app/backend/coins/btc/synchronizer" @@ -683,11 +682,6 @@ func (account *Account) CanVerifyAddresses() (bool, bool, error) { return account.Keystores().CanVerifyAddresses(account.signingConfiguration, account.Coin()) } -// ConvertToLegacyAddress implements accounts.Interface. -func (account *Account) ConvertToLegacyAddress(string) (btcutil.Address, error) { - panic("not used") -} - // Keystores implements accounts.Interface. func (account *Account) Keystores() *keystore.Keystores { return account.keystores