Merge pull request #111 from bitspill/valueSatJson

Convert JsonValue to ValueSat when `"parse": false`
pull/112/head
Martin 2019-01-29 10:14:20 +01:00 committed by GitHub
commit 8efaa4ebc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -613,6 +613,20 @@ func (b *BitcoinRPC) GetBlockFull(hash string) (*bchain.Block, error) {
}
return nil, errors.Annotatef(res.Error, "hash %v", hash)
}
for i := range res.Result.Txs {
tx := &res.Result.Txs[i]
for j := range tx.Vout {
vout := &tx.Vout[j]
// convert vout.JsonValue to big.Int and clear it, it is only temporary value used for unmarshal
vout.ValueSat, err = b.Parser.AmountToBigInt(vout.JsonValue)
if err != nil {
return nil, err
}
vout.JsonValue = ""
}
}
return &res.Result, nil
}