Skip to content

Commit f6c9618

Browse files
authored
minor simplifications (#20059)
various simplifications. Still not fixing CI
2 parents 10c5cb3 + f79a21e commit f6c9618

File tree

4 files changed

+31
-19
lines changed

4 files changed

+31
-19
lines changed

chia/_tests/clvm/coin_store.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,8 @@ def update_coin_store_for_spend_bundle(
111111
self._add_coin_entry(new_coin, now)
112112
for spent_coin in removals:
113113
coin_name = spent_coin.name()
114-
self._db[coin_name] = CoinRecord(
115-
self._db[coin_name].coin,
116-
self._db[coin_name].confirmed_block_index,
117-
now.height,
118-
self._db[coin_name].coinbase,
119-
self._db[coin_name].timestamp,
120-
)
114+
coin_record = self._db[coin_name]
115+
self._db[coin_name] = coin_record.replace(spent_block_index=now.height)
121116
return additions, spend_bundle.coin_spends
122117

123118
def coins_for_puzzle_hash(self, puzzle_hash: bytes32) -> Iterator[Coin]:

chia/_tests/core/mempool/test_mempool_manager.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,11 @@ def test_conditions(
440440
self.PREV_BLOCK_HEIGHT,
441441
self.PREV_BLOCK_TIMESTAMP,
442442
)
443+
e: Err | None = None
443444
if res is not None:
444445
# TODO: remove when Rust errors and Python Errors are the same
445-
res = Err(res)
446-
assert res == expected
446+
e = Err(res)
447+
assert e == expected
447448

448449

449450
def expect(
@@ -2347,13 +2348,7 @@ def __init__(self, coins: list[Coin], lineage: dict[bytes32, Coin]) -> None:
23472348
self.lineage_info[ph] = UnspentLineageInfo(c.name(), c.parent_coin_info, bytes32([42] * 32))
23482349

23492350
def spend_coin(self, coin_id: bytes32, height: uint32 = uint32(10)) -> None:
2350-
self.coin_records[coin_id] = CoinRecord(
2351-
self.coin_records[coin_id].coin,
2352-
self.coin_records[coin_id].confirmed_block_index,
2353-
height,
2354-
self.coin_records[coin_id].coinbase,
2355-
self.coin_records[coin_id].timestamp,
2356-
)
2351+
self.coin_records[coin_id] = self.coin_records[coin_id].replace(spent_block_index=height)
23572352

23582353
def update_lineage(self, puzzle_hash: bytes32, coin: Coin | None) -> None:
23592354
if coin is None:

chia/full_node/mempool_manager.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,14 +725,15 @@ async def validate_spend_bundle(
725725
# point-of-view of the next block to be farmed. Therefore we pass in the
726726
# current peak's height and timestamp
727727
assert self.peak.timestamp is not None
728-
tl_error: Err | int | None = check_time_locks(
728+
tl_error_rust: int | None = check_time_locks(
729729
removal_record_dict,
730730
conds,
731731
self.peak.height,
732732
self.peak.timestamp,
733733
)
734-
if tl_error is not None:
735-
tl_error = Err(tl_error)
734+
tl_error: Err | None = None
735+
if tl_error_rust is not None:
736+
tl_error = Err(tl_error_rust)
736737

737738
timelocks: TimelockConditions = compute_assert_height(removal_record_dict, conds)
738739

poetry.lock

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3964,27 +3964,48 @@ markers = "python_version >= \"3.12\""
39643964
files = [
39653965
{file = "zstd-1.5.5.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b5cd20afab8d13c52d2b2219bf18cc765eae87b8219343bce20647007890adab"},
39663966
{file = "zstd-1.5.5.1-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:0f467ab9b57ab8b4b874e6974d38b802f20406803bb7ec9308df923553cd48f7"},
3967+
{file = "zstd-1.5.5.1-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:1866fd2eb37bc80cd0a1bab8f099df5e778a773e829378c633f9fa1325a5dae1"},
3968+
{file = "zstd-1.5.5.1-cp310-cp310-macosx_13_0_x86_64.whl", hash = "sha256:b90ab3e3a2cc196c55151b8d0c506bc7488cb7d7c6479a9f535a047703c29427"},
3969+
{file = "zstd-1.5.5.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bdf76b7c92d50e0ba3e76db6684ca58a419877436de948e39a8b72df1e3a0ff2"},
39673970
{file = "zstd-1.5.5.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ca7df4319ef56b50b441ee6f6427e94672db811ad890bbb487d42bb0a6eebeb"},
3971+
{file = "zstd-1.5.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9a4d2d6302834a22550a5885f9ae27d1baa1896afb0d40d70e0e9090c026fa5b"},
39683972
{file = "zstd-1.5.5.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:06d91d45b912417e83793a78a3f6668be631a1744a7841ecde4dbfeee309f5ca"},
39693973
{file = "zstd-1.5.5.1-cp310-cp310-win_amd64.whl", hash = "sha256:408d3f56bbf0f091a2bab33a3dee62ac9bafe94bb96940b5e4611e43dcf0ee68"},
39703974
{file = "zstd-1.5.5.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:23f6fb9a631f7e7934cccdfbb69e06a47e1a5e64d69b09a7a2a5cf6e1db5014d"},
39713975
{file = "zstd-1.5.5.1-cp311-cp311-macosx_11_0_x86_64.whl", hash = "sha256:02ecf7d9c41ae9a5685a7fdbf2aebbfb185125c07622819512fed41459233d51"},
3976+
{file = "zstd-1.5.5.1-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:abfdcc4df4388dbbde1f1999e0d3cdb794cab371ca03521500192aa6689da403"},
3977+
{file = "zstd-1.5.5.1-cp311-cp311-macosx_13_0_x86_64.whl", hash = "sha256:38e9f1505bd181111defca1c00bc772674ad12a581413cea33dc954002dfefd1"},
3978+
{file = "zstd-1.5.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a1f0734b74587f4a14d3b1ac194cb260a7e919d665118eeed3155bade21f9c8e"},
39723979
{file = "zstd-1.5.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3d13647ff05da2f8a9c1067b6e4182102fc4b6547c49ecdd3031e7ae2cadc1a"},
3980+
{file = "zstd-1.5.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2892f9e76a9ba9e0fcd32977d5b1fc8394568465dd54eac5bef24f84804bc208"},
39733981
{file = "zstd-1.5.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b0f0c81d4241226eab831a500120ddaf9a35dd59593eeb48ed7879e2c722c24c"},
39743982
{file = "zstd-1.5.5.1-cp311-cp311-win_amd64.whl", hash = "sha256:62d2ab79a32bb2d09c74e550636cf4639c1ff3760625f03dccd30e2606b24e66"},
39753983
{file = "zstd-1.5.5.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ec16bc70e3db77a88129c001fb62ce0956a1a3321e0ea4ee389c78d7f616ac50"},
39763984
{file = "zstd-1.5.5.1-cp312-cp312-macosx_11_0_x86_64.whl", hash = "sha256:b8e7f5ee15e7d5d9a5deebc49f62316c901000d8485e68c5f5d602312bfba9ae"},
3985+
{file = "zstd-1.5.5.1-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:a4efaba2324628af8f31662c6e5adc363778a8454f6605ac01ece37dfcc9ba6e"},
3986+
{file = "zstd-1.5.5.1-cp312-cp312-macosx_13_0_x86_64.whl", hash = "sha256:0ffd07b4a44668ece31dc6281021c36517d6802ce8e20cc455863a99007ea324"},
3987+
{file = "zstd-1.5.5.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:46237c84f7817dc4d9c40cc43c7c9325a587f5ec593f364bae501cccada534ac"},
39773988
{file = "zstd-1.5.5.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:55bcbcca3a342e8298fd23e58f300b13a33e65667e837cb34dd16c8126cdf77a"},
3989+
{file = "zstd-1.5.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3aabfce08716b06357718fc73a63b5ead4e9ad3fe6765f8b37386ab94c58fb49"},
39783990
{file = "zstd-1.5.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95c3f06af07fc8976114bb233c426c499b3ac219a6545d163b3c1a4989c40288"},
39793991
{file = "zstd-1.5.5.1-cp312-cp312-win_amd64.whl", hash = "sha256:ab96e69cd4a70c5a4d3c613e85d6492817c35a9ba3921ee86f9d26a788c1522b"},
3992+
{file = "zstd-1.5.5.1-cp313-cp313-macosx_13_0_arm64.whl", hash = "sha256:d6599f5e0783728388c574e743640bc7d0f826c4d73030ff1541b16f3dd0a36f"},
3993+
{file = "zstd-1.5.5.1-cp313-cp313-macosx_13_0_x86_64.whl", hash = "sha256:60631652d49f2cd892cd8beadadb0e18a940489baf59a54f17cba8dfd197bb27"},
3994+
{file = "zstd-1.5.5.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b003e7319286b8f87ec4da872e9d1be811edb057ab99b3fde498168d48853987"},
3995+
{file = "zstd-1.5.5.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:858a7892483cc5a2902fa91b5da33b18d7c495a51e429ec5a6d8abe34907da2d"},
3996+
{file = "zstd-1.5.5.1-cp313-cp313-win_amd64.whl", hash = "sha256:020f2c4805d2c6dff58da71a9f84689e64852fa885869faf73c39c9230dd8540"},
39803997
{file = "zstd-1.5.5.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:1b111beaf6a4d98b6382e0891287a0d61ae44c3ec819b37f2256a482cc2ccc08"},
39813998
{file = "zstd-1.5.5.1-cp38-cp38-macosx_11_0_x86_64.whl", hash = "sha256:4a434d83bcfa8a0d843451bc073fe60bae9f710dce796c9dba716c66df49c311"},
39823999
{file = "zstd-1.5.5.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cccbafaeda62b98f3d3c70b5e686c6c539c0ea76cab88a9817f1cf3842d4272d"},
39834000
{file = "zstd-1.5.5.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:59afd7c07ff24dfde876fed3cce5dee64d246e54b394ca6c698b2ec15b0f2454"},
39844001
{file = "zstd-1.5.5.1-cp38-cp38-win_amd64.whl", hash = "sha256:eb17b3401e3fa2c16ecfee4b00cca82fbc71ffd6c64c97619605b2779bc7f5d0"},
39854002
{file = "zstd-1.5.5.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8612bb288facb0e24d171f7010f2ea2159d8bd7d8243667f707994f398b6d26d"},
39864003
{file = "zstd-1.5.5.1-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:8cee6c496fe49a27f4a641c75814681ee932201680eb4b07c88afde1b730b633"},
4004+
{file = "zstd-1.5.5.1-cp39-cp39-macosx_13_0_arm64.whl", hash = "sha256:905577dfb0182aafeb4bee396ca9426a63efe38b384c6684102f98433ac411f7"},
4005+
{file = "zstd-1.5.5.1-cp39-cp39-macosx_13_0_x86_64.whl", hash = "sha256:7c36475a570d5e6c031afd12a6f9990c57afc59106dd2f55e52388fd3d79e429"},
4006+
{file = "zstd-1.5.5.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:52e9e5d9f2e71f5bb86f795bb9f7648be8407f5305bcb3b698d271d6a9678b02"},
39874007
{file = "zstd-1.5.5.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b629e950bd0bcd169149af8c9c312d8091a922c07adeef0cd6e9fb06dc11216a"},
4008+
{file = "zstd-1.5.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5d87a075de6347d8804e41441fd41d9d17e362c07bac9d39ec361caef92c6ae6"},
39884009
{file = "zstd-1.5.5.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:86a968e443d735ff4716c18fda91b88d30fee7419c381d26ab2f92e779e69c22"},
39894010
{file = "zstd-1.5.5.1-cp39-cp39-win_amd64.whl", hash = "sha256:7e4a460b169110b16d39eb05249d36c9b09c9d1b4831e72ead13a484b5404029"},
39904011
]

0 commit comments

Comments
 (0)