diff --git a/src/validation/status.rs b/src/validation/status.rs index 6b22e559..68ccd830 100644 --- a/src/validation/status.rs +++ b/src/validation/status.rs @@ -390,9 +390,6 @@ pub enum Warning { ExcessiveOperation(OpId), /// terminal witness transaction {0} is not yet mined. TerminalWitnessNotMined(Txid), - /// anchor for operation {0} is not found in the index. This is possible an - /// internal bug of RGB Core library. - AnchorNotFound(OpId), /// Custom warning by external services on top of RGB Core. #[display(inner)] diff --git a/src/validation/validator.rs b/src/validation/validator.rs index 0208c96b..d8eb5ecb 100644 --- a/src/validation/validator.rs +++ b/src/validation/validator.rs @@ -23,7 +23,7 @@ use std::collections::{BTreeMap, BTreeSet, VecDeque}; use bp::dbc::Anchor; -use bp::seals::txout::Witness; +use bp::seals::txout::{TxPtr, Witness}; use bp::{Tx, Txid}; use commit_verify::mpc; use single_use_seals::SealWitness; @@ -411,15 +411,17 @@ impl<'consignment, 'resolver, C: ConsignmentApi, R: ResolveTx> continue }; - match self.anchor_index.get(&op) { - Some(anchor) => { + let seal = match (seal.txid, self.anchor_index.get(&op)) { + (TxPtr::WitnessTx, Some(anchor)) => { let prev_witness_txid = anchor.txid; - seals.push(seal.resolve(prev_witness_txid)) + seal.resolve(prev_witness_txid) } - None => { - self.status.add_warning(Warning::AnchorNotFound(op)); + (TxPtr::WitnessTx, None) => { + panic!("anchor for the operation {op} was not indexed by the validator"); } - } + (TxPtr::Txid(txid), _) => seal.resolve(txid), + }; + seals.push(seal) } let message = mpc::Message::from(bundle_id);