From 05daf85c10acf2c83dc599e7c2b6175aa8764cb0 Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Mon, 14 Jan 2019 14:49:21 +0100 Subject: [PATCH] Fix hanling of missing tx in Zcash block 0 --- bchain/coins/zec/zcashrpc.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/bchain/coins/zec/zcashrpc.go b/bchain/coins/zec/zcashrpc.go index 6c9b023b..fa956f1e 100644 --- a/bchain/coins/zec/zcashrpc.go +++ b/bchain/coins/zec/zcashrpc.go @@ -80,7 +80,7 @@ func (z *ZCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) { for _, txid := range res.Result.Txids { tx, err := z.GetTransaction(txid) if err != nil { - if isInvalidTx(err) { + if err == bchain.ErrTxNotFound { glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err) continue } @@ -95,20 +95,6 @@ func (z *ZCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) { return block, nil } -func isInvalidTx(err error) bool { - switch e1 := err.(type) { - case *errors.Err: - switch e2 := e1.Cause().(type) { - case *bchain.RPCError: - if e2.Code == -5 { // "No information available about transaction" - return true - } - } - } - - return false -} - // GetTransactionForMempool returns a transaction by the transaction ID. // It could be optimized for mempool, i.e. without block time and confirmations func (z *ZCashRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) {