zebra/zebra-state
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
..
proptest-regressions/service Reject duplicate sprout nullifiers in the state (#2477) 2021-07-14 09:06:43 -03:00
src Fix deadlock in chain tip watch channel (#3378) 2022-01-24 00:36:40 +00:00
tests Add a `ChainTipChange` type to `await` chain tip changes (#2715) 2021-09-01 22:31:16 +00:00
Cargo.toml Update rocksdb (#3363) 2022-01-19 20:55:34 +00:00
build.rs ZIP-221/244 auth data commitment validation in checkpoint verifier (#2633) 2021-08-23 14:17:33 +00:00