mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 06:18:02 +00:00
optimization. should *greatly* reduce cpu usage. #136
This commit is contained in:
parent
df5b5037b1
commit
acbd61e93d
@ -181,7 +181,7 @@ public:
|
||||
|
||||
void tick();
|
||||
bool refresh_storage();
|
||||
bool has_expired(dht_storage_item const& item);
|
||||
bool has_expired(dht_storage_item const& item, bool skipSigCheck=false);
|
||||
bool save_storage(entry &save) const;
|
||||
void refresh(node_id const& id, find_data::nodes_callback const& f);
|
||||
void bootstrap(std::vector<udp::endpoint> const& nodes
|
||||
|
@ -509,7 +509,7 @@ bool node_impl::refresh_storage() {
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DHT_ITEM_EXPIRE
|
||||
if( has_expired(item) ) {
|
||||
if( has_expired(item, true) ) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -580,12 +580,12 @@ bool node_impl::refresh_storage() {
|
||||
return did_something;
|
||||
}
|
||||
|
||||
bool node_impl::has_expired(dht_storage_item const& item) {
|
||||
bool node_impl::has_expired(dht_storage_item const& item, bool skipSigCheck) {
|
||||
// dont expire if block chain is invalid
|
||||
if( getBestHeight() < 1 )
|
||||
return false;
|
||||
|
||||
if (!verifySignature(item.p, item.sig_user, item.sig_p)) {
|
||||
if (!skipSigCheck && !verifySignature(item.p, item.sig_user, item.sig_p)) {
|
||||
// invalid signature counts as expired
|
||||
printf("node_impl::has_expired verifySignature failed\n");
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user