chia-blockchain 2.5.5rc4__py3-none-any.whl → 2.5.5rc5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3211,3 +3211,61 @@ async def test_new_peak_deferred_ff_items() -> None:
3211
3211
  latest_singleton_lineage2 = mi2.bundle_coin_spends[singleton2_id].latest_singleton_lineage
3212
3212
  assert latest_singleton_lineage2 is not None
3213
3213
  assert latest_singleton_lineage2.coin_id == singleton2_new_latest.name()
3214
+
3215
+
3216
+ @pytest.mark.anyio
3217
+ async def test_different_ff_versions() -> None:
3218
+ """
3219
+ Covers the case where we send an item with an older ff singleton version
3220
+ while the mempool is aware of a newer lineage.
3221
+ """
3222
+ launcher_id = bytes32([1] * 32)
3223
+ singleton_spend1 = make_singleton_spend(launcher_id, bytes32([2] * 32))
3224
+ version1_id = singleton_spend1.coin.name()
3225
+ singleton_spend2 = make_singleton_spend(launcher_id, bytes32([3] * 32))
3226
+ version2_id = singleton_spend2.coin.name()
3227
+ singleton_ph = singleton_spend2.coin.puzzle_hash
3228
+ coins = TestCoins(
3229
+ [singleton_spend1.coin, singleton_spend2.coin, TEST_COIN, TEST_COIN2], {singleton_ph: singleton_spend2.coin}
3230
+ )
3231
+ mempool_manager = await setup_mempool(coins)
3232
+ mempool_items: list[MempoolItem] = []
3233
+ for singleton_spend, regular_coin in [(singleton_spend1, TEST_COIN), (singleton_spend2, TEST_COIN2)]:
3234
+ sb = SpendBundle([singleton_spend, mk_coin_spend(regular_coin)], G2Element())
3235
+ sb_name = sb.name()
3236
+ await mempool_manager.add_spend_bundle(
3237
+ sb,
3238
+ make_test_conds(spend_ids=[(singleton_spend.coin, ELIGIBLE_FOR_FF), (regular_coin, 0)], cost=1337),
3239
+ sb_name,
3240
+ uint32(1),
3241
+ )
3242
+ mi = mempool_manager.get_mempool_item(sb_name)
3243
+ assert mi is not None
3244
+ mempool_items.append(mi)
3245
+ [mi1, mi2] = mempool_items
3246
+ latest_lineage_id = version2_id
3247
+ assert latest_lineage_id != version1_id
3248
+ # Bundle coin spends key points to version 1 but the lineage is latest (v2)
3249
+ latest_singleton_lineage1 = mi1.bundle_coin_spends[version1_id].latest_singleton_lineage
3250
+ assert latest_singleton_lineage1 is not None
3251
+ assert latest_singleton_lineage1.coin_id == latest_lineage_id
3252
+ # Both the bundle coin spends key and the lineage point to latest (v2)
3253
+ latest_singleton_lineage2 = mi2.bundle_coin_spends[version2_id].latest_singleton_lineage
3254
+ assert latest_singleton_lineage2 is not None
3255
+ assert latest_singleton_lineage2.coin_id == latest_lineage_id
3256
+ # Let's update the lineage with a new version of the singleton
3257
+ new_latest_lineage = Coin(version2_id, singleton_ph, singleton_spend2.coin.amount)
3258
+ new_latest_lineage_id = new_latest_lineage.name()
3259
+ coins.update_lineage(singleton_ph, new_latest_lineage)
3260
+ await advance_mempool(mempool_manager, [version1_id, version2_id], use_optimization=True)
3261
+ # Both items should get updated with the latest lineage
3262
+ new_mi1 = mempool_manager.get_mempool_item(mi1.spend_bundle_name)
3263
+ assert new_mi1 is not None
3264
+ latest_singleton_lineage1 = new_mi1.bundle_coin_spends[version1_id].latest_singleton_lineage
3265
+ assert latest_singleton_lineage1 is not None
3266
+ assert latest_singleton_lineage1.coin_id == new_latest_lineage_id
3267
+ new_mi2 = mempool_manager.get_mempool_item(mi2.spend_bundle_name)
3268
+ assert new_mi2 is not None
3269
+ latest_singleton_lineage2 = new_mi2.bundle_coin_spends[version2_id].latest_singleton_lineage
3270
+ assert latest_singleton_lineage2 is not None
3271
+ assert latest_singleton_lineage2.coin_id == new_latest_lineage_id
@@ -258,7 +258,22 @@ def check_removals(
258
258
  for item in conflicting_items:
259
259
  if item in conflicts:
260
260
  continue
261
- conflict_bcs = item.bundle_coin_spends[coin_id]
261
+ conflict_bcs = item.bundle_coin_spends.get(coin_id)
262
+ if conflict_bcs is None:
263
+ # Check if this is an item that spends an older ff singleton
264
+ # version with a latest version that matches our coin ID.
265
+ conflict_bcs = next(
266
+ (
267
+ bcs
268
+ for bcs in item.bundle_coin_spends.values()
269
+ if bcs.latest_singleton_lineage is not None and bcs.latest_singleton_lineage.coin_id == coin_id
270
+ ),
271
+ None,
272
+ )
273
+ # We're not expected to get here but let's handle it gracefully
274
+ if conflict_bcs is None:
275
+ log.warning(f"Coin ID {coin_id} expected but not found in mempool item {item.name}")
276
+ return Err.INVALID_SPEND_BUNDLE, []
262
277
  # if the spend we're adding to the mempool is not DEDUP nor FF, it's
263
278
  # just a regular conflict
264
279
  if not coin_bcs.eligible_for_fast_forward and not coin_bcs.eligible_for_dedup:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chia-blockchain
3
- Version: 2.5.5rc4
3
+ Version: 2.5.5rc5
4
4
  Summary: Chia blockchain full node, farmer, timelord, and wallet.
5
5
  License: Apache-2.0
6
6
  Keywords: chia,blockchain,node
@@ -125,7 +125,7 @@ chia/_tests/core/mempool/test_mempool.py,sha256=3U4SzpN9JAfaC2OJDR0rSusz9Jj1SDl2
125
125
  chia/_tests/core/mempool/test_mempool_fee_estimator.py,sha256=HDUVrV6tNq1w2v7Rq-FGXFrCspnHVoSQfPOKRmwojmw,3711
126
126
  chia/_tests/core/mempool/test_mempool_fee_protocol.py,sha256=XUTKqs82IOiiZMGPTPSRhB4Zp8clbus5GlOoUtPtL6A,2165
127
127
  chia/_tests/core/mempool/test_mempool_item_queries.py,sha256=k8tM3axB-fdZwN2NqCAcir-4yslSM8AJIQ0QvEJK9V8,6959
128
- chia/_tests/core/mempool/test_mempool_manager.py,sha256=Qeo6rJChjKvAzq-HUteRQ05InDDmtBp2mwR-e8tfS_0,144246
128
+ chia/_tests/core/mempool/test_mempool_manager.py,sha256=p1tT8FOszY6DXi-Z7S2SxPvsNxCgCxaCRHY7c2qv2WM,147336
129
129
  chia/_tests/core/mempool/test_mempool_performance.py,sha256=a5bLSJ_Q_EVYnUHn96I5RC7VZl7niizBK47yVnzvWn4,2935
130
130
  chia/_tests/core/mempool/test_singleton_fast_forward.py,sha256=Fk85FJRgEHwrc_n2k8jTzsunlWdNdLCYh8MqpG-egt8,35060
131
131
  chia/_tests/core/node_height.py,sha256=yfkEmmYCsAb3cIe1ZhtE9J2SFB9lG_49SgjxsITdrZk,917
@@ -544,7 +544,7 @@ chia/full_node/hint_management.py,sha256=8dVKguFPm-h32GEnMWxX2qyITo4WVO1YBKaPFKC
544
544
  chia/full_node/hint_store.py,sha256=0m6y0_f0rhGIKqfAmhFSGEeyM3LCN-dv-bR1OfIr4Uo,3666
545
545
  chia/full_node/mempool.py,sha256=x8Uo5xy1jcxXQgYaPUU2JkRsu9edndYs0hye3fFoZbk,33795
546
546
  chia/full_node/mempool_check_conditions.py,sha256=19_uUO8SCVrkJHEUDw0i0NVWwJyXc7BaAQQdVJSVqIE,3583
547
- chia/full_node/mempool_manager.py,sha256=tUw-N3r67BQFIekx2wSgXmMoN7Gcn5IfI0BqphsCpAg,50065
547
+ chia/full_node/mempool_manager.py,sha256=KUNu7tdeadhGgBCJWgby4hNM90D5hz4OlMMUVY0SCeM,50881
548
548
  chia/full_node/pending_tx_cache.py,sha256=jEL004L7r1n7ppeSdLVe6nsVNfYw0jU86DHmRYe1rH4,3657
549
549
  chia/full_node/subscriptions.py,sha256=-3Mjv08_Z1iBUoXgGoHZvYPyTfkVHyWXhHJH2DWwx9A,8659
550
550
  chia/full_node/sync_store.py,sha256=pyjhiUVe_5CXJd8r-lk0-VpFbkX2RtO5N-370W47Rko,5206
@@ -891,8 +891,8 @@ chia/wallet/wallet_user_store.py,sha256=rXiQpk5g8t1X0Chx0bValcQsHonjB1oQ_F_K16bp
891
891
  chia/wallet/wallet_weight_proof_handler.py,sha256=IcQg_w8EPjpS9xwmEE8GvPcneLePOtu74wWUu1l5uuM,4875
892
892
  chia/wallet/wsm_apis.py,sha256=6LmxbHXC-tqNbRyoiGgz-f19PF1nEfMbfm3BTnsNQ6s,3914
893
893
  mozilla-ca/cacert.pem,sha256=qz7jZRl3pBeKcCsLgopO57K7uRJyNbCrdA4uFZdL9ds,222971
894
- chia_blockchain-2.5.5rc4.dist-info/LICENSE,sha256=0tuU-jTzeRDJJaxF2YCEpBwbywgpbrVSXq1i6fJq63U,11347
895
- chia_blockchain-2.5.5rc4.dist-info/METADATA,sha256=7zD_mYhVB8UIXks054o9_hqJdERGFNBqF-LLGapzBoE,10687
896
- chia_blockchain-2.5.5rc4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
897
- chia_blockchain-2.5.5rc4.dist-info/entry_points.txt,sha256=GL2-UvicPVdKz72IP4shnmV3XImfoD5pMzoURfoAYk4,742
898
- chia_blockchain-2.5.5rc4.dist-info/RECORD,,
894
+ chia_blockchain-2.5.5rc5.dist-info/LICENSE,sha256=0tuU-jTzeRDJJaxF2YCEpBwbywgpbrVSXq1i6fJq63U,11347
895
+ chia_blockchain-2.5.5rc5.dist-info/METADATA,sha256=NFOEYqEMGkFISbjbKhBcfoNigKLJ1tLG52emb9ivbEQ,10687
896
+ chia_blockchain-2.5.5rc5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
897
+ chia_blockchain-2.5.5rc5.dist-info/entry_points.txt,sha256=GL2-UvicPVdKz72IP4shnmV3XImfoD5pMzoURfoAYk4,742
898
+ chia_blockchain-2.5.5rc5.dist-info/RECORD,,