From 471b44243428aafd29a12669f14535ee0cc791b4 Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Tue, 5 Feb 2019 15:19:56 +0000 Subject: [PATCH 1/2] fix block height reference Signed-off-by: Karoly Albert Szabo --- app/src/renderer/vuex/modules/blocks.js | 3 +++ test/unit/specs/store/blocks.spec.js | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/renderer/vuex/modules/blocks.js b/app/src/renderer/vuex/modules/blocks.js index cb1a102820..d9eeaeef5d 100644 --- a/app/src/renderer/vuex/modules/blocks.js +++ b/app/src/renderer/vuex/modules/blocks.js @@ -97,6 +97,9 @@ export default ({ node }) => { node.rpc.subscribe({ query: `tm.event = 'NewBlock'` }, event => { if (state.subscription === false) commit(`setSubscription`, true) commit(`addBlock`, event.block) + event.block && + event.block.header && + commit(`setBlockHeight`, event.block.header.height) }) return true diff --git a/test/unit/specs/store/blocks.spec.js b/test/unit/specs/store/blocks.spec.js index 57e66e68b5..739baf0e1b 100644 --- a/test/unit/specs/store/blocks.spec.js +++ b/test/unit/specs/store/blocks.spec.js @@ -145,10 +145,10 @@ describe(`Module: Blocks`, () => { } }), subscribe: (query, cb) => { - cb({ block: `subscribe here` }) + cb({ block: { header: { height: 1 } } }) expect(commit).toBeCalledWith(`setSubscription`, true) module.state.subscription = true - cb({ block: `already subscribed` }) + cb({ block: { header: { height: 2 } } }) } } } @@ -167,8 +167,10 @@ describe(`Module: Blocks`, () => { [`setSyncing`, false], [`setBlocks`, []], [`setSubscription`, true], - [`addBlock`, `subscribe here`], - [`addBlock`, `already subscribed`] + [`addBlock`, { header: { height: 1 } }], + [`setBlockHeight`, 1], + [`addBlock`, { header: { height: 2 } }], + [`setBlockHeight`, 2] ]) }) From 8e4ca7c162612ccc04f4a382e1ebbb0bbee9c26e Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Tue, 5 Feb 2019 15:22:13 +0000 Subject: [PATCH 2/2] fix changelog Signed-off-by: Karoly Albert Szabo --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af90950969..905b8670bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1338](https://github.com/cosmos/voyager/issues/1338) Add Ledger Nano S support for signing transactions @fedekunze - [\#1869](https://github.com/cosmos/voyager/issues/1869) Added PageNetwork @jbibla - [\#1894](https://github.com/cosmos/voyager/issues/1894) Added favicons for all the browsers and devices @jbibla +- [\#1865](https://github.com/cosmos/voyager/issues/1865) Added Vuex blocks module @sabau ### Changed