From f54248bc2f5a62a51e08157e71bdb329f22b740b Mon Sep 17 00:00:00 2001 From: wendyamoni-creator Date: Mon, 27 Jul 2026 08:29:56 +0000 Subject: [PATCH] fix(api): gracefully handle unsupported ScAddress variants (#89) address_to_string previously returned an Err for any address variant other than Ed25519 Account or Contract, which would propagate via ? through scval_to_json and abort the entire refresh cycle. Replace the error arm with a warn! log + an 'unknown:' placeholder string so the decode succeeds and the indexer cycle continues normally. Fixes #89 --- api/src/indexer/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/src/indexer/mod.rs b/api/src/indexer/mod.rs index cd4d5e6..179a65f 100644 --- a/api/src/indexer/mod.rs +++ b/api/src/indexer/mod.rs @@ -484,9 +484,14 @@ fn address_to_string(a: &xdr::ScAddress) -> Result { xdr::ScAddress::Contract(xdr::ContractId(xdr::Hash(bytes))) => { Ok(stellar_strkey::Contract(*bytes).to_string()) } - other => Err(IndexError::Decode(format!( - "unsupported address: {other:?}" - ))), + // Muxed accounts and any future address variants are not expected from + // these contracts, but returning an error here would abort the entire + // refresh cycle via `?`. Emit a recognisable placeholder so callers + // can still process the rest of the response. + other => { + tracing::warn!("address_to_string: unsupported address variant, using placeholder: {other:?}"); + Ok(format!("unknown:{other:?}")) + } } }