Fixed lock order
This commit is contained in:
parent
dff7f2e8e5
commit
cb4d17825b
@ -35,3 +35,4 @@ name = "parity"
|
|||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = false
|
debug = false
|
||||||
|
lto = false
|
||||||
|
@ -433,6 +433,7 @@ impl BlockChain {
|
|||||||
batch.put(b"best", &update.info.hash).unwrap();
|
batch.put(b"best", &update.info.hash).unwrap();
|
||||||
|
|
||||||
// These cached values must be updated atomically
|
// These cached values must be updated atomically
|
||||||
|
{
|
||||||
let mut best_block = self.best_block.write().unwrap();
|
let mut best_block = self.best_block.write().unwrap();
|
||||||
let mut write_hashes = self.block_hashes.write().unwrap();
|
let mut write_hashes = self.block_hashes.write().unwrap();
|
||||||
let mut write_txs = self.transaction_addresses.write().unwrap();
|
let mut write_txs = self.transaction_addresses.write().unwrap();
|
||||||
@ -454,28 +455,35 @@ impl BlockChain {
|
|||||||
write_hashes.remove(number);
|
write_hashes.remove(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (hash, tx_address) in &update.transactions_addresses {
|
||||||
|
batch.put_extras(hash, tx_address);
|
||||||
|
write_txs.remove(hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
let mut write_details = self.block_details.write().unwrap();
|
let mut write_details = self.block_details.write().unwrap();
|
||||||
for (hash, details) in update.block_details.into_iter() {
|
for (hash, details) in update.block_details.into_iter() {
|
||||||
batch.put_extras(&hash, &details);
|
batch.put_extras(&hash, &details);
|
||||||
write_details.insert(hash, details);
|
write_details.insert(hash, details);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
let mut write_receipts = self.block_receipts.write().unwrap();
|
let mut write_receipts = self.block_receipts.write().unwrap();
|
||||||
for (hash, receipt) in &update.block_receipts {
|
for (hash, receipt) in &update.block_receipts {
|
||||||
batch.put_extras(hash, receipt);
|
batch.put_extras(hash, receipt);
|
||||||
write_receipts.remove(hash);
|
write_receipts.remove(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (hash, tx_address) in &update.transactions_addresses {
|
|
||||||
batch.put_extras(hash, tx_address);
|
|
||||||
write_txs.remove(hash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
let mut write_blocks_blooms = self.blocks_blooms.write().unwrap();
|
let mut write_blocks_blooms = self.blocks_blooms.write().unwrap();
|
||||||
for (bloom_hash, blocks_bloom) in &update.blocks_blooms {
|
for (bloom_hash, blocks_bloom) in &update.blocks_blooms {
|
||||||
batch.put_extras(bloom_hash, blocks_bloom);
|
batch.put_extras(bloom_hash, blocks_bloom);
|
||||||
write_blocks_blooms.remove(bloom_hash);
|
write_blocks_blooms.remove(bloom_hash);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// update extras database
|
// update extras database
|
||||||
self.extras_db.write(batch).unwrap();
|
self.extras_db.write(batch).unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user