fix uncaught error returning transactions that dont yet exist

This commit is contained in:
Jack Robison 2022-05-27 11:58:09 -04:00
parent 78bd2da267
commit 76dd9c392b
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 4 additions and 10 deletions

View file

@ -347,14 +347,9 @@ INVALID_ARGS = -32602
class CodeMessageError(Exception): class CodeMessageError(Exception):
def __init__(self, code: int, message: str):
@property self.code = code
def code(self): self.message = message
return self.args[0]
@property
def message(self):
return self.args[1]
def __eq__(self, other): def __eq__(self, other):
return (isinstance(other, self.__class__) and return (isinstance(other, self.__class__) and
@ -382,7 +377,6 @@ class RPCError(CodeMessageError):
pass pass
class DaemonError(Exception): class DaemonError(Exception):
"""Raised when the daemon returns an error in its results.""" """Raised when the daemon returns an error in its results."""

View file

@ -1750,7 +1750,7 @@ class LBRYElectrumX(asyncio.Protocol):
if not verbose: if not verbose:
return raw_tx.hex() return raw_tx.hex()
return self.coin.transaction(raw_tx).as_dict(self.coin) return self.coin.transaction(raw_tx).as_dict(self.coin)
return RPCError("No such mempool or blockchain transaction.") return RPCError(BAD_REQUEST, "No such mempool or blockchain transaction.")
def _get_merkle_branch(self, tx_hashes, tx_pos): def _get_merkle_branch(self, tx_hashes, tx_pos):
"""Return a merkle branch to a transaction. """Return a merkle branch to a transaction.