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/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"
|
||||||
|
@ -370,7 +371,7 @@ func jsonRPCRead(w http.ResponseWriter, r *http.Request, s *rpcServer) {
|
||||||
} else {
|
} else {
|
||||||
txSha, _ := btcwire.NewShaHashFromStr(tx)
|
txSha, _ := btcwire.NewShaHashFromStr(tx)
|
||||||
var txS *btcwire.MsgTx
|
var txS *btcwire.MsgTx
|
||||||
txList, err := s.server.db.FetchTxBySha(txSha)
|
txList, err := s.server.db.FetchTxBySha(txSha)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("[RPCS] Error fetching tx: %v", err)
|
log.Errorf("[RPCS] Error fetching tx: %v", err)
|
||||||
jsonError := btcjson.Error{
|
jsonError := btcjson.Error{
|
||||||
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue