1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-15 04:32:21 +00:00

Bugfix in check_neighbor_outbound_message

This commit is contained in:
SpyCheese 2023-10-16 11:22:41 +03:00
parent a198ca7fe3
commit 1eef6ed55e

View file

@ -4010,8 +4010,37 @@ bool ValidateQuery::check_neighbor_outbound_message(Ref<vm::CellSlice> enq_msg,
key.to_hex(352) + " of neighbor " + nb.blk_.to_str());
}
if (shard_contains(shard_, enq.cur_prefix_)) {
// this message couldn't come from our own outbound queue because processed messages from our queue don't stay here
return fatal_error("have an already processed EnqueuedMsg from our shard: "s + key.to_hex(352));
// if this message comes from our own outbound queue, we must have dequeued it
if (out_entry.is_null()) {
return reject_query("our old outbound queue contains EnqueuedMsg with key "s + key.to_hex(352) +
" already processed by this shard, but there is no ext_message_deq OutMsg record for this "
"message in this block");
}
int tag = block::gen::t_OutMsg.get_tag(*out_entry);
if (tag == block::gen::OutMsg::msg_export_deq_short) {
block::gen::OutMsg::Record_msg_export_deq_short deq;
if (!tlb::csr_unpack(std::move(out_entry), deq)) {
return reject_query(
"cannot unpack msg_export_deq_short OutMsg record for already processed EnqueuedMsg with key "s +
key.to_hex(352) + " of old outbound queue");
}
if (deq.msg_env_hash != enq.msg_env_->get_hash().bits()) {
return reject_query("unpack ext_message_deq OutMsg record for already processed EnqueuedMsg with key "s +
key.to_hex(352) + " of old outbound queue refers to MsgEnvelope with different hash " +
deq.msg_env_hash.to_hex());
}
} else {
block::gen::OutMsg::Record_msg_export_deq deq;
if (!tlb::csr_unpack(std::move(out_entry), deq)) {
return reject_query(
"cannot unpack msg_export_deq OutMsg record for already processed EnqueuedMsg with key "s +
key.to_hex(352) + " of old outbound queue");
}
if (deq.out_msg->get_hash() != enq.msg_env_->get_hash()) {
return reject_query("unpack ext_message_deq OutMsg record for already processed EnqueuedMsg with key "s +
key.to_hex(352) + " of old outbound queue contains a different MsgEnvelope");
}
}
}
// next check is incorrect after a merge, when ns_.processed_upto has > 1 entries
// we effectively comment it out