NTCP2: New FNDF method

This commit is contained in:
zzz
2018-06-26 15:39:08 +00:00
parent 435bf81945
commit 0f048a7aa6

View File

@ -180,6 +180,24 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
return _lookupThrottler == null || _lookupThrottler.shouldThrottle(from, id);
}
/**
* If we are floodfill AND the key is not throttled,
* flood it, otherwise don't.
*
* @return if we did
* @since 0.9.36 for NTCP2
*/
public boolean floodConditional(DatabaseEntry ds) {
if (!floodfillEnabled())
return false;
if (shouldThrottleFlood(ds.getHash())) {
_context.statManager().addRateData("netDb.floodThrottled", 1);
return false;
}
flood(ds);
return true;
}
/**
* Send to a subset of all floodfill peers.
* We do this to implement Kademlia within the floodfills, i.e.