Merge branch 'jangko-remove_head'

This commit is contained in:
Ștefan Talpalaru 2019-03-21 15:21:08 +01:00
commit f34f71b6eb
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
7 changed files with 7 additions and 7 deletions

View File

@ -43,7 +43,7 @@ method persistBlocks*(c: Chain, headers: openarray[BlockHeader], bodies: openarr
for i in 0 ..< headers.len:
let head = c.db.getCanonicalHead()
let vmState = newBaseVMState(head.stateRoot, headers[i], c.db)
let validationResult = processBlock(c.db, head, headers[i], bodies[i], vmState)
let validationResult = processBlock(c.db, headers[i], bodies[i], vmState)
when not defined(release):
if validationResult == ValidationResult.Error:

View File

@ -95,7 +95,7 @@ proc makeReceipt(vmState: BaseVMState, cumulativeGasUsed: GasInt, fork = FkFront
result.logs = vmState.getAndClearLogEntries()
result.bloom = logsBloom(result.logs).value.toByteArrayBE
proc processBlock*(chainDB: BaseChainDB, head, header: BlockHeader, body: BlockBody, vmState: BaseVMState): ValidationResult =
proc processBlock*(chainDB: BaseChainDB, header: BlockHeader, body: BlockBody, vmState: BaseVMState): ValidationResult =
let blockReward = 5.u256 * pow(10.u256, 18) # 5 ETH
if body.transactions.calcTxRoot != header.txRoot:

View File

@ -159,7 +159,7 @@ proc dumpBlockState*(db: BaseChainDB, header: BlockHeader, body: BlockBody, dump
for idx, uncle in body.uncles:
before.captureAccount(stateBefore, uncle.coinbase, uncleName & $idx)
discard captureChainDB.processBlock(parent, header, body, vmState)
discard captureChainDB.processBlock(header, body, vmState)
var stateAfter = vmState.accountDb

View File

@ -23,7 +23,7 @@ proc executeBlock(blockEnv: JsonNode, memoryDB: TrieDatabaseRef, blockNumber: Ui
defer: transaction.dispose()
let
vmState = newBaseVMState(parent.stateRoot, header, chainDB)
validationResult = processBlock(chainDB, parent, header, body, vmState)
validationResult = processBlock(chainDB, header, body, vmState)
if validationResult != ValidationResult.OK:
error "block validation error", validationResult

View File

@ -27,7 +27,7 @@ proc dumpDebug(chainDB: BaseChainDB, blockNumber: Uint256) =
vmState = newBaseVMState(parent.stateRoot, header, captureChainDB)
captureChainDB.setHead(parent, true)
let validationResult = processBlock(captureChainDB, parent, header, body, vmState)
let validationResult = processBlock(captureChainDB, header, body, vmState)
transaction.rollback()
dumpDebuggingMetaData(captureChainDB, header, body, vmState, false)

View File

@ -97,7 +97,7 @@ proc huntProblematicBlock(blockNumber: Uint256): ValidationResult =
defer: transaction.dispose()
let
vmState = newHunterVMState(parentBlock.header.stateRoot, thisBlock.header, chainDB)
validationResult = processBlock(chainDB, parentBlock.header, thisBlock.header, thisBlock.body, vmState)
validationResult = processBlock(chainDB, thisBlock.header, thisBlock.body, vmState)
if validationResult != ValidationResult.OK:
transaction.rollback()

View File

@ -31,7 +31,7 @@ proc validateBlock(chainDB: BaseChainDB, blockNumber: BlockNumber): BlockNumber
let
vmState = newBaseVMState(parent.stateRoot, headers[i], chainDB)
validationResult = processBlock(chainDB, parent, headers[i], bodies[i], vmState)
validationResult = processBlock(chainDB, headers[i], bodies[i], vmState)
if validationResult != ValidationResult.OK:
error "block validation error", validationResult, blockNumber = blockNumber + i.u256