Grab bag of cleanup (#11504)
Formatting, docs, pass TransactOptions instead of tracers.
This commit is contained in:
@@ -22,9 +22,9 @@ pub struct Config {
|
||||
/// Indicates if tracing should be enabled or not.
|
||||
/// If it's None, it will be automatically configured.
|
||||
pub enabled: bool,
|
||||
/// Preferred cache-size.
|
||||
/// Preferred cache-size (default: 15Mb).
|
||||
pub pref_cache_size: usize,
|
||||
/// Max cache-size.
|
||||
/// Max cache-size (default: 20Mb).
|
||||
pub max_cache_size: usize,
|
||||
}
|
||||
|
||||
|
||||
@@ -239,13 +239,15 @@ impl<T> TraceDatabase for TraceDB<T> where T: DatabaseExtras {
|
||||
let enacted_blooms: Vec<_> = request.enacted
|
||||
.iter()
|
||||
// all traces are expected to be found here. That's why `expect` has been used
|
||||
// instead of `filter_map`. If some traces haven't been found, it meens that
|
||||
// instead of `filter_map`. If some traces haven't been found, it means that
|
||||
// traces database is corrupted or incomplete.
|
||||
.map(|block_hash| if block_hash == &request.block_hash {
|
||||
request.traces.bloom()
|
||||
} else {
|
||||
self.traces(block_hash).expect("Traces database is incomplete.").bloom()
|
||||
})
|
||||
.map(|block_hash|
|
||||
if block_hash == &request.block_hash {
|
||||
request.traces.bloom()
|
||||
} else {
|
||||
self.traces(block_hash).expect("Traces database is incomplete.").bloom()
|
||||
}
|
||||
)
|
||||
.collect();
|
||||
|
||||
self.db.trace_blooms()
|
||||
@@ -298,18 +300,19 @@ impl<T> TraceDatabase for TraceDB<T> where T: DatabaseExtras {
|
||||
let tx_hash = self.extras.transaction_hash(block_number, tx_position)
|
||||
.expect("Expected to find transaction hash. Database is probably corrupted");
|
||||
|
||||
traces.into_iter()
|
||||
.map(|trace| LocalizedTrace {
|
||||
action: trace.action,
|
||||
result: trace.result,
|
||||
subtraces: trace.subtraces,
|
||||
trace_address: trace.trace_address.into_iter().collect(),
|
||||
transaction_number: Some(tx_position),
|
||||
transaction_hash: Some(tx_hash.clone()),
|
||||
block_number,
|
||||
block_hash,
|
||||
})
|
||||
.collect()
|
||||
traces
|
||||
.into_iter()
|
||||
.map(|trace| LocalizedTrace {
|
||||
action: trace.action,
|
||||
result: trace.result,
|
||||
subtraces: trace.subtraces,
|
||||
trace_address: trace.trace_address.into_iter().collect(),
|
||||
transaction_number: Some(tx_position),
|
||||
transaction_hash: Some(tx_hash.clone()),
|
||||
block_number,
|
||||
block_hash,
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user