Skip to content

Commit 3ac12e6

Browse files
committed
f fix assertion and fix one more both-same-line mutex
1 parent df44f44 commit 3ac12e6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lightning/src/chain/channelmonitor.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -4070,7 +4070,10 @@ mod tests {
40704070
fn test_prune_preimages() {
40714071
let secp_ctx = Secp256k1::new();
40724072
let logger = Arc::new(TestLogger::new());
4073-
let broadcaster = Arc::new(TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), blocks: Arc::new(Mutex::new(Vec::new()))});
4073+
let broadcaster = Arc::new(TestBroadcaster {
4074+
txn_broadcasted: Mutex::new(Vec::new()),
4075+
blocks: Arc::new(Mutex::new(Vec::new()))
4076+
});
40744077
let fee_estimator = TestFeeEstimator { sat_per_kw: Mutex::new(253) };
40754078

40764079
let dummy_key = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());

lightning/src/sync/debug_sync.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,13 @@ impl LockMetadata {
107107

108108
#[cfg(feature = "backtrace")]
109109
{
110-
let lock_constr_location = get_construction_location(&res._lock_construction_bt);
110+
let (lock_constr_location, lock_constr_colno) =
111+
get_construction_location(&res._lock_construction_bt);
111112
LOCKS_INIT.call_once(|| { unsafe { LOCKS = Some(StdMutex::new(HashMap::new())); } });
112113
let mut locks = unsafe { LOCKS.as_ref() }.unwrap().lock().unwrap();
113-
match locks.entry(lock_constr_location.0) {
114+
match locks.entry(lock_constr_location) {
114115
hash_map::Entry::Occupied(e) => {
115-
assert_eq!(lock_constr_location.1,
116+
assert_eq!(lock_constr_colno,
116117
get_construction_location(&e.get()._lock_construction_bt).1,
117118
"Because Windows doesn't support column number results in backtraces, we cannot construct two mutexes on the same line or we risk lockorder detection false positives.");
118119
return Arc::clone(e.get())

0 commit comments

Comments
 (0)