From 6dea3789cb6444f30cc60794ebce301fa85612ad Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Wed, 19 Mar 2014 01:47:12 +0000 Subject: [PATCH] update for btcutil.DecodeAddress api change. --- createtx.go | 2 +- rpcserver.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/createtx.go b/createtx.go index 2b6784f..9cfb85a 100644 --- a/createtx.go +++ b/createtx.go @@ -155,7 +155,7 @@ func (a *Account) txToPairs(pairs map[string]int64, minconf int) (*CreatedTx, er // Add outputs to new tx. for addrStr, amt := range pairs { - addr, err := btcutil.DecodeAddr(addrStr) + addr, err := btcutil.DecodeAddress(addrStr, cfg.Net()) if err != nil { return nil, fmt.Errorf("cannot decode address: %s", err) } diff --git a/rpcserver.go b/rpcserver.go index c0f00b7..1d721e1 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -264,7 +264,7 @@ func DumpPrivKey(icmd btcjson.Cmd) (interface{}, *btcjson.Error) { return nil, &btcjson.ErrInternal } - addr, err := btcutil.DecodeAddr(cmd.Address) + addr, err := btcutil.DecodeAddress(cmd.Address, cfg.Net()) if err != nil { return nil, &btcjson.ErrInvalidAddressOrKey } @@ -470,7 +470,7 @@ func GetAccount(icmd btcjson.Cmd) (interface{}, *btcjson.Error) { } // Is address valid? - addr, err := btcutil.DecodeAddr(cmd.Address) + addr, err := btcutil.DecodeAddress(cmd.Address, cfg.Net()) if err != nil { return nil, &btcjson.ErrInvalidAddressOrKey } @@ -548,7 +548,7 @@ func GetAddressBalance(icmd btcjson.Cmd) (interface{}, *btcjson.Error) { } // Is address valid? - addr, err := btcutil.DecodeAddr(cmd.Address) + addr, err := btcutil.DecodeAddress(cmd.Address, cfg.Net()) if err != nil { return nil, &btcjson.ErrInvalidAddressOrKey } @@ -1051,7 +1051,7 @@ func ListAddressTransactions(icmd btcjson.Cmd) (interface{}, *btcjson.Error) { // Decode addresses. pkHashMap := make(map[string]struct{}) for _, addrStr := range cmd.Addresses { - addr, err := btcutil.DecodeAddr(addrStr) + addr, err := btcutil.DecodeAddress(addrStr, cfg.Net()) if err != nil { return nil, &btcjson.ErrInvalidAddressOrKey } @@ -1131,7 +1131,7 @@ func ListUnspent(icmd btcjson.Cmd) (interface{}, *btcjson.Error) { if len(cmd.Addresses) != 0 { // confirm that all of them are good: for _, as := range cmd.Addresses { - a, err := btcutil.DecodeAddr(as) + a, err := btcutil.DecodeAddress(as, cfg.Net()) if err != nil { return nil, &btcjson.ErrInvalidAddressOrKey } @@ -1468,7 +1468,7 @@ func SignMessage(icmd btcjson.Cmd) (interface{}, *btcjson.Error) { } // This really should work when the above found something valid. - addr, err := btcutil.DecodeAddr(cmd.Address) + addr, err := btcutil.DecodeAddress(cmd.Address, cfg.Net()) if err != nil { return nil, &btcjson.Error{ Code: btcjson.ErrWallet.Code, @@ -1577,7 +1577,7 @@ func ValidateAddress(icmd btcjson.Cmd) (interface{}, *btcjson.Error) { return nil, &btcjson.ErrInternal } - addr, err := btcutil.DecodeAddr(cmd.Address) + addr, err := btcutil.DecodeAddress(cmd.Address, cfg.Net()) if err != nil { return map[string]interface{}{ "isvalid": false, @@ -1655,7 +1655,7 @@ func VerifyMessage(icmd btcjson.Cmd) (interface{}, *btcjson.Error) { } // This really should work when the above found something valid. - addr, err := btcutil.DecodeAddr(cmd.Address) + addr, err := btcutil.DecodeAddress(cmd.Address, cfg.Net()) if err != nil { return nil, &btcjson.Error{ Code: btcjson.ErrWallet.Code,