Skip to content

Commit dc2c99e

Browse files
committed
client, vm -> vm execution: removed stateDB from LightEthereumService, removed checkpointing exception for zero tx blocks in VM.runBlocks()
1 parent bd32047 commit dc2c99e

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

packages/client/lib/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export default class EthereumClient extends events.EventEmitter {
6464
: new LightEthereumService({
6565
config: this.config,
6666
chainDB: options.chainDB,
67-
stateDB: options.stateDB,
6867
}),
6968
]
7069
this.opened = false

packages/vm/lib/runBlock.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,26 +149,19 @@ export default async function runBlock(this: VM, opts: RunBlockOpts): Promise<Ru
149149
}
150150

151151
// Checkpoint state
152-
// (only do checkpointing when txs are executed)
153-
// TODO: determine if checkpointing is needed in a block
154-
// context at all or CPs in runTx() are sufficient
155-
if (block.transactions.length > 0) {
156-
await state.checkpoint()
157-
}
152+
await state.checkpoint()
153+
158154
let result
159155
try {
160156
result = await applyBlock.bind(this)(block, opts)
161157
} catch (err) {
162-
if (block.transactions.length > 0) {
163-
await state.revert()
164-
}
158+
await state.revert()
165159
throw err
166160
}
167161

168162
// Persist state
169-
if (block.transactions.length > 0) {
170-
await state.commit()
171-
}
163+
await state.commit()
164+
172165
const stateRoot = await state.getStateRoot(false)
173166

174167
// Given the generate option, either set resulting header

0 commit comments

Comments
 (0)