Skip to content

Commit

Permalink
feat: keep groupPk/secKey in metagroup for debugging purposes if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilb committed Jul 3, 2024
1 parent 50b9a31 commit f4985cc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
nodeLinker: node-modules
patchFolder: patches

patchFolder: patches
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ if(NOT N EQUAL 0)
else()
set(CMAKE_BUILD_PARALLEL_LEVEL 4) # Fallback to 16 if detection fails
endif()
# set(CMAKE_BUILD_PARALLEL_LEVEL 32)
message(STATUS "Number of processors detected: ${N}")


Expand Down
12 changes: 10 additions & 2 deletions src/groups/meta_group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ class MetaGroup {
shared_ptr<config::groups::Info> info;
shared_ptr<config::groups::Members> members;
shared_ptr<config::groups::Keys> keys;
string edGroupPubKey;
std::optional<string> edGroupSecKey;

MetaGroup(
shared_ptr<config::groups::Info> info,
shared_ptr<config::groups::Members> members,
shared_ptr<config::groups::Keys> keys) :
info{info}, members{members}, keys{keys} {};
shared_ptr<config::groups::Keys> keys,
session::ustring edGroupPubKey,
std::optional<session::ustring> edGroupSecKey) :
info{info}, members{members}, keys{keys} {

this->edGroupPubKey = oxenc::to_hex(edGroupPubKey);
this->edGroupSecKey = edGroupSecKey ? oxenc::to_hex(*edGroupSecKey) : nullptr;
};

explicit MetaGroup(const Napi::CallbackInfo& info) {}
};
Expand Down
27 changes: 4 additions & 23 deletions src/groups/meta_group_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,32 +469,13 @@ Napi::Value MetaGroupWrapper::memberSetInvited(const Napi::CallbackInfo& info) {
assertIsBoolean(info[1]);
auto pubkeyHex = toCppString(info[0], __PRETTY_FUNCTION__);
auto failed = toCppBoolean(info[1], __PRETTY_FUNCTION__);
auto m = this->meta_group->members->get_or_construct(pubkeyHex);

// this->meta_group->members->log(
// session::config::LogLevel::warning,
// "libsession-util before: needsDump? " +
// std::string(this->needsDump(info) ? "true" : "false"));
// this->meta_group->members->log(
// session::config::LogLevel::warning,
// "libsession-util before: invite_failed of " + std::string(pubkeyHex) +
// " val: " + std::string(m.invite_failed() ? "true" : "false"));
auto m = this->meta_group->members->get_or_construct(pubkeyHex);
m.set_invited(failed);
this->meta_group->members->set(m);
// this->meta_group->members->log(
// session::config::LogLevel::warning,
// "libsession-util after: invite_failed of " + std::string(pubkeyHex) +
// " val: " + std::string(m.invite_failed() ? "true" : "false"));
auto refreshed = this->meta_group->members->get_or_construct(m.session_id);
// this->meta_group->members->log(
// session::config::LogLevel::warning,
// "libsession-util refreshed: invite_failed of " + std::string(pubkeyHex) +
// " val: " + std::string(refreshed.invite_failed() ? "true" : "false"));
// this->meta_group->members->log(
// session::config::LogLevel::warning,
// "libsession-util after: needsDump? of " +
// std::string(this->needsDump(info) ? "true" : "false"));
return refreshed;

return this->meta_group->members->get_or_construct(pubkeyHex);

});
}

Expand Down
2 changes: 1 addition & 1 deletion src/meta/meta_base_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class MetaBaseWrapper {
*info,
*members);

return std::make_unique<session::nodeapi::MetaGroup>(info, members, keys);
return std::make_unique<session::nodeapi::MetaGroup>(info, members, keys,group_ed25519_pubkey, group_ed25519_secretkey);
});
}
};
Expand Down

0 comments on commit f4985cc

Please sign in to comment.