mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
refactor: replace var with const/let for scope safety
This commit is contained in:
parent
df182a742c
commit
761b042312
1 changed files with 8 additions and 8 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
// makeTest generates a test for the configured tracer by running
|
// makeTest generates a test for the configured tracer by running
|
||||||
// a prestate reassembled and a call trace run, assembling all the
|
// a prestate reassembled and a call trace run, assembling all the
|
||||||
// gathered information into a test case.
|
// gathered information into a test case.
|
||||||
var makeTest = function(tx, traceConfig) {
|
const makeTest = function(tx, traceConfig) {
|
||||||
// Generate the genesis block from the block, transaction and prestate data
|
// Generate the genesis block from the block, transaction and prestate data
|
||||||
var block = eth.getBlock(eth.getTransaction(tx).blockHash);
|
const block = eth.getBlock(eth.getTransaction(tx).blockHash);
|
||||||
var genesis = eth.getBlock(block.parentHash);
|
let genesis = eth.getBlock(block.parentHash);
|
||||||
|
|
||||||
delete genesis.gasUsed;
|
delete genesis.gasUsed;
|
||||||
delete genesis.logsBloom;
|
delete genesis.logsBloom;
|
||||||
|
|
@ -21,8 +21,8 @@ var makeTest = function(tx, traceConfig) {
|
||||||
genesis.timestamp = genesis.timestamp.toString();
|
genesis.timestamp = genesis.timestamp.toString();
|
||||||
|
|
||||||
genesis.alloc = debug.traceTransaction(tx, {tracer: "prestateTracer"});
|
genesis.alloc = debug.traceTransaction(tx, {tracer: "prestateTracer"});
|
||||||
for (var key in genesis.alloc) {
|
for (const key in genesis.alloc) {
|
||||||
var nonce = genesis.alloc[key].nonce;
|
const nonce = genesis.alloc[key].nonce;
|
||||||
if (nonce) {
|
if (nonce) {
|
||||||
genesis.alloc[key].nonce = nonce.toString();
|
genesis.alloc[key].nonce = nonce.toString();
|
||||||
}
|
}
|
||||||
|
|
@ -30,10 +30,10 @@ var makeTest = function(tx, traceConfig) {
|
||||||
genesis.config = admin.nodeInfo.protocols.eth.config;
|
genesis.config = admin.nodeInfo.protocols.eth.config;
|
||||||
|
|
||||||
// Generate the call trace and produce the test input
|
// Generate the call trace and produce the test input
|
||||||
var result = debug.traceTransaction(tx, traceConfig);
|
const result = debug.traceTransaction(tx, traceConfig);
|
||||||
delete result.time;
|
delete result.time;
|
||||||
|
|
||||||
var context = {
|
const context = {
|
||||||
number: block.number.toString(),
|
number: block.number.toString(),
|
||||||
difficulty: block.difficulty,
|
difficulty: block.difficulty,
|
||||||
timestamp: block.timestamp.toString(),
|
timestamp: block.timestamp.toString(),
|
||||||
|
|
@ -51,4 +51,4 @@ var makeTest = function(tx, traceConfig) {
|
||||||
result: result,
|
result: result,
|
||||||
tracerConfig: traceConfig.tracerConfig,
|
tracerConfig: traceConfig.tracerConfig,
|
||||||
}, null, 2));
|
}, null, 2));
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue