Fixes for btcutil and btcscript api changes

This commit is contained in:
Josh Rickmar 2013-10-08 12:37:06 -04:00
parent 697532bd68
commit 21a2158eca

View file

@ -11,6 +11,7 @@ import (
"github.com/conformal/btcchain" "github.com/conformal/btcchain"
"github.com/conformal/btcjson" "github.com/conformal/btcjson"
"github.com/conformal/btcscript" "github.com/conformal/btcscript"
"github.com/conformal/btcutil"
"github.com/conformal/btcwire" "github.com/conformal/btcwire"
"github.com/davecgh/go-spew/spew" "github.com/davecgh/go-spew/spew"
"math/big" "math/big"
@ -428,10 +429,11 @@ func jsonRPCRead(w http.ResponseWriter, r *http.Request, s *rpcServer) {
isbuf, _ := btcscript.DisasmString(v.PkScript) isbuf, _ := btcscript.DisasmString(v.PkScript)
voutList[i].ScriptPubKey.Asm = isbuf voutList[i].ScriptPubKey.Asm = isbuf
voutList[i].ScriptPubKey.ReqSig = strings.Count(isbuf, "OP_CHECKSIG") voutList[i].ScriptPubKey.ReqSig = strings.Count(isbuf, "OP_CHECKSIG")
_, addr, err := btcscript.ScriptToAddress(v.PkScript) _, addrhash, err := btcscript.ScriptToAddrHash(v.PkScript)
if err != nil { if err != nil {
log.Errorf("[RPCS] Error getting address for %v: %v", txSha, err) log.Errorf("[RPCS] Error getting address hash for %v: %v", txSha, err)
} else { }
if addr, err := btcutil.EncodeAddress(addrhash, s.server.btcnet); err != nil {
addrList := make([]string, 1) addrList := make([]string, 1)
addrList[0] = addr addrList[0] = addr
voutList[i].ScriptPubKey.Addresses = addrList voutList[i].ScriptPubKey.Addresses = addrList