Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions chia/_tests/clvm/coin_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,8 @@ def update_coin_store_for_spend_bundle(
self._add_coin_entry(new_coin, now)
for spent_coin in removals:
coin_name = spent_coin.name()
self._db[coin_name] = CoinRecord(
self._db[coin_name].coin,
self._db[coin_name].confirmed_block_index,
now.height,
self._db[coin_name].coinbase,
self._db[coin_name].timestamp,
)
coin_record = self._db[coin_name]
self._db[coin_name] = coin_record.replace(spent_block_index=now.height)
return additions, spend_bundle.coin_spends

def coins_for_puzzle_hash(self, puzzle_hash: bytes32) -> Iterator[Coin]:
Expand Down
15 changes: 5 additions & 10 deletions chia/_tests/core/mempool/test_mempool_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,16 +431,17 @@ def test_conditions(
conds: SpendBundleConditions,
expected: Optional[Err],
) -> None:
res: Optional[Union[int, Err]] = check_time_locks(
res: Optional[int] = check_time_locks(
dict(self.REMOVALS),
conds,
self.PREV_BLOCK_HEIGHT,
self.PREV_BLOCK_TIMESTAMP,
)
e: Optional[Err] = None
if res is not None:
# TODO: remove when Rust errors and Python Errors are the same
res = Err(res)
assert res == expected
e = Err(res)
assert e == expected


def expect(
Expand Down Expand Up @@ -2340,13 +2341,7 @@ def __init__(self, coins: list[Coin], lineage: dict[bytes32, Coin]) -> None:
self.lineage_info[ph] = UnspentLineageInfo(c.name(), c.parent_coin_info, bytes32([42] * 32))

def spend_coin(self, coin_id: bytes32, height: uint32 = uint32(10)) -> None:
self.coin_records[coin_id] = CoinRecord(
self.coin_records[coin_id].coin,
self.coin_records[coin_id].confirmed_block_index,
height,
self.coin_records[coin_id].coinbase,
self.coin_records[coin_id].timestamp,
)
self.coin_records[coin_id] = self.coin_records[coin_id].replace(spent_block_index=height)

def update_lineage(self, puzzle_hash: bytes32, coin: Optional[Coin]) -> None:
if coin is None:
Expand Down
9 changes: 5 additions & 4 deletions chia/full_node/mempool_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections.abc import Awaitable, Collection
from concurrent.futures import Executor, ThreadPoolExecutor
from dataclasses import dataclass, field
from typing import Callable, Optional, TypeVar, Union
from typing import Callable, Optional, TypeVar

from chia_rs import (
ELIGIBLE_FOR_DEDUP,
Expand Down Expand Up @@ -734,14 +734,15 @@ async def validate_spend_bundle(
# point-of-view of the next block to be farmed. Therefore we pass in the
# current peak's height and timestamp
assert self.peak.timestamp is not None
tl_error: Optional[Union[int, Err]] = check_time_locks(
tl_error_rust: Optional[int] = check_time_locks(
removal_record_dict,
conds,
self.peak.height,
self.peak.timestamp,
)
if tl_error is not None:
tl_error = Err(tl_error)
tl_error: Optional[Err] = None
if tl_error_rust is not None:
tl_error = Err(tl_error_rust)

timelocks: TimelockConditions = compute_assert_height(removal_record_dict, conds)

Expand Down
Loading