mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-02-02 09:54:29 +00:00
trying to reduce the occurrences of "INCOMING ERROR: height > getBestHeight"
This commit is contained in:
parent
2aa2b7b3a3
commit
a9f53cce98
@ -520,6 +520,11 @@ bool node_impl::refresh_storage() {
|
||||
// FIXME: optimize to avoid bdecode (store seq separated, etc)
|
||||
int ret = lazy_bdecode(item.p.data(), item.p.data() + item.p.size(), p, err, &pos, 10, 500);
|
||||
|
||||
int height = p.dict_find_int_value("height");
|
||||
if( height > getBestHeight() ) {
|
||||
continue; // how?
|
||||
}
|
||||
|
||||
const lazy_entry *target = p.dict_find_dict("target");
|
||||
std::string username = target->dict_find_string_value("n");
|
||||
std::string resource = target->dict_find_string_value("r");
|
||||
@ -1263,7 +1268,7 @@ void node_impl::incoming_request(msg const& m, entry& e)
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg_keys[mk_height]->int_value() > getBestHeight() && getBestHeight() > 0) {
|
||||
if (msg_keys[mk_height]->int_value() > getBestHeight()+1 && getBestHeight() > 0) {
|
||||
incoming_error(e, "height > getBestHeight");
|
||||
return;
|
||||
}
|
||||
|
@ -882,7 +882,7 @@ bool acceptSignedPost(char const *data, int data_size, std::string username, int
|
||||
} else if( !validatePostNumberForUser(username, k) ) {
|
||||
sprintf(errbuf,"too much posts from user '%s' rejecting post",
|
||||
username.c_str());
|
||||
} else if( height < 0 || (height > getBestHeight() && getBestHeight() > 0) ) {
|
||||
} else if( height < 0 || (height > getBestHeight()+1 && getBestHeight() > 0) ) {
|
||||
sprintf(errbuf,"post from future not accepted (height: %d > %d)",
|
||||
height, getBestHeight());
|
||||
} else if( msgUtf8Chars < 0 ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user