[RPC] Fix bug, check error when gettx
@@ -49,6 +49,9 @@ func (cs *ChainService) getHashByNo(blockNo types.BlockNo) ([]byte, error) {
func (cs *ChainService) getTx(txHash []byte) (*types.Tx, *types.TxIdx, error) {
tx, txidx, err := cs.cdb.getTx(txHash)
+ if err != nil {
+ return nil, nil, err
+ }
block, err := cs.cdb.getBlock(txidx.BlockHash)
blockInMainChain, err := cs.cdb.getBlockByNo(block.Header.BlockNo)
if !bytes.Equal(block.BlockHash(), blockInMainChain.BlockHash()) {
