From 87624f44ca36c234e20bc49962ae3ce9e3c4e34e Mon Sep 17 00:00:00 2001 From: Jeremiah Buddenhagen Date: Mon, 28 Jan 2019 16:39:54 -0800 Subject: [PATCH] Convert JsonValue to ValueSat when `"parse": false` --- bchain/coins/btc/bitcoinrpc.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bchain/coins/btc/bitcoinrpc.go b/bchain/coins/btc/bitcoinrpc.go index a2fc0f11..a0c5dced 100644 --- a/bchain/coins/btc/bitcoinrpc.go +++ b/bchain/coins/btc/bitcoinrpc.go @@ -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 }