Skip to content

Commit

Permalink
null address check before deleting account from trie
Browse files Browse the repository at this point in the history
  • Loading branch information
cdetrio committed Jul 28, 2017
1 parent 9fc6e38 commit 8a554b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/cache.js
Expand Up @@ -127,6 +127,9 @@ Cache.prototype.clear = function () {
}

Cache.prototype.del = function (key) {
if (key.toString('hex') === '') {
return
}
this._deletes.push(key)
key = key.toString('hex')
this._cache = this._cache.remove(key)
Expand Down
6 changes: 4 additions & 2 deletions lib/runTx.js
Expand Up @@ -71,10 +71,12 @@ module.exports = function (opts, cb) {
function populateCache (cb) {
var accounts = new Set()
accounts.add(tx.from.toString('hex'))
accounts.add(tx.to.toString('hex'))
accounts.add(block.header.coinbase.toString('hex'))

self.stateManager.touched.push(tx.to)
if (tx.to.toString('hex') !== '') {
accounts.add(tx.to.toString('hex'))
self.stateManager.touched.push(tx.to)
}

if (opts.populateCache === false) {
return cb()
Expand Down

0 comments on commit 8a554b5

Please sign in to comment.