[bitcoin core] fix getMempoolAncestors verbose param
This commit is contained in:
parent
b38bbb9513
commit
f161f7e8e2
@ -163,22 +163,17 @@ class BitcoinBackendRoutes {
|
|||||||
res.status(400).send(`invalid param txid ${txid}. must be a string of 64 char`);
|
res.status(400).send(`invalid param txid ${txid}. must be a string of 64 char`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof(verbose) !== 'string') {
|
if (typeof(verbose) !== 'string' || (verbose !== 'true' && verbose !== 'false')) {
|
||||||
res.status(400).send(`invalid param verbose ${verbose}. must be a string representing an integer`);
|
res.status(400).send(`invalid param verbose ${verbose}. must be a string ('true' | 'false')`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const verboseNumber = parseInt(verbose, 10);
|
|
||||||
if (typeof(verboseNumber) !== 'number') {
|
const ancestors = await bitcoinClient.getMempoolAncestors(txid, verbose === 'true' ? true : false);
|
||||||
res.status(400).send(`invalid param verbose ${verbose}. must be a valid integer`);
|
if (!ancestors) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const decodedTx = await bitcoinClient.getMempoolAncestors(txid, verboseNumber);
|
|
||||||
if (!decodedTx) {
|
|
||||||
res.status(400).send(`unable to get mempool ancestors for txid ${txid}`);
|
res.status(400).send(`unable to get mempool ancestors for txid ${txid}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
res.status(200).send(decodedTx);
|
res.status(200).send(ancestors);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
BitcoinBackendRoutes.handleException(e, 'getMempoolAncestors', res);
|
BitcoinBackendRoutes.handleException(e, 'getMempoolAncestors', res);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user