From bf41009c5ad17717f93b6e6ccba685f049d90868 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 9 Nov 2023 08:41:22 -0500 Subject: [PATCH] Document critical race condition due to two distinct clocks operating over the same data --- processor/src/multisigs/mod.rs | 4 ++++ processor/src/multisigs/scanner.rs | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/processor/src/multisigs/mod.rs b/processor/src/multisigs/mod.rs index 9e244c6b..4b5214c0 100644 --- a/processor/src/multisigs/mod.rs +++ b/processor/src/multisigs/mod.rs @@ -869,6 +869,10 @@ impl MultisigManager { continue; } + // TODO: Both save_forwarded_output and take_forwarded_output have to happen on the + // same clock. Right now, one occurs on Substrate block ack, one occurs on scan. + // TODO: To resolve this, this function has to create the plans for + // forwarding/refunding outputs. if let Some(instruction) = MultisigsDb::::take_forwarded_output(txn, output.balance()) { diff --git a/processor/src/multisigs/scanner.rs b/processor/src/multisigs/scanner.rs index 6908be3f..f25867e7 100644 --- a/processor/src/multisigs/scanner.rs +++ b/processor/src/multisigs/scanner.rs @@ -677,9 +677,7 @@ impl Scanner { // - This is an activation block // - This is a retirement block // - There's outputs - // as only those are blocks are meaningful and warrant obtaining synchrony over - // TODO: Consider not obtaining synchrony over the retirement block depending on how the - // hand-off is implemented on the Substrate side of things + // as only those blocks are meaningful and warrant obtaining synchrony over let is_retirement_block = ScannerDb::::retirement_block(&db, &scanner.keys[0].1) == Some(block_being_scanned); let sent_block = if has_activation || is_retirement_block || (!outputs.is_empty()) {