Zebra/zebra-state/src
Janito Vaqueiro Ferreira Filho ebd94b2e60
Fix deadlock in chain tip watch channel (#3378)
* Avoid sequential borrows in `LatestChainTip`

Calling `watch::Receiver::borrow` more than once in the same scope can
cause a deadlock. The instrumented methods were calling `borrow` twice
to record instrumented fields.

This refactors things to ensure `borrow` is only called once to record
the fields and perform any actions with the chain tip block.

* Remove `borrow()` calls in `ChainTipChange`

Refactor to use a `LatestChainTip` instance instead, which safely
protects the internal `watch::Receiver` so that it is not borrowed more
than once in the same scope.

* Add a paragraph to the Asynchronous guide

Warn against using two borrow guards in the same scope, and describe why
that can lead to a deadlock.
2022-01-24 00:36:40 +00:00
..
service Fix deadlock in chain tip watch channel (#3378) 2022-01-24 00:36:40 +00:00
tests Validate transaction lock times (#3060) 2021-11-23 05:53:53 +00:00
arbitrary.rs Reset `ChainTipChange`s on chain fork and network upgrade activation (#2721) 2021-09-02 12:25:42 +10:00
config.rs Replace `tempdir` dependency with `tempfile` (#3337) 2022-01-14 15:11:23 +00:00
constants.rs Fix interstitial sprout anchors check (#3283) 2022-01-18 20:18:49 +00:00
error.rs Validate sapling, orchard anchors (#3084) 2021-11-30 16:05:35 +00:00
lib.rs Enforce Rust edition 2021 (#3332) 2022-01-14 12:10:18 +00:00
request.rs Stop calculating transaction hashes twice in the checkpoint verifier (#2696) 2021-08-31 10:55:39 +10:00
response.rs move `Utxo` type to zebra-chain (#2481) 2021-07-12 12:49:33 +10:00
service.rs Fix new clippy lints in clippy nightly (#3176) 2021-12-09 14:19:14 +00:00
tests.rs ZIP-221 and ZIP-244 commitment validation in non-finalized state (#2609) 2021-08-17 11:49:27 -03:00
util.rs swap best_chain_len and related constants to u32 for consistency (#1257) 2020-11-06 14:00:10 +10:00