screen leaseSets before storing them in KademliaNetworkDatabaseFacade.store,...
Branch name is misleading.
This updates the way flags are updated on leaseSets in the netDB so that if the lease has already been received down a client, it will be fully copied-over by the new router, then the flags are updated after the copy. This should prevent a potential context confusion wherein a crafted leaseSet is sent first to a client, then to a router, then requested back from the router, in order to determine that the leaseSet was stored in the client context and updated in the router context. If we already have it from the client context, we refuse to update it with the flag that indicates it was received in the router context.
Note that the flag isn't actually necessary to check in the caller anymore, because DatabaseEntry now contains the checks in the getter/setter functions instead(after reviewing their usage). That is the change reflected in DatabaseEntry.java. Probably should take those out at some point, unless we can find some reason why a "safe" DatabaseEntry class where safe is defined by one DBE, one context, is a bad idea.
This also updates the way things are handled when we get a leaseSet which is possibly a multihomed site. If a router receives a store for a locally-created leaseSet, normally it drops it. This changes by putting the leaseSet into a store in the OutboundCache especially for multihomed leaseSets. If it's requested back, and the router is a floodfill, then it's retrieved from the outbound cache as if it were stored in our netDB and we reply with it.
This also reduces the amount of lookups required before we throttle a lookup to 12 from 30. This also adds a tool, LookupBanHammer, which we can use to ban a router who sends us a bunch of lookups in too short a time, a possible indicator of attack. Whether we need to use it remains to be seen, so it is configured to just log for now.
This could of course, all be superseded by a meta-netDB proposal in the near future.