1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Minor DHT improvements (#657)

* Remove repeating DHT queries in adnl-peer

* Fix checking dht node signature for non-default network id

* Custom dht network id in generate-random-id
This commit is contained in:
SpyCheese 2023-03-30 07:10:09 +00:00 committed by GitHub
parent 5e0dadfff6
commit 3a30d6f319
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 20 deletions

View file

@ -140,13 +140,7 @@ adnl::AdnlNodeIdFull DhtRemoteNode::get_full_id() const {
td::Result<std::unique_ptr<DhtRemoteNode>> DhtRemoteNode::create(DhtNode node, td::uint32 max_missed_pings,
td::int32 our_network_id) {
TRY_RESULT(enc, node.adnl_id().pubkey().create_encryptor());
auto tl = node.tl();
auto sig = std::move(tl->signature_);
TRY_STATUS_PREFIX(enc->check_signature(serialize_tl_object(tl, true).as_slice(), sig.as_slice()),
"bad node signature: ");
TRY_STATUS(node.check_signature());
return std::make_unique<DhtRemoteNode>(std::move(node), max_missed_pings, our_network_id);
}