Skip to content

Commit

Permalink
catch excp
Browse files Browse the repository at this point in the history
  • Loading branch information
mariano54 committed Nov 1, 2021
1 parent 95f1c5c commit e5ee15a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 11 additions & 7 deletions chia/full_node/full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from chia.consensus.multiprocess_validation import PreValidationResult
from chia.consensus.pot_iterations import calculate_sp_iters
from chia.full_node.block_store import BlockStore
from chia.full_node.lock_queue import LockQueue, LockClient
from chia.full_node.lock_queue import LockQueue, LockClient, TooManyLockClients
from chia.full_node.bundle_tools import detect_potential_template_generator
from chia.full_node.coin_store import CoinStore
from chia.full_node.full_node_store import FullNodeStore, FullNodeStorePeakResult
Expand Down Expand Up @@ -181,7 +181,7 @@ def sql_trace_callback(req: str):
else:
self.log.info(
f"Blockchain initialized to peak {self.blockchain.get_peak().header_hash} height"
f" {self.blockchain.get_peak().height}, "
f" {self.blockchain.get_peak().height}, c"
f"time taken: {int(time_taken)}s"
)
async with self._blockchain_lock_high_priority:
Expand Down Expand Up @@ -1817,11 +1817,15 @@ async def respond_transaction(
except Exception as e:
self.mempool_manager.remove_seen(spend_name)
raise e
async with self._blockchain_lock_low_priority:
if self.mempool_manager.get_spendbundle(spend_name) is not None:
self.mempool_manager.remove_seen(spend_name)
return MempoolInclusionStatus.FAILED, Err.ALREADY_INCLUDING_TRANSACTION
cost, status, error = await self.mempool_manager.add_spendbundle(transaction, cost_result, spend_name)
try:
async with self._blockchain_lock_low_priority:
if self.mempool_manager.get_spendbundle(spend_name) is not None:
self.mempool_manager.remove_seen(spend_name)
return MempoolInclusionStatus.FAILED, Err.ALREADY_INCLUDING_TRANSACTION
cost, status, error = await self.mempool_manager.add_spendbundle(transaction, cost_result, spend_name)
except TooManyLockClients:
return MempoolInclusionStatus.FAILED, Err.NODE_OVERLOADED

if status == MempoolInclusionStatus.SUCCESS:
self.log.debug(
f"Added transaction to mempool: {spend_name} mempool size: "
Expand Down
1 change: 1 addition & 0 deletions chia/util/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class Err(Enum):
COIN_AMOUNT_NEGATIVE = 124
INTERNAL_PROTOCOL_ERROR = 125
INVALID_SPEND_BUNDLE = 126
NODE_OVERLOADED = 127


class ValidationError(Exception):
Expand Down

0 comments on commit e5ee15a

Please sign in to comment.