Skip to content

Commit

Permalink
indexers: quickfix for unknown transaction detection
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 29, 2024
1 parent 1412e7e commit 8563b58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/indexers/electrum_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl RgbResolver for Client {

fn resolve_height(&mut self, txid: Txid) -> Result<WitnessAnchor, String> {
let mut witness_anchor = WitnessAnchor {
witness_ord: WitnessOrd::offchain(1),
witness_ord: WitnessOrd::Archived,
witness_id: XWitnessId::Bitcoin(txid),
};

Expand Down Expand Up @@ -104,6 +104,10 @@ impl RgbResolver for Client {
.and_then(|x| u32::try_from(x).ok())
.ok_or(Error::InvalidResponse(tx_details.clone()))
);
if confirmations == 0 {
witness_anchor.witness_ord = WitnessOrd::OffChain { priority: 1 };
return Ok(witness_anchor);
}
let block_time = check!(
tx_details
.get("blocktime")
Expand Down
3 changes: 2 additions & 1 deletion src/indexers/esplora_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ impl RgbResolver for BlockingClient {
Some((h, t)) => {
WitnessOrd::OnChain(WitnessPos::new(h, t as i64).ok_or(Error::InvalidServerData)?)
}
None => WitnessOrd::offchain(1),
// TODO: Figure out how to detect mempool transactions
None => WitnessOrd::Archived,
};
Ok(WitnessAnchor {
witness_ord: ord,
Expand Down

0 comments on commit 8563b58

Please sign in to comment.