From 489371ac5ea3c3c0c2d0d3f2d48da0c03eec02c9 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Sat, 1 Apr 2023 21:25:38 +0200 Subject: [PATCH 01/11] Replace forceTestnet with blockMainnet --- modules/particl-core/particlcore.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/particl-core/particlcore.js b/modules/particl-core/particlcore.js index 9f9c16e47..335ffbef9 100644 --- a/modules/particl-core/particlcore.js +++ b/modules/particl-core/particlcore.js @@ -293,7 +293,7 @@ module.exports = class ParticlCore extends CoreInstance { #binaryPath; #isDevelopmentEnvironment = false; - #forceTestnet = false; + #blockMainnet = false; // holds a reference to the spawned pacticl core process (if one is spawned) #startedDaemon = undefined; @@ -321,7 +321,7 @@ module.exports = class ParticlCore extends CoreInstance { this.#appVersion = appConfig.VERSIONS.app; this.#binaryPath = _path.join(appConfig.PATHS.binaries, 'particl'); - this.#forceTestnet = appConfig.TESTING_MODE === true; + this.#blockMainnet = appConfig.TESTING_MODE === true; this.#isDevelopmentEnvironment = appConfig.MODE === 'developer'; } @@ -984,7 +984,7 @@ module.exports = class ParticlCore extends CoreInstance { let netSettings = this.#settingsValues.mainnet; - if (this.#settingsValues.network.testnet || this.#forceTestnet) { + if (this.#settingsValues.network.testnet) { netSettings = this.#settingsValues.testnet; deamonArgs.push('-testnet'); } @@ -994,6 +994,11 @@ module.exports = class ParticlCore extends CoreInstance { deamonArgs.push('-regtest'); } + if (this.#settingsValues.network.mainnet && this.#blockMainnet) { + netSettings = this.#settingsValues.testnet; + deamonArgs.push('-testnet'); + } + if ((netSettings.coreHost !== 'localhost') && !netSettings.coreHost.startsWith('127.0.0.1')) { deamonArgs.push(`-rpcbind=${netSettings.coreHost}`); deamonArgs.push(`-rpcallowip=${netSettings.coreHost}`); @@ -1229,11 +1234,14 @@ module.exports = class ParticlCore extends CoreInstance { try { if (_fs.existsSync(defaultDataDir) && _fs.statSync(defaultDataDir).isDirectory()) { const segments = [defaultDataDir]; - if (this.#settingsValues.network.testnet || this.#forceTestnet) { + if (this.#settingsValues.network.testnet) { segments.push('testnet'); } else if (this.#settingsValues.network.regtest) { segments.push('regtest'); + } else if (this.#settingsValues.network.mainnet && this.#blockMainnet) { + segments.push('testnet'); } + segments.push('.cookie'); const cookiePath = _path.join(...segments); @@ -1346,8 +1354,9 @@ module.exports = class ParticlCore extends CoreInstance { #getRpcUrl() { - return this.#settingsValues.network.testnet || this.#forceTestnet ? - `http://${this.#settingsValues.testnet.coreHost}:${this.#settingsValues.testnet.corePort}` : ( + const forceTestnet = this.#settingsValues.network.mainnet && this.#blockMainnet; + return this.#settingsValues.network.testnet || forceTestnet + ? `http://${this.#settingsValues.testnet.coreHost}:${this.#settingsValues.testnet.corePort}` : ( this.#settingsValues.network.regtest ? `http://${this.#settingsValues.regtest.coreHost}:${this.#settingsValues.regtest.corePort}` : `http://${this.#settingsValues.mainnet.coreHost}:${this.#settingsValues.mainnet.corePort}` From e9c2832db75a907d947c7b00e2216b76b4a9a04c Mon Sep 17 00:00:00 2001 From: zaSmilingIdiot <30551211+zaSmilingIdiot@users.noreply.github.com> Date: Tue, 4 Apr 2023 11:30:08 +0200 Subject: [PATCH 02/11] [wallet module] Fixes balance updates in Overview not updating correctly when a new block is received. --- src/app/networks/particl/particl.state.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/app/networks/particl/particl.state.ts b/src/app/networks/particl/particl.state.ts index 7d34f14d9..32bfbd3f6 100644 --- a/src/app/networks/particl/particl.state.ts +++ b/src/app/networks/particl/particl.state.ts @@ -349,7 +349,10 @@ export class ParticlZMQState { })); if (message.channel === 'hashblock') { - return ctx.dispatch(new ParticlActions.WalletActions.RefreshBalances); + return ctx.dispatch([ + new ParticlActions.WalletActions.RefreshBalances(), + new ParticlActions.WalletActions.RefreshWalletInfo() + ]); } } } @@ -961,14 +964,7 @@ export class WalletBalanceState { if (resKey in currentState) { if (!result[resKey].length) { updatedValues[resKey] = []; - } else if ( - (currentState[resKey].length !== result[resKey].length) || - (xorWith( - currentState[resKey], - result[resKey], - (val, otherVal) => (val.txid === otherVal.txid) && (val.vout === otherVal.vout) - ).length > 0) - ) { + } else { updatedValues[resKey] = result[resKey]; } } From 67f4e8ae8e3daa8fbebfbb5576d574be5c0da168 Mon Sep 17 00:00:00 2001 From: zaSmilingIdiot <30551211+zaSmilingIdiot@users.noreply.github.com> Date: Tue, 4 Apr 2023 11:45:15 +0200 Subject: [PATCH 03/11] [market module] Update help text for the wallet locked indicator in the sidebar, and clicking on the indicator now opens the unlock wallet modal. --- src/app/main-market/base/market-base.component.html | 4 ++-- src/app/main-market/base/market-base.component.ts | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/main-market/base/market-base.component.html b/src/app/main-market/base/market-base.component.html index aedb3b6ab..4c0f77568 100644 --- a/src/app/main-market/base/market-base.component.html +++ b/src/app/main-market/base/market-base.component.html @@ -68,10 +68,10 @@