Validate legacy protocol payouts after Carrot
This commit is contained in:
@@ -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<std::pair<yield_tx_info, uint64_t>> payouts{yield_payouts};
|
||||
|
||||
Reference in New Issue
Block a user