Commit 5d4df4fd authored by yann300's avatar yann300

linting

parent 6c7f6638
......@@ -31,32 +31,32 @@ class StateManagerCommonStorageDump extends StateManager {
this.keyHashes = {}
}
S
putContractStorage (address, key, value) {
this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key)
return super.putContractStorage(address, key, value)
}
dumpStorage (address) {
return new Promise<StorageDump>((resolve, reject) => {
this._getStorageTrie(address).then((trie) => {
const storage = {}
const stream = trie.createReadStream()
stream.on('data', (val) => {
const value = rlp.decode(val.value)
storage['0x' + val.key.toString('hex')] = {
key: this.keyHashes[val.key.toString('hex')],
value: '0x' + value.toString('hex')
}
})
stream.on('end', function () {
resolve(storage)
putContractStorage (address, key, value) {
this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key)
return super.putContractStorage(address, key, value)
}
dumpStorage (address) {
return new Promise<StorageDump>((resolve, reject) => {
this._getStorageTrie(address).then((trie) => {
const storage = {}
const stream = trie.createReadStream()
stream.on('data', (val) => {
const value = rlp.decode(val.value)
storage['0x' + val.key.toString('hex')] = {
key: this.keyHashes[val.key.toString('hex')],
value: '0x' + value.toString('hex')
}
})
stream.on('end', function () {
resolve(storage)
})
}).catch((error) => {
reject(error)
})
}).catch((error) => {
reject(error)
})
})
}
}
async getStateRoot (force: boolean = false): Promise<Buffer> {
if (!force && this._checkpointCount !== 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment