v1.48.1: auditoría en frío, parche 3 — validaciones de formato, fuera el motor automático, transacciones reales como pruebas
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5npnUYgSPkAaHkdaeUqBr
This commit is contained in:
@@ -30,8 +30,15 @@
|
||||
else if(fallo && !/HTTP 404/.test(fallo.message)){ throw new Error(mensajeTxNoLlega(fallo)); }
|
||||
else { const block=await getStrict(`/api/block/${q}`); setResult({type:"block",data:block}); }
|
||||
} else if(/^\d+$/.test(q)&&parseInt(q)<1000000){
|
||||
const hash=await get(`/api/block-height/${q}`,null);
|
||||
const block=await get(`/api/block/${hash}`,null);
|
||||
// v1.48.1 (auditoría A5-05): si esa altura no existe (o el nodo no
|
||||
// contesta) no se pide «/api/block/null»: se dice.
|
||||
// Ojo: /block-height devuelve el hash en texto, no en JSON; leerlo
|
||||
// como JSON fallaba siempre y la búsqueda por altura no funcionaba.
|
||||
let hash=null;
|
||||
try{ const r=await fetchWithTimeout(`${base}/api/block-height/${q}`); if(r.ok) hash=(await r.text()).trim(); else if(r.status!==404) throw new Error(`el nodo respondió HTTP ${r.status}`); }
|
||||
catch(e){ throw new Error(`No se pudo consultar a tu nodo (${e.message}).`); }
|
||||
if(typeof hash!=="string"||!/^[0-9a-f]{64}$/i.test(hash.trim())) throw new Error(`No hay ningún bloque a la altura ${q} (la cadena todavía no llega ahí).`);
|
||||
const block=await getStrict(`/api/block/${hash.trim()}`);
|
||||
setResult({type:"block",data:block});
|
||||
} else {
|
||||
// Las monedas sin gastar se piden en modo estricto: si /utxo falla
|
||||
|
||||
Reference in New Issue
Block a user