Skip to content

Commit d42d859

Browse files
committed
review comments
1 parent fd66810 commit d42d859

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

chia/_tests/core/mempool/test_mempool.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,7 @@ async def test_double_spend_with_higher_fee(
692692

693693
@pytest.mark.anyio
694694
async def test_invalid_signature(
695-
self,
696-
one_node_one_block: tuple[FullNodeSimulator, ChiaServer, BlockTools],
697-
wallet_a: WalletTool,
698-
caplog: pytest.LogCaptureFixture,
695+
self, one_node_one_block: tuple[FullNodeSimulator, ChiaServer, BlockTools], wallet_a: WalletTool
699696
) -> None:
700697
reward_ph = wallet_a.get_new_puzzlehash()
701698

@@ -719,12 +716,11 @@ async def test_invalid_signature(
719716
sb: SpendBundle = generate_test_spend_bundle(wallet_a, coin1)
720717
assert sb.aggregated_signature != G2Element.generator()
721718
sb = sb.replace(aggregated_signature=G2Element.generator())
722-
caplog.clear()
723719
res: Optional[Message] = await send_sb(full_node_1, sb)
724720
assert res is not None
725721
ack: TransactionAck = TransactionAck.from_bytes(res.data)
726-
assert ack.status != MempoolInclusionStatus.SUCCESS.value
727-
assert "chia.util.errors.ValidationError: Error code: BAD_AGGREGATE_SIGNATURE" in caplog.text
722+
assert ack.status == MempoolInclusionStatus.FAILED.value
723+
assert ack.error == Err.BAD_AGGREGATE_SIGNATURE.name
728724
invariant_check_mempool(full_node_1.full_node.mempool_manager.mempool)
729725

730726
async def condition_tester(
@@ -2872,11 +2868,9 @@ async def test_invalid_coin_spend_coin(
28722868
coin_spend_0 = make_spend(coin_0, cs.puzzle_reveal, cs.solution)
28732869
new_bundle = recursive_replace(spend_bundle, "coin_spends", [coin_spend_0, *spend_bundle.coin_spends[1:]])
28742870
assert spend_bundle is not None
2875-
try:
2876-
res = await full_node_1.full_node.add_transaction(new_bundle, new_bundle.name(), test=True)
2877-
except ValidationError as e:
2878-
res = (MempoolInclusionStatus.FAILED, e.code)
2879-
assert res == (MempoolInclusionStatus.FAILED, Err.WRONG_PUZZLE_HASH)
2871+
with pytest.raises(ValidationError) as e:
2872+
await full_node_1.full_node.add_transaction(new_bundle, new_bundle.name(), test=True)
2873+
assert e.value.code == Err.WRONG_PUZZLE_HASH
28802874

28812875

28822876
coins = make_test_coins()

chia/full_node/full_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ async def _handle_one_transaction(self, entry: TransactionQueueEntry) -> None:
504504
error_stack = traceback.format_exc()
505505
self.log.debug(f"Cancelling _handle_one_transaction, closing: {error_stack}")
506506
except ValidationError as e:
507-
self.log.exception("Error in _handle_one_transaction, closing")
507+
self.log.exception("ValidationError in _handle_one_transaction, closing")
508508
if peer is not None:
509509
await peer.close(CONSENSUS_ERROR_BAN_SECONDS)
510510
entry.done.set((MempoolInclusionStatus.FAILED, e.code))

0 commit comments

Comments
 (0)