Fix hanling of missing tx in Zcash block 0
parent
ac0c359fbe
commit
05daf85c10
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue