mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-19 17:37:43 +00:00
bugfix: handle malformed/old-format negentropy messages gracefully
This commit is contained in:
@ -126,7 +126,14 @@ void cmd_sync(const std::vector<std::string> &subArgs) {
|
||||
if (msg.at(0) == "NEG-MSG") {
|
||||
uint64_t origHaves = have.size(), origNeeds = need.size();
|
||||
|
||||
auto neMsg = ne.reconcile(from_hex(msg.at(2).get_string()), have, need);
|
||||
std::optional<std::string> neMsg;
|
||||
|
||||
try {
|
||||
neMsg = ne.reconcile(from_hex(msg.at(2).get_string()), have, need);
|
||||
} catch (std::exception &e) {
|
||||
LE << "Unable to parse negentropy message from relay: " << e.what();
|
||||
doExit(1);
|
||||
}
|
||||
|
||||
totalHaves += have.size() - origHaves;
|
||||
totalNeeds += need.size() - origNeeds;
|
||||
|
Reference in New Issue
Block a user