Skip to content

Commit ce8a4c3

Browse files
committed
Merge commit '3901126c3d4b12cf7567f9ff33081d1ae99f626c' into checkpoint/main_from_release_2.5.4_3901126c3d4b12cf7567f9ff33081d1ae99f626c
2 parents a803d18 + 3901126 commit ce8a4c3

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

chia/_tests/core/mempool/test_mempool_manager.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ def mk_coin_spend(coin: Coin, solution: Optional[str] = None) -> CoinSpend:
878878
return make_spend(
879879
coin,
880880
SerializedProgram.to(None),
881-
SerializedProgram.to(bytes.fromhex(solution) if solution is not None else None),
881+
SerializedProgram.fromhex(solution if solution is not None else "80"),
882882
)
883883

884884

@@ -2991,14 +2991,15 @@ async def test_check_removals_with_block_creation(flags: int, old: bool) -> None
29912991

29922992
@pytest.mark.anyio
29932993
async def test_dedup_not_canonical() -> None:
2994-
# this is 1, but with a non-canonical encoding
2995-
coin_spend = mk_coin_spend(TEST_COIN, solution="c00101")
2996-
coins = TestCoins(coins=[], lineage={})
2994+
# this is ((1)), but with a non-canonical encoding
2995+
coin_spend = mk_coin_spend(TEST_COIN, solution="ffffc001018080")
2996+
coins = TestCoins([TEST_COIN], lineage={})
29972997
mempool_manager = await setup_mempool(coins)
29982998
sb = SpendBundle([coin_spend], G2Element())
29992999
sb_conds = make_test_conds(spend_ids=[(TEST_COIN, ELIGIBLE_FOR_DEDUP)])
30003000
bundle_add_info = await mempool_manager.add_spend_bundle(sb, sb_conds, sb.name(), uint32(1))
30013001
assert bundle_add_info.status == MempoolInclusionStatus.FAILED
3002+
assert bundle_add_info.error == Err.INVALID_COIN_SOLUTION
30023003

30033004

30043005
def make_coin_record(coin: Coin, spent_block_index: int = 0) -> CoinRecord:

chia/full_node/mempool_manager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,10 @@ async def validate_spend_bundle(
613613
EligibilityAndAdditions(is_eligible_for_dedup=False, spend_additions=[], ff_puzzle_hash=None),
614614
)
615615

616-
supports_dedup = eligibility_info.is_eligible_for_dedup and is_clvm_canonical(bytes(coin_spend.solution))
616+
supports_dedup = eligibility_info.is_eligible_for_dedup
617+
if supports_dedup and not is_clvm_canonical(bytes(coin_spend.solution)):
618+
return Err.INVALID_COIN_SOLUTION, None, []
619+
617620
mark_as_fast_forward = eligibility_info.ff_puzzle_hash is not None and supports_fast_forward(coin_spend)
618621
lineage_info = None
619622
if mark_as_fast_forward:

0 commit comments

Comments
 (0)