better handling for introset propagation

This commit is contained in:
Jeff Becker 2018-09-21 12:37:49 -04:00
parent a91f54cc8a
commit 4309ea3b97
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
2 changed files with 8 additions and 5 deletions

View File

@ -53,12 +53,16 @@ namespace llarp
if(!I.Verify(&dht.router->crypto)) if(!I.Verify(&dht.router->crypto))
{ {
llarp::LogWarn("invalid introset: ", I); llarp::LogWarn("invalid introset: ", I);
return false; // don't propogate or store
replies.emplace_back(new GotIntroMessage({}, txID));
return true;
} }
if(I.W && !I.W->IsValid(dht.router->crypto.shorthash)) if(I.W && !I.W->IsValid(dht.router->crypto.shorthash))
{ {
llarp::LogWarn("proof of work not good enough for IntroSet"); llarp::LogWarn("proof of work not good enough for IntroSet");
return false; // don't propogate or store
replies.emplace_back(new GotIntroMessage({}, txID));
return true;
} }
llarp::dht::Key_t addr; llarp::dht::Key_t addr;
if(!I.A.CalculateAddress(addr)) if(!I.A.CalculateAddress(addr))
@ -68,9 +72,10 @@ namespace llarp
return false; return false;
} }
auto now = llarp_time_now_ms(); auto now = llarp_time_now_ms();
now += llarp::service::MAX_INTROSET_TIME_DELTA;
if(I.IsExpired(now)) if(I.IsExpired(now))
{ {
// don't propogate or store expired introsets // don't propogate or store
replies.emplace_back(new GotIntroMessage({}, txID)); replies.emplace_back(new GotIntroMessage({}, txID));
return true; return true;
} }

View File

@ -273,8 +273,6 @@ namespace llarp
{ {
if(!introset.Verify(crypto)) if(!introset.Verify(crypto))
{ {
llarp::LogInfo("invalid introset ", introset, " on endpoint ",
Name());
if(m_Identity.pub == introset.A && m_CurrentPublishTX == msg->T) if(m_Identity.pub == introset.A && m_CurrentPublishTX == msg->T)
{ {
IntroSetPublishFail(); IntroSetPublishFail();