From 48d94d500ae54d9f815d03e600438d7385cb1718 Mon Sep 17 00:00:00 2001 From: SpyCheese Date: Wed, 28 Aug 2024 14:09:22 +0300 Subject: [PATCH] Allow unlimited catchain.getBlock requests (#1132) --- catchain/catchain-receiver-source.h | 2 +- catchain/catchain-receiver.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/catchain/catchain-receiver-source.h b/catchain/catchain-receiver-source.h index 55035e77..136906a0 100644 --- a/catchain/catchain-receiver-source.h +++ b/catchain/catchain-receiver-source.h @@ -61,7 +61,7 @@ class CatChainReceiverSource { virtual td::BufferSlice fork_proof() const = 0; virtual bool fork_is_found() const = 0; - // One block can be sent to one node only a limited number of times to prevent DoS + // One block can be sent to one node in catchain.getDifference only a limited number of times to prevent DoS virtual bool allow_send_block(CatChainBlockHash hash) = 0; static td::Result> create(CatChainReceiver *chain, PublicKey pub_key, diff --git a/catchain/catchain-receiver.cpp b/catchain/catchain-receiver.cpp index 82779e3b..ade4726f 100644 --- a/catchain/catchain-receiver.cpp +++ b/catchain/catchain-receiver.cpp @@ -697,12 +697,8 @@ void CatChainReceiverImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::cat } else { CatChainReceiverSource *S = get_source_by_adnl_id(src); CHECK(S != nullptr); - if (S->allow_send_block(it->second->get_hash())) { - promise.set_value(serialize_tl_object(create_tl_object(it->second->export_tl()), - true, it->second->get_payload().as_slice())); - } else { - promise.set_error(td::Status::Error("block was requested too many times")); - } + promise.set_value(serialize_tl_object(create_tl_object(it->second->export_tl()), + true, it->second->get_payload().as_slice())); } }