mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
fix build of onion path when snodes count is exactly 12
This commit is contained in:
parent
291738ea2d
commit
ffe8375dd1
3 changed files with 5 additions and 5 deletions
|
@ -425,7 +425,7 @@ async function buildNewOnionPathsWorker() {
|
|||
);
|
||||
// TODO: select one guard node and 2 other nodes randomly
|
||||
let otherNodes = _.differenceBy(allNodes, guardNodes, 'pubkey_ed25519');
|
||||
if (otherNodes.length < SnodePool.minSnodePoolCount) {
|
||||
if (otherNodes.length <= SnodePool.minSnodePoolCount) {
|
||||
window?.log?.warn(
|
||||
'LokiSnodeAPI::buildNewOnionPaths - Too few nodes to build an onion path! Refreshing pool and retrying'
|
||||
);
|
||||
|
|
|
@ -268,7 +268,7 @@ export async function refreshRandomPool(forceRefresh = false): Promise<void> {
|
|||
if (fetchedFromDb?.length) {
|
||||
window?.log?.info(`refreshRandomPool: fetched from db ${fetchedFromDb.length} snodes.`);
|
||||
randomSnodePool = fetchedFromDb;
|
||||
if (randomSnodePool.length < minSnodePoolCount) {
|
||||
if (randomSnodePool.length <= minSnodePoolCount) {
|
||||
window?.log?.warn('refreshRandomPool: not enough snodes in db, going to fetch from seed');
|
||||
} else {
|
||||
return;
|
||||
|
@ -279,9 +279,9 @@ export async function refreshRandomPool(forceRefresh = false): Promise<void> {
|
|||
}
|
||||
|
||||
// we don't have nodes to fetch the pool from them, so call the seed node instead.
|
||||
if (randomSnodePool.length < minSnodePoolCount) {
|
||||
if (randomSnodePool.length <= minSnodePoolCount) {
|
||||
window?.log?.info(
|
||||
`refreshRandomPool: NOT enough snodes to fetch from them ${randomSnodePool.length} < ${minSnodePoolCount}, so falling back to seedNodes ${seedNodes?.length}`
|
||||
`refreshRandomPool: NOT enough snodes to fetch from them ${randomSnodePool.length} <= ${minSnodePoolCount}, so falling back to seedNodes ${seedNodes?.length}`
|
||||
);
|
||||
|
||||
randomSnodePool = await exports.refreshRandomPoolDetail(seedNodes);
|
||||
|
|
|
@ -67,7 +67,7 @@ describe('OnionPathsErrors', () => {
|
|||
|
||||
beforeEach(async () => {
|
||||
guardPubkeys = TestUtils.generateFakePubKeys(3).map(n => n.key);
|
||||
otherNodesPubkeys = TestUtils.generateFakePubKeys(12).map(n => n.key);
|
||||
otherNodesPubkeys = TestUtils.generateFakePubKeys(13).map(n => n.key);
|
||||
|
||||
SNodeAPI.Onions.resetSnodeFailureCount();
|
||||
|
||||
|
|
Loading…
Reference in a new issue