From 6c6f929743f39658dd3760056967f37c1bd96a9f Mon Sep 17 00:00:00 2001 From: Jakub Matys Date: Tue, 22 May 2018 12:29:16 +0200 Subject: [PATCH] Fixed import of blocks with invalid transactions (genesis block) --- bchain/coins/zec/zcashrpc.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bchain/coins/zec/zcashrpc.go b/bchain/coins/zec/zcashrpc.go index 31d943f5..a5575a70 100644 --- a/bchain/coins/zec/zcashrpc.go +++ b/bchain/coins/zec/zcashrpc.go @@ -105,8 +105,8 @@ func (z *ZCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) { return nil, errors.Annotatef(res.Error, "hash %v", hash) } - txs := make([]bchain.Tx, len(res.Result.Txids)) - for i, txid := range res.Result.Txids { + txs := make([]bchain.Tx, 0, len(res.Result.Txids)) + for _, txid := range res.Result.Txids { tx, err := z.GetTransaction(txid) if err != nil { if isInvalidTx(err) { @@ -115,7 +115,7 @@ func (z *ZCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) { } return nil, err } - txs[i] = *tx + txs = append(txs, *tx) } block := &bchain.Block{ BlockHeader: res.Result.BlockHeader,