From 7d0ecfbb3f6e4e9491c4a2639a1f26b1ead21a2f Mon Sep 17 00:00:00 2001 From: Tyler Storm Date: Sat, 2 Mar 2019 22:19:15 -0500 Subject: [PATCH] Change State Defaults & Clear pending chain on importBlk --- Block.js | 2 +- Wallet.js | 12 +++--------- src/js/services/nanoService.js | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Block.js b/Block.js index 3c1bc1fe..a151d761 100644 --- a/Block.js +++ b/Block.js @@ -5,7 +5,7 @@ var MAIN_NET_WORK_THRESHOLD = 'ffffffc000000000' var STATE_BLOCK_PREAMBLE = '0000000000000000000000000000000000000000000000000000000000000006' var STATE_BLOCK_ZERO = '0000000000000000000000000000000000000000000000000000000000000000' -module.exports = function (isState = false) { +module.exports = function (isState = true) { var api = {} // public methods var type // block type var state = isState // if this is a state block diff --git a/Wallet.js b/Wallet.js index d93dd28d..de3a88aa 100644 --- a/Wallet.js +++ b/Wallet.js @@ -761,8 +761,9 @@ module.exports = function (password) { api.lastBlockIsState = function () { if (lastBlock) { return api.getBlockFromHash(lastBlock).isState() + } else { + throw new Error('There is no previous block synced!') } - return false } api.getBlockFromHash = function (blockHash) { @@ -1123,14 +1124,7 @@ module.exports = function (password) { lastPendingBlock = blk.getHash(true) keys[current].lastPendingBlock = blk.getHash(true) - // check if there is a conflicting block pending - for (var i in pendingBlocks) { - if (pendingBlocks[i].getPrevious() === blk.getPrevious()) { - // conflict - priv.fixPreviousChange(blk.getPrevious(), blk.getHash(true), acc) - } - } - + pendingBlocks = [] pendingBlocks.push(blk) walletPendingBlocks.push(blk) priv.save() diff --git a/src/js/services/nanoService.js b/src/js/services/nanoService.js index 192edfe0..afb8ce85 100644 --- a/src/js/services/nanoService.js +++ b/src/js/services/nanoService.js @@ -9,7 +9,7 @@ angular.module('canoeApp.services') defaultRepresentative: null, servermessage: null, // { title: 'Hey', body: 'Rock on', link: 'http://getcanoe.io' } stateblocks: { - enable: false + enable: true } }