mirror of
https://github.com/romanz/electrs.git
synced 2025-02-24 06:57:53 +01:00
Acquire lock closer to its usage
This commit is contained in:
parent
d0b00a84bc
commit
040e685c20
1 changed files with 1 additions and 2 deletions
|
@ -250,8 +250,6 @@ impl Daemon {
|
|||
B: IntoIterator<Item = BlockHash>,
|
||||
F: FnMut(BlockHash, Block),
|
||||
{
|
||||
let mut conn = self.p2p.lock().unwrap();
|
||||
|
||||
let blockhashes = Vec::from_iter(blockhashes);
|
||||
if blockhashes.is_empty() {
|
||||
return Ok(());
|
||||
|
@ -261,6 +259,7 @@ impl Daemon {
|
|||
.map(|h| Inventory::WitnessBlock(*h))
|
||||
.collect();
|
||||
debug!("loading {} blocks", blockhashes.len());
|
||||
let mut conn = self.p2p.lock().unwrap();
|
||||
conn.send(NetworkMessage::GetData(inv))?;
|
||||
for hash in blockhashes {
|
||||
match conn.recv()? {
|
||||
|
|
Loading…
Add table
Reference in a new issue