Compare commits

..

No commits in common. "19da9676053cb4e0bfa6ec5c648f98b156becbca" and "1c92a40984c52b109f2cdb14028dd00515271b12" have entirely different histories.

View File

@ -211,7 +211,7 @@ export default class Services {
public async checkConnections(members: Member[]): Promise<void> {
// Ensure the amount is available before proceeding
await this.getTokensFromFaucet();
let unconnectedAddresses: Set<string> = new Set();
let unconnectedAddresses = [];
const myAddress = this.getDeviceAddress();
for (const member of members) {
const sp_addresses = member.sp_addresses;
@ -221,12 +221,12 @@ export default class Services {
if (address === myAddress) continue;
const sharedSecret = await this.getSecretForAddress(address);
if (!sharedSecret) {
unconnectedAddresses.add(address);
unconnectedAddresses.push(address);
}
}
}
if (unconnectedAddresses && unconnectedAddresses.size != 0) {
const apiResult = await this.connectAddresses([...unconnectedAddresses]);
if (unconnectedAddresses && unconnectedAddresses.length != 0) {
const apiResult = await this.connectAddresses(unconnectedAddresses);
await this.handleApiReturn(apiResult);
}
}
@ -504,15 +504,15 @@ export default class Services {
await db.clearStore('diffs');
}
sendNewTxMessage(message: string) {
async sendNewTxMessage(message: string) {
sendMessage('NewTx', message);
}
sendCommitMessage(message: string) {
async sendCommitMessage(message: string) {
sendMessage('Commit', message);
}
sendCipherMessages(ciphers: string[]) {
async sendCipherMessages(ciphers: string[]) {
for (let i = 0; i < ciphers.length; i++) {
const cipher = ciphers[i];
sendMessage('Cipher', cipher);
@ -525,10 +525,9 @@ export default class Services {
async parseCipher(message: string) {
const membersList = this.getAllMembers();
const processes = await this.getProcesses();
try {
// console.log('parsing new cipher');
const apiReturn = this.sdkClient.parse_cipher(message, membersList, processes);
const apiReturn = this.sdkClient.parse_cipher(message, membersList);
await this.handleApiReturn(apiReturn);
// Device 1 wait Device 2
@ -603,7 +602,7 @@ export default class Services {
}
if (apiReturn.new_tx_to_send && apiReturn.new_tx_to_send.transaction.length != 0) {
this.sendNewTxMessage(JSON.stringify(apiReturn.new_tx_to_send));
await this.sendNewTxMessage(JSON.stringify(apiReturn.new_tx_to_send));
await new Promise(r => setTimeout(r, 500));
}
@ -677,11 +676,11 @@ export default class Services {
if (apiReturn.commit_to_send) {
const commit = apiReturn.commit_to_send;
this.sendCommitMessage(JSON.stringify(commit));
await this.sendCommitMessage(JSON.stringify(commit));
}
if (apiReturn.ciphers_to_send && apiReturn.ciphers_to_send.length != 0) {
this.sendCipherMessages(apiReturn.ciphers_to_send);
await this.sendCipherMessages(apiReturn.ciphers_to_send);
}
}
@ -1545,7 +1544,7 @@ export default class Services {
if (dontRetry.includes(errorMsg)) { return; }
// Wait and retry
setTimeout(async () => {
this.sendCommitMessage(JSON.stringify(content));
await this.sendCommitMessage(JSON.stringify(content));
}, 1000)
}