Fixes for btcutil and btcscript api changes
This commit is contained in:
parent
697532bd68
commit
21a2158eca
1 changed files with 6 additions and 4 deletions
10
rpcserver.go
10
rpcserver.go
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/conformal/btcchain"
|
||||
"github.com/conformal/btcjson"
|
||||
"github.com/conformal/btcscript"
|
||||
"github.com/conformal/btcutil"
|
||||
"github.com/conformal/btcwire"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"math/big"
|
||||
|
@ -370,7 +371,7 @@ func jsonRPCRead(w http.ResponseWriter, r *http.Request, s *rpcServer) {
|
|||
} else {
|
||||
txSha, _ := btcwire.NewShaHashFromStr(tx)
|
||||
var txS *btcwire.MsgTx
|
||||
txList, err := s.server.db.FetchTxBySha(txSha)
|
||||
txList, err := s.server.db.FetchTxBySha(txSha)
|
||||
if err != nil {
|
||||
log.Errorf("[RPCS] Error fetching tx: %v", err)
|
||||
jsonError := btcjson.Error{
|
||||
|
@ -428,10 +429,11 @@ func jsonRPCRead(w http.ResponseWriter, r *http.Request, s *rpcServer) {
|
|||
isbuf, _ := btcscript.DisasmString(v.PkScript)
|
||||
voutList[i].ScriptPubKey.Asm = isbuf
|
||||
voutList[i].ScriptPubKey.ReqSig = strings.Count(isbuf, "OP_CHECKSIG")
|
||||
_, addr, err := btcscript.ScriptToAddress(v.PkScript)
|
||||
_, addrhash, err := btcscript.ScriptToAddrHash(v.PkScript)
|
||||
if err != nil {
|
||||
log.Errorf("[RPCS] Error getting address for %v: %v", txSha, err)
|
||||
} else {
|
||||
log.Errorf("[RPCS] Error getting address hash for %v: %v", txSha, err)
|
||||
}
|
||||
if addr, err := btcutil.EncodeAddress(addrhash, s.server.btcnet); err != nil {
|
||||
addrList := make([]string, 1)
|
||||
addrList[0] = addr
|
||||
voutList[i].ScriptPubKey.Addresses = addrList
|
||||
|
|
Loading…
Reference in a new issue