Skip to content

Commit

Permalink
Change State Defaults & Clear pending chain on importBlk
Browse files Browse the repository at this point in the history
  • Loading branch information
Stormtv committed Mar 3, 2019
1 parent 84d1268 commit 7d0ecfb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/js/services/nanoService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 7d0ecfb

Please sign in to comment.