Skip to content

Commit

Permalink
fixes #305
Browse files Browse the repository at this point in the history
  • Loading branch information
tegefaulkes committed Mar 8, 2022
1 parent f28aea6 commit dc39fd2
Show file tree
Hide file tree
Showing 3 changed files with 251 additions and 69 deletions.
8 changes: 5 additions & 3 deletions src/vaults/VaultInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ class VaultInternal {
remoteInfo.remoteNode = nodesUtils.encodeNodeId(pullNodeId);
}
if (pullVaultNameOrId == null) {
pullVaultNameOrId = vaultsUtils.decodeVaultId(remoteInfo.remoteVault!);
pullVaultNameOrId = vaultsUtils.decodeVaultId(remoteInfo.remoteVault!)!;
} else {
metaChange = 1;
if (typeof pullVaultNameOrId === 'string') {
Expand All @@ -529,7 +529,7 @@ class VaultInternal {
this.vaultId,
)} from Node ${pullNodeId}`,
);
let remoteVaultId: VaultIdEncoded;
let remoteVaultId: VaultId;
try {
remoteVaultId = await nodeConnectionManager.withConnF(
pullNodeId!,
Expand Down Expand Up @@ -568,7 +568,9 @@ class VaultInternal {
throw err;
}
if (metaChange !== 0) {
if (metaChange === 2) remoteInfo.remoteVault = remoteVaultId;
if (metaChange === 2) {
remoteInfo.remoteVault = vaultsUtils.encodeVaultId(remoteVaultId);
}
await this.db.put(
this.vaultMetadataDbDomain,
VaultInternal.remoteKey,
Expand Down
1 change: 0 additions & 1 deletion src/vaults/VaultManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,6 @@ class VaultManager {
}

@ready(new vaultsErrors.ErrorVaultManagerNotRunning())
// TODO: write a test for this, check if it actually handles conflicts
protected async generateVaultId(): Promise<VaultId> {
let vaultId = vaultsUtils.generateVaultId();
let i = 0;
Expand Down
Loading

0 comments on commit dc39fd2

Please sign in to comment.