Skip to content

Commit 527cdc3

Browse files
committed
cast to Err in a couple other places
1 parent 74aa717 commit 527cdc3

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

chia/_tests/core/mempool/test_mempool_manager.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,16 @@ def test_conditions(
431431
conds: SpendBundleConditions,
432432
expected: Optional[Err],
433433
) -> None:
434-
assert (
435-
check_time_locks(
436-
dict(self.REMOVALS),
437-
conds,
438-
self.PREV_BLOCK_HEIGHT,
439-
self.PREV_BLOCK_TIMESTAMP,
440-
)
441-
== expected
434+
res = check_time_locks(
435+
dict(self.REMOVALS),
436+
conds,
437+
self.PREV_BLOCK_HEIGHT,
438+
self.PREV_BLOCK_TIMESTAMP,
442439
)
440+
if res is not None:
441+
# TODO: remove when Rust errors and Python Errors are the same
442+
res = Err(res)
443+
assert res == expected
443444

444445

445446
def expect(

chia/full_node/mempool_manager.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -715,18 +715,14 @@ async def validate_spend_bundle(
715715
# point-of-view of the next block to be farmed. Therefore we pass in the
716716
# current peak's height and timestamp
717717
assert self.peak.timestamp is not None
718-
try:
719-
tl_error: Optional[Err] = check_time_locks(
720-
removal_record_dict,
721-
conds,
722-
self.peak.height,
723-
self.peak.timestamp,
724-
)
725-
except Exception as e:
726-
breakpoint()
727-
718+
tl_error: Optional[Err] = check_time_locks(
719+
removal_record_dict,
720+
conds,
721+
self.peak.height,
722+
self.peak.timestamp,
723+
)
728724
if tl_error is not None:
729-
breakpoint()
725+
tl_error = Err(tl_error)
730726

731727
timelocks: TimelockConditions = compute_assert_height(removal_record_dict, conds)
732728

0 commit comments

Comments
 (0)