Directly return None if tracing is disabled (#8504)
* Directly return None if tracing is disabled * Address gumbles: release read locks as fast as possible
This commit is contained in:
parent
2a829b1f1a
commit
7a76916143
@ -1868,6 +1868,10 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn filter_traces(&self, filter: TraceFilter) -> Option<Vec<LocalizedTrace>> {
|
||||
if !self.tracedb.read().tracing_enabled() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let start = self.block_number(filter.range.start)?;
|
||||
let end = self.block_number(filter.range.end)?;
|
||||
|
||||
@ -1887,6 +1891,10 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn trace(&self, trace: TraceId) -> Option<LocalizedTrace> {
|
||||
if !self.tracedb.read().tracing_enabled() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let trace_address = trace.address;
|
||||
self.transaction_address(trace.transaction)
|
||||
.and_then(|tx_address| {
|
||||
@ -1896,6 +1904,10 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn transaction_traces(&self, transaction: TransactionId) -> Option<Vec<LocalizedTrace>> {
|
||||
if !self.tracedb.read().tracing_enabled() {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.transaction_address(transaction)
|
||||
.and_then(|tx_address| {
|
||||
self.block_number(BlockId::Hash(tx_address.block_hash))
|
||||
@ -1904,6 +1916,10 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn block_traces(&self, block: BlockId) -> Option<Vec<LocalizedTrace>> {
|
||||
if !self.tracedb.read().tracing_enabled() {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.block_number(block)
|
||||
.and_then(|number| self.tracedb.read().block_traces(number))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user