Skip to content

Commit 982e154

Browse files
committed
Merge remote-tracking branch 'benma/ltclegacy'
2 parents af07b20 + 5ec2ceb commit 982e154

File tree

4 files changed

+0
-38
lines changed

4 files changed

+0
-38
lines changed

backend/accounts/account.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package accounts
1616

1717
import (
1818
"github.com/btcsuite/btcd/wire"
19-
"github.com/btcsuite/btcutil"
2019
"github.com/digitalbitbox/bitbox-wallet-app/backend/coins/coin"
2120
"github.com/digitalbitbox/bitbox-wallet-app/backend/keystore"
2221
"github.com/digitalbitbox/bitbox-wallet-app/backend/rates"
@@ -49,7 +48,6 @@ type Interface interface {
4948
GetUnusedReceiveAddresses() []Address
5049
CanVerifyAddresses() (bool, bool, error)
5150
VerifyAddress(addressID string) (bool, error)
52-
ConvertToLegacyAddress(addressID string) (btcutil.Address, error)
5351
Keystores() *keystore.Keystores
5452
RateUpdater() *rates.RateUpdater
5553
}

backend/coins/btc/account.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -716,23 +716,6 @@ func (account *Account) CanVerifyAddresses() (bool, bool, error) {
716716
return account.Keystores().CanVerifyAddresses(account.signingConfiguration, account.Coin())
717717
}
718718

719-
// ConvertToLegacyAddress converts a ltc p2sh address to the legacy format (starting with
720-
// '3'). Returns an error for non litecoin p2sh accounts.
721-
func (account *Account) ConvertToLegacyAddress(addressID string) (btcutil.Address, error) {
722-
account.synchronizer.WaitSynchronized()
723-
defer account.RLock()()
724-
scriptHashHex := blockchain.ScriptHashHex(addressID)
725-
address := account.receiveAddresses.LookupByScriptHashHex(scriptHashHex)
726-
if address == nil {
727-
return nil, errp.New("unknown address not found")
728-
}
729-
if account.coin.Net() != &ltc.MainNetParams || address.Configuration.ScriptType() != signing.ScriptTypeP2WPKHP2SH {
730-
return nil, errp.New("must be an ltc p2sh address")
731-
}
732-
hash := address.Address.(*btcutil.AddressScriptHash).Hash160()
733-
return btcutil.NewAddressScriptHashFromHash(hash[:], &chaincfg.MainNetParams)
734-
}
735-
736719
// Keystores returns the keystores of the account.
737720
func (account *Account) Keystores() *keystore.Keystores {
738721
return account.keystores

backend/coins/btc/handlers/handlers.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func NewHandlers(
6767
handleFunc("/can-verify-extended-public-key", handlers.ensureAccountInitialized(handlers.getCanVerifyExtendedPublicKey)).Methods("GET")
6868
handleFunc("/verify-extended-public-key", handlers.ensureAccountInitialized(handlers.postVerifyExtendedPublicKey)).Methods("POST")
6969
handleFunc("/has-secure-output", handlers.ensureAccountInitialized(handlers.getHasSecureOutput)).Methods("GET")
70-
handleFunc("/convert-to-legacy-address", handlers.ensureAccountInitialized(handlers.postConvertToLegacyAddress)).Methods("POST")
7170
return handlers
7271
}
7372

@@ -500,15 +499,3 @@ func (handlers *Handlers) getHasSecureOutput(r *http.Request) (interface{}, erro
500499
"optional": optional,
501500
}, nil
502501
}
503-
504-
func (handlers *Handlers) postConvertToLegacyAddress(r *http.Request) (interface{}, error) {
505-
var addressID string
506-
if err := json.NewDecoder(r.Body).Decode(&addressID); err != nil {
507-
return nil, errp.WithStack(err)
508-
}
509-
address, err := handlers.account.ConvertToLegacyAddress(addressID)
510-
if err != nil {
511-
return nil, err
512-
}
513-
return address.EncodeAddress(), nil
514-
}

backend/coins/eth/account.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"time"
2424

2525
"github.com/btcsuite/btcd/wire"
26-
"github.com/btcsuite/btcutil"
2726
"github.com/digitalbitbox/bitbox-wallet-app/backend/accounts"
2827
"github.com/digitalbitbox/bitbox-wallet-app/backend/accounts/errors"
2928
"github.com/digitalbitbox/bitbox-wallet-app/backend/coins/btc/synchronizer"
@@ -683,11 +682,6 @@ func (account *Account) CanVerifyAddresses() (bool, bool, error) {
683682
return account.Keystores().CanVerifyAddresses(account.signingConfiguration, account.Coin())
684683
}
685684

686-
// ConvertToLegacyAddress implements accounts.Interface.
687-
func (account *Account) ConvertToLegacyAddress(string) (btcutil.Address, error) {
688-
panic("not used")
689-
}
690-
691685
// Keystores implements accounts.Interface.
692686
func (account *Account) Keystores() *keystore.Keystores {
693687
return account.keystores

0 commit comments

Comments
 (0)