|
|
|
@ -96,9 +96,7 @@ class LokiMessageAPI {
|
|
|
|
|
const timestamp = Date.now();
|
|
|
|
|
const nonce = await calcNonce(
|
|
|
|
|
messageEventData,
|
|
|
|
|
window.getEnvironment() === 'production'
|
|
|
|
|
? pubKey
|
|
|
|
|
: pubKey.substring(0, pubKey.length - 2),
|
|
|
|
|
window.getStoragePubKey(pubKey),
|
|
|
|
|
data64,
|
|
|
|
|
timestamp,
|
|
|
|
|
ttl
|
|
|
|
@ -216,22 +214,8 @@ class LokiMessageAPI {
|
|
|
|
|
let successiveFailures = 0;
|
|
|
|
|
while (successiveFailures < MAX_ACCEPTABLE_FAILURES) {
|
|
|
|
|
await sleepFor(successiveFailures * 500);
|
|
|
|
|
let result;
|
|
|
|
|
try {
|
|
|
|
|
if (window.getEnvironment() === 'production') {
|
|
|
|
|
result = await rpc(`https://${address}`, port, 'store', params);
|
|
|
|
|
} else {
|
|
|
|
|
const testnetParams = {
|
|
|
|
|
...params,
|
|
|
|
|
pubKey: params.pubKey.substring(0, params.pubKey.length - 2),
|
|
|
|
|
};
|
|
|
|
|
result = await rpc(
|
|
|
|
|
`https://${address}`,
|
|
|
|
|
port,
|
|
|
|
|
'store',
|
|
|
|
|
testnetParams
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
const result = await rpc(`https://${address}`, port, 'store', params);
|
|
|
|
|
|
|
|
|
|
// Make sure we aren't doing too much PoW
|
|
|
|
|
const currentDifficulty = window.storage.get('PoWDifficulty', null);
|
|
|
|
@ -339,12 +323,8 @@ class LokiMessageAPI {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async retrieveNextMessages(nodeUrl, nodeData) {
|
|
|
|
|
let { ourKey } = this;
|
|
|
|
|
if (window.getEnvironment() !== 'production') {
|
|
|
|
|
ourKey = ourKey.substring(0, ourKey.length - 2);
|
|
|
|
|
}
|
|
|
|
|
const params = {
|
|
|
|
|
pubKey: ourKey,
|
|
|
|
|
pubKey: this.ourKey,
|
|
|
|
|
lastHash: nodeData.lastHash || '',
|
|
|
|
|
};
|
|
|
|
|
const options = {
|
|
|
|
|