From 26d9ac35692f7f69c0fe230fb59e8a1772463ed1 Mon Sep 17 00:00:00 2001 From: t1amak Date: Thu, 19 Mar 2026 14:33:30 +0100 Subject: [PATCH] Validate legacy protocol payouts after Carrot --- src/cryptonote_core/blockchain.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 58e7693..9e95a54 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -1679,7 +1679,12 @@ bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height, false, "Invalid number of outputs in protocol_tx - aborting" ); - if (hf_version >= HF_VERSION_CARROT) { + const bool protocol_tx_is_carrot = !b.protocol_tx.vout.empty() && + b.protocol_tx.vout.front().target.type() == typeid(txout_to_carrot_v1); + + if (hf_version >= HF_VERSION_CARROT && protocol_tx_is_carrot) { + CHECK_AND_ASSERT_MES(yield_payouts.empty(), false, "Legacy yield payouts are not permitted in a Carrot protocol_tx"); + CHECK_AND_ASSERT_MES(audit_payouts.empty(), false, "AUDIT payouts are not permitted in a Carrot protocol_tx"); size_t output_idx = 0; for (auto it = carrot_yield_payouts.begin(); it != carrot_yield_payouts.end(); it++, output_idx++) { @@ -1789,6 +1794,8 @@ bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height, return true; } + + CHECK_AND_ASSERT_MES(carrot_yield_payouts.empty(), false, "Carrot yield payouts require a Carrot protocol_tx"); // Merge the yield and audit payouts into an iterable vector std::vector> payouts{yield_payouts};