From 9cc6600db2d390e8711a22e70923bee97a5ecb94 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 8 Oct 2013 13:36:39 -0400 Subject: [PATCH] Fixes for api changes --- createtx.go | 14 +------------- wallet/wallet.go | 13 +------------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/createtx.go b/createtx.go index 2a838bb..8638e0a 100644 --- a/createtx.go +++ b/createtx.go @@ -164,24 +164,12 @@ func (w *BtcWallet) txToPairs(pairs map[string]uint64, fee uint64, minconf int) msgtx.AddTxOut(txout) } - var netID byte - switch w.Wallet.Net() { - case btcwire.MainNet: - netID = btcutil.MainNetAddr - case btcwire.TestNet: - fallthrough - case btcwire.TestNet3: - netID = btcutil.TestNetAddr - default: // wrong! - return nil, ErrUnknownBitcoinNet - } - // Selected unspent outputs become new transaction's inputs. for _, op := range outputs { msgtx.AddTxIn(btcwire.NewTxIn((*btcwire.OutPoint)(&op.Out), nil)) } for i, op := range outputs { - addrstr, err := btcutil.EncodeAddress(op.Addr[:], netID) + addrstr, err := btcutil.EncodeAddress(op.Addr[:], w.Wallet.Net()) if err != nil { return nil, err } diff --git a/wallet/wallet.go b/wallet/wallet.go index d6b0501..f9f45dc 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -1036,18 +1036,7 @@ func (a *btcAddress) changeEncryptionKey(oldkey, newkey []byte) error { // paymentAddress returns a human readable payment address string for // an address. func (a *btcAddress) paymentAddress(net btcwire.BitcoinNet) (string, error) { - var netID byte - switch net { - case btcwire.MainNet: - netID = btcutil.MainNetAddr - case btcwire.TestNet: - fallthrough - case btcwire.TestNet3: - netID = btcutil.TestNetAddr - default: // wrong! - return "", errors.New("unknown bitcoin network") - } - return btcutil.EncodeAddress(a.pubKeyHash[:], netID) + return btcutil.EncodeAddress(a.pubKeyHash[:], net) } func walletHash(b []byte) uint32 {