add db beginTransaction and dispose to hunter

This commit is contained in:
andri lim 2019-01-21 20:44:42 +07:00 committed by zah
parent 3619090cb4
commit c3190f0c7a
1 changed files with 5 additions and 0 deletions

View File

@ -50,6 +50,9 @@ proc prepareBlockEnv(parent: BlockHeader, thisBlock: Block): TrieDatabaseRef =
let codeStr = request("eth_getCode", %[%address.prefixHex, parentNumber])
let code = hexToSeqByte(codeStr.getStr).toRange
accountDB.setCode(address, code)
accountDB.setAccount(address, acc)
result = memoryDB
proc huntProblematicBlock(blockNumber: Uint256): ValidationResult =
@ -66,10 +69,12 @@ proc huntProblematicBlock(blockNumber: Uint256): ValidationResult =
chainDB.setHead(parentBlock.header, true)
let
transaction = memoryDB.beginTransaction()
vmState = newBaseVMState(parentBlock.header, chainDB)
validationResult = processBlock(chainDB, parentBlock.header, thisBlock.header, thisBlock.body, vmState)
if validationResult != ValidationResult.OK:
transaction.dispose()
dumpDebuggingMetaData(chainDB, thisBlock.header, thisBlock.body, vmState.receipts, false)
result = validationResult