mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
Avoid creating database transaction for every block (#2379)
Broadly, when importing blocks we don't need a transaction / frame per block because we can simply abort the whole update and try again with a smaller range if we find a faulty block. Of course, this applies mainly to semi-trusted blocks where we're not expected to fail in applying them - this could be blocks either from files or header-verified blocks as given by consensus.
This commit is contained in:
parent
a6960c3d0a
commit
9cf7e6aea3
@ -165,10 +165,6 @@ proc processBlock*(
|
||||
skipUncles: bool = false,
|
||||
): Result[void, string] =
|
||||
## Generalised function to processes `blk` for any network.
|
||||
var dbTx = vmState.com.db.newTransaction()
|
||||
defer:
|
||||
dbTx.dispose()
|
||||
|
||||
?vmState.procBlkPreamble(blk, skipValidation, skipReceipts, skipUncles)
|
||||
|
||||
# EIP-3675: no reward for miner in POA/POS
|
||||
@ -177,8 +173,6 @@ proc processBlock*(
|
||||
|
||||
?vmState.procBlkEpilogue(blk.header, skipValidation)
|
||||
|
||||
dbTx.commit()
|
||||
|
||||
ok()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user