Fix hanling of missing tx in Zcash block 0

This commit is contained in:
Martin Boehm 2019-01-14 14:49:21 +01:00
parent ac0c359fbe
commit 05daf85c10

View File

@ -80,7 +80,7 @@ func (z *ZCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) {
for _, txid := range res.Result.Txids { for _, txid := range res.Result.Txids {
tx, err := z.GetTransaction(txid) tx, err := z.GetTransaction(txid)
if err != nil { if err != nil {
if isInvalidTx(err) { if err == bchain.ErrTxNotFound {
glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err) glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err)
continue continue
} }
@ -95,20 +95,6 @@ func (z *ZCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) {
return block, nil 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. // GetTransactionForMempool returns a transaction by the transaction ID.
// It could be optimized for mempool, i.e. without block time and confirmations // It could be optimized for mempool, i.e. without block time and confirmations
func (z *ZCashRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) { func (z *ZCashRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) {