From baa0aec118c7f6690a9892c153d50ab8f224ab81 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 3 Sep 2025 09:23:44 +0200 Subject: [PATCH 1/3] remove unnecessary NPCResult in mempool_manager --- chia/full_node/mempool_manager.py | 16 ++++++---------- chia/types/internal_mempool_item.py | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/chia/full_node/mempool_manager.py b/chia/full_node/mempool_manager.py index 193c6871eb24..3eb9ada003dc 100644 --- a/chia/full_node/mempool_manager.py +++ b/chia/full_node/mempool_manager.py @@ -26,7 +26,6 @@ from chia.consensus.block_record import BlockRecordProtocol from chia.consensus.check_time_locks import check_time_locks -from chia.consensus.cost_calculator import NPCResult from chia.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator from chia.full_node.fee_estimation import FeeBlockInfo, MempoolInfo, MempoolItemInfo from chia.full_node.fee_estimator_interface import FeeEstimatorInterface @@ -480,8 +479,6 @@ async def pre_validate_spendbundle( if bls_cache is not None: bls_cache.update(new_cache_entries) - ret = NPCResult(None, sbc) - if spend_bundle_id is None: spend_bundle_id = spend_bundle.name() @@ -490,10 +487,7 @@ async def pre_validate_spendbundle( f"pre_validate_spendbundle took {duration:0.4f} seconds " f"for {spend_bundle_id} (queue-size: {self._worker_queue_size})", ) - if ret.error is not None: - raise ValidationError(Err(ret.error), "pre_validate_spendbundle failed") - assert ret.conds is not None - return ret.conds + return sbc async def add_spend_bundle( self, @@ -507,9 +501,11 @@ async def add_spend_bundle( ] = None, ) -> SpendBundleAddInfo: """ - Validates and adds to mempool a new_spend with the given NPCResult, and spend_name, and the current mempool. - The mempool should be locked during this call (blockchain lock). If there are mempool conflicts, the conflicting - spends might be removed (if the new spend is a superset of the previous). Otherwise, the new spend might be + Validates and adds to mempool a new_spend with the given + SpendBundleConditions, and spend_name, and the current mempool. The mempool + should be locked during this call (blockchain lock). If there are mempool + conflicts, the conflicting spends might be removed (if the new spend is + a superset of the previous). Otherwise, the new spend might be added to the potential pool. Args: diff --git a/chia/types/internal_mempool_item.py b/chia/types/internal_mempool_item.py index 991ae8c34f26..80889e56681b 100644 --- a/chia/types/internal_mempool_item.py +++ b/chia/types/internal_mempool_item.py @@ -14,5 +14,5 @@ class InternalMempoolItem: spend_bundle: SpendBundle conds: SpendBundleConditions height_added_to_mempool: uint32 - # Map of coin ID to coin spend data between the bundle and its NPCResult + # Map of coin ID to coin spend data between the bundle and its SpendBundleConditions bundle_coin_spends: dict[bytes32, BundleCoinSpend] From 3e9d356ad23146197f07910ee10095f8d7b03a79 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 3 Sep 2025 19:29:50 +0200 Subject: [PATCH 2/3] review comment --- chia/full_node/mempool_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chia/full_node/mempool_manager.py b/chia/full_node/mempool_manager.py index 3eb9ada003dc..f125a110c802 100644 --- a/chia/full_node/mempool_manager.py +++ b/chia/full_node/mempool_manager.py @@ -510,7 +510,7 @@ async def add_spend_bundle( Args: new_spend: spend bundle to validate and add - conds: result of running the clvm transaction in a fake block + conds: the SpendBundleConditions resulting from running the clvm in the SpendBundles coin spends spend_name: hash of the spend bundle data, passed in as an optimization Returns: From bf3536617ae5fda1482d9afcc3e147dd2915f2eb Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 3 Sep 2025 22:21:27 +0200 Subject: [PATCH 3/3] Update chia/full_node/mempool_manager.py Co-authored-by: Amine Khaldi --- chia/full_node/mempool_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chia/full_node/mempool_manager.py b/chia/full_node/mempool_manager.py index f125a110c802..79ae951e7a24 100644 --- a/chia/full_node/mempool_manager.py +++ b/chia/full_node/mempool_manager.py @@ -510,7 +510,7 @@ async def add_spend_bundle( Args: new_spend: spend bundle to validate and add - conds: the SpendBundleConditions resulting from running the clvm in the SpendBundles coin spends + conds: SpendBundleConditions resulting from running the clvm in the spend bundle's coin spends spend_name: hash of the spend bundle data, passed in as an optimization Returns: