Skip to content

Commit eb855a6

Browse files
committed
initial commit
1 parent 6250271 commit eb855a6

File tree

6 files changed

+18
-98
lines changed

6 files changed

+18
-98
lines changed

chia/_tests/clvm/coin_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from chia_rs.sized_ints import uint32, uint64
1111

1212
from chia._tests.util.get_name_puzzle_conditions import get_name_puzzle_conditions
13-
from chia.consensus.check_time_locks import check_time_locks
13+
from chia_rs import check_time_locks
1414
from chia.consensus.cost_calculator import NPCResult
1515
from chia.full_node.bundle_tools import simple_solution_generator
1616
from chia.types.blockchain_format.coin import Coin

chia/_tests/core/mempool/test_mempool_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from chia._tests.conftest import ConsensusMode
2828
from chia._tests.util.misc import Marks, datacases, invariant_check_mempool
2929
from chia._tests.util.setup_nodes import OldSimulatorsAndWallets, setup_simulators_and_wallets
30-
from chia.consensus.check_time_locks import check_time_locks
30+
from chia_rs import check_time_locks
3131
from chia.consensus.condition_costs import ConditionCost
3232
from chia.consensus.default_constants import DEFAULT_CONSTANTS
3333
from chia.full_node.eligible_coin_spends import (

chia/consensus/block_body_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
2323
from chia.consensus.blockchain_interface import BlockRecordsProtocol
24-
from chia.consensus.check_time_locks import check_time_locks
24+
from chia_rs import check_time_locks
2525
from chia.consensus.coinbase import create_farmer_coin, create_pool_coin
2626
from chia.types.blockchain_format.coin import Coin, hash_coin_ids
2727
from chia.types.coin_record import CoinRecord

chia/consensus/check_time_locks.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

chia/full_node/mempool_manager.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from chiabip158 import PyBIP158
2626

2727
from chia.consensus.block_record import BlockRecordProtocol
28-
from chia.consensus.check_time_locks import check_time_locks
28+
from chia_rs import check_time_locks
2929
from chia.consensus.cost_calculator import NPCResult
3030
from chia.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator
3131
from chia.full_node.fee_estimation import FeeBlockInfo, MempoolInfo, MempoolItemInfo
@@ -719,12 +719,18 @@ async def validate_spend_bundle(
719719
# point-of-view of the next block to be farmed. Therefore we pass in the
720720
# current peak's height and timestamp
721721
assert self.peak.timestamp is not None
722-
tl_error: Optional[Err] = check_time_locks(
723-
removal_record_dict,
724-
conds,
725-
self.peak.height,
726-
self.peak.timestamp,
727-
)
722+
try:
723+
tl_error: Optional[Err] = check_time_locks(
724+
removal_record_dict,
725+
conds,
726+
self.peak.height,
727+
self.peak.timestamp,
728+
)
729+
except Exception as e:
730+
breakpoint()
731+
732+
if tl_error is not None:
733+
breakpoint()
728734

729735
timelocks: TimelockConditions = compute_assert_height(removal_record_dict, conds)
730736

chia/types/coin_record.py

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,6 @@
1010
from chia.types.blockchain_format.coin import Coin
1111
from chia.util.streamable import Streamable, streamable
1212

13+
from chia_rs import CoinRecord as RustCoinRecord
1314

14-
@streamable
15-
@dataclass(frozen=True)
16-
class CoinRecord(Streamable):
17-
"""
18-
These are values that correspond to a CoinName that are used
19-
in keeping track of the unspent database.
20-
"""
21-
22-
coin: Coin
23-
confirmed_block_index: uint32
24-
spent_block_index: uint32
25-
coinbase: bool
26-
timestamp: uint64 # Timestamp of the block at height confirmed_block_index
27-
28-
@property
29-
def spent(self) -> bool:
30-
return self.spent_block_index > 0
31-
32-
@property
33-
def name(self) -> bytes32:
34-
return self.coin.name()
35-
36-
@property
37-
def coin_state(self) -> CoinState:
38-
spent_h = None
39-
if self.spent:
40-
spent_h = self.spent_block_index
41-
confirmed_height: Optional[uint32] = self.confirmed_block_index
42-
if self.confirmed_block_index == 0 and self.timestamp == 0:
43-
confirmed_height = None
44-
return CoinState(self.coin, spent_h, confirmed_height)
15+
CoinRecord = RustCoinRecord

0 commit comments

Comments
 (0)