**Motivations:** - Anchor API requests were being aborted with 'This operation was aborted' error - API anchorage had performance issues causing long response times (30-60s) - Mutex could block indefinitely if a previous request crashed or timed out **Root causes:** - No timeout on mutex acquisition, causing indefinite blocking - Sequential RPC calls (8+ getNewAddress calls) instead of parallel - Expensive fee calculation making N RPC calls (one per input) instead of using known UTXO amounts - RPC timeout too short (30s) for slow Bitcoin node operations - No guarantee of mutex release in error cases **Correctifs:** - Added 180s timeout on mutex acquisition with Promise.race() to prevent indefinite blocking - Parallelized getNewAddress() calls with Promise.all() (9 sequential calls → 1 parallel call) - Optimized fee calculation to use known UTXO amounts instead of getRawTransaction() per input (saves N RPC calls, up to 20+) - Increased RPC timeout from 30s to 120s in .env.example - Added finally block to guarantee mutex release in all cases (success, error, timeout) - Added timeout and explicit error handling in api-filigrane callAnchorAPI() with AbortController (120s timeout) **Evolutions:** - Performance improvement: execution time reduced from ~30-60s to ~10-20s - RPC calls reduction: from ~15-35 calls to ~8-12 calls per anchor transaction - Better resilience: mutex cannot block indefinitely anymore - Improved error messages with explicit timeout/abort information **Pages affectées:** - api-anchorage/src/bitcoin-rpc.js: mutex timeout, parallel address generation, optimized fee calculation, finally block - api-anchorage/.env.example: increased RPC timeout to 120s - api-filigrane/src/routes/watermark.js: timeout and error handling for anchor API calls - fixKnowledge/api-filigrane-anchor-request-aborted.md: documentation of issues and fixes
UserWallet Login
Site de login avec authentification secp256k1, conçu pour être utilisé en iframe par Channel Messages.
Fonctionnalités
- Authentification basée sur des clés secp256k1
- Communication avec le parent via
postMessage - Gestion de l'activation/désactivation du login par service
- Interface responsive et accessible
Installation
npm install
Développement
npm run dev
Le site sera accessible sur http://localhost:3018
Build
npm run build
Architecture
- Authentification : Génération de paires de clés secp256k1, signature de challenges
- Communication iframe : Messages
postMessagepour l'intégration - Stockage : LocalStorage pour les clés et la configuration des services
- Interface : React + TypeScript avec accessibilité (ARIA)
Types de messages iframe
auth-request: Demande d'authentification depuis le parentauth-response: Réponse avec signatureservice-toggle: Activation/désactivation d'un serviceservice-status: Envoi du statut des services