|
11 | 11 | ELIGIBLE_FOR_DEDUP, |
12 | 12 | ELIGIBLE_FOR_FF, |
13 | 13 | AugSchemeMPL, |
| 14 | + CoinRecord, |
14 | 15 | CoinSpend, |
15 | 16 | ConsensusConstants, |
16 | 17 | G2Element, |
17 | 18 | SpendBundle, |
18 | 19 | SpendBundleConditions, |
19 | 20 | SpendConditions, |
| 21 | + check_time_locks, |
20 | 22 | get_conditions_from_spendbundle, |
21 | 23 | run_block_generator2, |
22 | 24 | ) |
|
27 | 29 | from chia._tests.conftest import ConsensusMode |
28 | 30 | from chia._tests.util.misc import Marks, datacases, invariant_check_mempool |
29 | 31 | from chia._tests.util.setup_nodes import OldSimulatorsAndWallets, setup_simulators_and_wallets |
30 | | -from chia.consensus.check_time_locks import check_time_locks |
31 | 32 | from chia.consensus.condition_costs import ConditionCost |
32 | 33 | from chia.consensus.default_constants import DEFAULT_CONSTANTS |
33 | 34 | from chia.full_node.eligible_coin_spends import ( |
|
60 | 61 | from chia.types.blockchain_format.program import DEFAULT_FLAGS, INFINITE_COST, Program |
61 | 62 | from chia.types.blockchain_format.serialized_program import SerializedProgram |
62 | 63 | from chia.types.clvm_cost import CLVMCost |
63 | | -from chia.types.coin_record import CoinRecord |
64 | 64 | from chia.types.coin_spend import make_spend |
65 | 65 | from chia.types.condition_opcodes import ConditionOpcode |
66 | 66 | from chia.types.condition_with_args import ConditionWithArgs |
@@ -436,15 +436,17 @@ def test_conditions( |
436 | 436 | conds: SpendBundleConditions, |
437 | 437 | expected: Err | None, |
438 | 438 | ) -> None: |
439 | | - assert ( |
440 | | - check_time_locks( |
441 | | - dict(self.REMOVALS), |
442 | | - conds, |
443 | | - self.PREV_BLOCK_HEIGHT, |
444 | | - self.PREV_BLOCK_TIMESTAMP, |
445 | | - ) |
446 | | - == expected |
| 439 | + res: int | None = check_time_locks( |
| 440 | + dict(self.REMOVALS), |
| 441 | + conds, |
| 442 | + self.PREV_BLOCK_HEIGHT, |
| 443 | + self.PREV_BLOCK_TIMESTAMP, |
447 | 444 | ) |
| 445 | + e: Err | None = None |
| 446 | + if res is not None: |
| 447 | + # TODO: remove when Rust errors and Python Errors are the same |
| 448 | + e = Err(res) |
| 449 | + assert e == expected |
448 | 450 |
|
449 | 451 |
|
450 | 452 | def expect( |
@@ -2348,7 +2350,7 @@ def __init__(self, coins: list[Coin], lineage: dict[bytes32, Coin]) -> None: |
2348 | 2350 | self.lineage_info[ph] = UnspentLineageInfo(c.name(), c.parent_coin_info, bytes32([42] * 32)) |
2349 | 2351 |
|
2350 | 2352 | def spend_coin(self, coin_id: bytes32, height: uint32 = uint32(10)) -> None: |
2351 | | - self.coin_records[coin_id] = dataclasses.replace(self.coin_records[coin_id], spent_block_index=height) |
| 2353 | + self.coin_records[coin_id] = self.coin_records[coin_id].replace(spent_block_index=height) |
2352 | 2354 |
|
2353 | 2355 | def update_lineage(self, puzzle_hash: bytes32, coin: Coin | None) -> None: |
2354 | 2356 | if coin is None: |
|
0 commit comments