Fixed different behaviour between transaction parsing from wire or JSON
JSON version sometimes returned nil Address field in ScriptPubKey (if it was omitted in input JSON) but wire version always returned allocated empty slice.
This commit is contained in:
parent
757b3e39d6
commit
ae8058f269
@ -113,9 +113,11 @@ func (p *BitcoinParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bchain.T
|
||||
}
|
||||
vout := make([]bchain.Vout, len(t.TxOut))
|
||||
for i, out := range t.TxOut {
|
||||
addrs := []string{}
|
||||
var addrs []string
|
||||
if parseAddresses {
|
||||
addrs, _ = p.OutputScriptToAddresses(out.PkScript)
|
||||
if tmp, _ := p.OutputScriptToAddresses(out.PkScript); len(tmp) > 0 {
|
||||
addrs = tmp
|
||||
}
|
||||
}
|
||||
s := bchain.ScriptPubKey{
|
||||
Hex: hex.EncodeToString(out.PkScript),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user