mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
linting and formatting fix
This commit is contained in:
@@ -97,7 +97,7 @@ class Blockchain {
|
||||
return res.json(response.data.result)
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
wlogger.error(`Error in blockchain.ts/getBestBlockHash().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getBestBlockHash().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -141,7 +141,7 @@ class Blockchain {
|
||||
return res.json(response.data.result)
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
wlogger.error(`Error in blockchain.ts/getBlockchainInfo().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getBlockchainInfo().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -172,7 +172,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getBlockCount().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getBlockCount().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -232,7 +232,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getBlockHeaderSingle().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getBlockHeaderSingle().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -284,12 +284,12 @@ class Blockchain {
|
||||
if (!routeUtils.validateArraySize(req, hashes)) {
|
||||
res.status(429) // https://github.com/Bitcoin-com/rest.bitcoin.com/issues/330
|
||||
return res.json({
|
||||
error: `Array too large.`
|
||||
error: "Array too large."
|
||||
})
|
||||
}
|
||||
|
||||
wlogger.debug(
|
||||
`Executing blockchain/getBlockHeaderBulk with these hashes: `,
|
||||
"Executing blockchain/getBlockHeaderBulk with these hashes: ",
|
||||
hashes
|
||||
)
|
||||
|
||||
@@ -325,7 +325,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getBlockHeaderBulk().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getBlockHeaderBulk().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -356,7 +356,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getChainTips().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getChainTips().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -388,7 +388,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getDifficulty().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getDifficulty().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -427,7 +427,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getMempoolEntrySingle().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getMempoolEntrySingle().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -457,12 +457,12 @@ class Blockchain {
|
||||
if (!routeUtils.validateArraySize(req, txids)) {
|
||||
res.status(429) // https://github.com/Bitcoin-com/rest.bitcoin.com/issues/330
|
||||
return res.json({
|
||||
error: `Array too large.`
|
||||
error: "Array too large."
|
||||
})
|
||||
}
|
||||
|
||||
wlogger.debug(
|
||||
`Executing blockchain/getMempoolEntry with these txids: `,
|
||||
"Executing blockchain/getMempoolEntry with these txids: ",
|
||||
txids
|
||||
)
|
||||
|
||||
@@ -498,7 +498,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getMempoolEntryBulk().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getMempoolEntryBulk().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -542,7 +542,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getMempoolAncestorsSingle().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getMempoolAncestorsSingle().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -572,7 +572,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getMempoolInfo().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getMempoolInfo().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -619,7 +619,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getRawMempool().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getRawMempool().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -675,7 +675,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getTxOut().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getTxOut().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -715,7 +715,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getTxOutProofSingle().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getTxOutProofSingle().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -738,7 +738,7 @@ class Blockchain {
|
||||
if (!routeUtils.validateArraySize(req, txids)) {
|
||||
res.status(429) // https://github.com/Bitcoin-com/rest.bitcoin.com/issues/330
|
||||
return res.json({
|
||||
error: `Array too large.`
|
||||
error: "Array too large."
|
||||
})
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ class Blockchain {
|
||||
}
|
||||
|
||||
wlogger.debug(
|
||||
`Executing blockchain/getTxOutProof with these txids: `,
|
||||
"Executing blockchain/getTxOutProof with these txids: ",
|
||||
txids
|
||||
)
|
||||
|
||||
@@ -782,7 +782,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/getTxOutProofBulk().`, err)
|
||||
wlogger.error("Error in blockchain.ts/getTxOutProofBulk().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -810,7 +810,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/verifyTxOutProofSingle().`, err)
|
||||
wlogger.error("Error in blockchain.ts/verifyTxOutProofSingle().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -832,7 +832,7 @@ class Blockchain {
|
||||
if (!routeUtils.validateArraySize(req, proofs)) {
|
||||
res.status(429) // https://github.com/Bitcoin-com/rest.bitcoin.com/issues/330
|
||||
return res.json({
|
||||
error: `Array too large.`
|
||||
error: "Array too large."
|
||||
})
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ class Blockchain {
|
||||
}
|
||||
|
||||
wlogger.debug(
|
||||
`Executing blockchain/verifyTxOutProof with these proofs: `,
|
||||
"Executing blockchain/verifyTxOutProof with these proofs: ",
|
||||
proofs
|
||||
)
|
||||
|
||||
@@ -874,7 +874,7 @@ class Blockchain {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
|
||||
wlogger.error(`Error in blockchain.ts/verifyTxOutProofBulk().`, err)
|
||||
wlogger.error("Error in blockchain.ts/verifyTxOutProofBulk().", err)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
|
||||
+49
-30
@@ -153,6 +153,7 @@ describe("#BlockchainRouter2", () => {
|
||||
assert.isString(result)
|
||||
assert.equal(result.length, 64, "Hash string is fixed length")
|
||||
})
|
||||
})
|
||||
|
||||
describe("getBlockchainInfo()", () => {
|
||||
it("should throw 503 when network issues", async () => {
|
||||
@@ -254,6 +255,7 @@ describe("#BlockchainRouter2", () => {
|
||||
"Error message expected"
|
||||
)
|
||||
})
|
||||
|
||||
it("returns proper error when downstream service stalls", async () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNABORTED" })
|
||||
@@ -297,7 +299,6 @@ describe("#BlockchainRouter2", () => {
|
||||
assert.isNumber(result)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("getBlockHeaderSingle()", async () => {
|
||||
it("should throw 400 error if hash is missing", async () => {
|
||||
@@ -898,7 +899,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Manipulate the URL to cause a 500 network error.
|
||||
process.env.RPC_BASEURL = "http://fakeurl/api/"
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getMempoolEntrySingle(req, res)
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
@@ -917,7 +919,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNABORTED" })
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getMempoolEntrySingle(req, res)
|
||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||
@@ -933,7 +936,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNREFUSED" })
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getMempoolEntrySingle(req, res)
|
||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||
@@ -954,7 +958,8 @@ describe("#BlockchainRouter2", () => {
|
||||
})
|
||||
}
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getMempoolEntrySingle(req, res)
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
@@ -979,7 +984,8 @@ describe("#BlockchainRouter2", () => {
|
||||
})
|
||||
|
||||
it("should error on non-array single txid", async () => {
|
||||
req.body.txids = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.body.txids =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getMempoolEntryBulk(req, res)
|
||||
|
||||
@@ -1008,7 +1014,7 @@ describe("#BlockchainRouter2", () => {
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNABORTED" })
|
||||
|
||||
req.body.txids = [
|
||||
`d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
]
|
||||
|
||||
const result = await uut.getMempoolEntryBulk(req, res)
|
||||
@@ -1026,7 +1032,7 @@ describe("#BlockchainRouter2", () => {
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNREFUSED" })
|
||||
|
||||
req.body.txids = [
|
||||
`d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
]
|
||||
|
||||
const result = await uut.getMempoolEntryBulk(req, res)
|
||||
@@ -1046,7 +1052,7 @@ describe("#BlockchainRouter2", () => {
|
||||
// integration test.
|
||||
it("should retrieve single mempool entry", async () => {
|
||||
req.body.txids = [
|
||||
`d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
]
|
||||
|
||||
const result = await uut.getMempoolEntryBulk(req, res)
|
||||
@@ -1062,8 +1068,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// integration test.
|
||||
it("should retrieve multiple mempool entries", async () => {
|
||||
req.body.txids = [
|
||||
`d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`,
|
||||
`d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde",
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
]
|
||||
|
||||
const result = await uut.getMempoolEntryBulk(req, res)
|
||||
@@ -1091,7 +1097,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Manipulate the URL to cause a 500 network error.
|
||||
process.env.RPC_BASEURL = "http://fakeurl/api/"
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getMempoolAncestorsSingle(req, res)
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
@@ -1110,7 +1117,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNABORTED" })
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getMempoolAncestorsSingle(req, res)
|
||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||
@@ -1126,7 +1134,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNREFUSED" })
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getMempoolAncestorsSingle(req, res)
|
||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||
@@ -1143,7 +1152,8 @@ describe("#BlockchainRouter2", () => {
|
||||
.stub(uut.axios, "request")
|
||||
.resolves({ data: { result: mockData.mockAncestors } })
|
||||
|
||||
req.params.txid = `bb0d349892d351da2767f8c45f6f7949713ff09bd12838d53e76158ddee3ce93`
|
||||
req.params.txid =
|
||||
"bb0d349892d351da2767f8c45f6f7949713ff09bd12838d53e76158ddee3ce93"
|
||||
|
||||
const result = await uut.getMempoolAncestorsSingle(req, res)
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
@@ -1161,7 +1171,7 @@ describe("#BlockchainRouter2", () => {
|
||||
})
|
||||
|
||||
it("should throw 400 if n is empty", async () => {
|
||||
req.params.txid = `sometxid`
|
||||
req.params.txid = "sometxid"
|
||||
const result = await uut.getTxOut(req, res)
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
|
||||
@@ -1176,7 +1186,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Manipulate the URL to cause a 500 network error.
|
||||
process.env.RPC_BASEURL = "http://fakeurl/api/"
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
req.params.n = 0
|
||||
|
||||
const result = await uut.getTxOut(req, res)
|
||||
@@ -1197,7 +1208,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNABORTED" })
|
||||
|
||||
req.params.txid = `197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d`
|
||||
req.params.txid =
|
||||
"197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d"
|
||||
req.params.n = 0
|
||||
req.query.include_mempool = "true"
|
||||
|
||||
@@ -1215,7 +1227,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNREFUSED" })
|
||||
|
||||
req.params.txid = `197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d`
|
||||
req.params.txid =
|
||||
"197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d"
|
||||
req.params.n = 0
|
||||
req.query.include_mempool = "true"
|
||||
|
||||
@@ -1238,7 +1251,8 @@ describe("#BlockchainRouter2", () => {
|
||||
.resolves({ data: { result: mockData.mockTxOut } })
|
||||
}
|
||||
|
||||
req.params.txid = `197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d`
|
||||
req.params.txid =
|
||||
"197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d"
|
||||
req.params.n = 0
|
||||
req.query.include_mempool = "true"
|
||||
|
||||
@@ -1278,7 +1292,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Manipulate the URL to cause a 500 network error.
|
||||
process.env.RPC_BASEURL = "http://fakeurl/api/"
|
||||
|
||||
req.params.txid = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.params.txid =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getTxOutProofSingle(req, res)
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
@@ -1297,7 +1312,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNABORTED" })
|
||||
|
||||
req.params.txid = `197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d`
|
||||
req.params.txid =
|
||||
"197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d"
|
||||
req.params.n = 0
|
||||
req.query.include_mempool = "true"
|
||||
|
||||
@@ -1315,7 +1331,8 @@ describe("#BlockchainRouter2", () => {
|
||||
// Mock the timeout error.
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNREFUSED" })
|
||||
|
||||
req.params.txid = `197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d`
|
||||
req.params.txid =
|
||||
"197dcda59864b1eee05498fd3c52cad787ec56ab7e635503cb39f9ab6f295d5d"
|
||||
req.params.n = 0
|
||||
req.query.include_mempool = "true"
|
||||
|
||||
@@ -1338,7 +1355,8 @@ describe("#BlockchainRouter2", () => {
|
||||
.resolves({ data: { result: mockData.mockTxOutProof } })
|
||||
}
|
||||
|
||||
req.params.txid = `2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266`
|
||||
req.params.txid =
|
||||
"2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266"
|
||||
|
||||
const result = await uut.getTxOutProofSingle(req, res)
|
||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||
@@ -1361,7 +1379,8 @@ describe("#BlockchainRouter2", () => {
|
||||
})
|
||||
|
||||
it("should error on non-array single txid", async () => {
|
||||
req.body.txids = `d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde`
|
||||
req.body.txids =
|
||||
"d65881582ff2bff36747d7a0d0e273f10281abc8bd5c15df5d72f8f3fa779cde"
|
||||
|
||||
const result = await uut.getTxOutProofBulk(req, res)
|
||||
|
||||
@@ -1390,7 +1409,7 @@ describe("#BlockchainRouter2", () => {
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNABORTED" })
|
||||
|
||||
req.body.txids = [
|
||||
`2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266`
|
||||
"2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266"
|
||||
]
|
||||
|
||||
const result = await uut.getTxOutProofBulk(req, res)
|
||||
@@ -1408,7 +1427,7 @@ describe("#BlockchainRouter2", () => {
|
||||
sandbox.stub(uut.axios, "request").throws({ code: "ECONNREFUSED" })
|
||||
|
||||
req.body.txids = [
|
||||
`2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266`
|
||||
"2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266"
|
||||
]
|
||||
|
||||
const result = await uut.getTxOutProofBulk(req, res)
|
||||
@@ -1431,7 +1450,7 @@ describe("#BlockchainRouter2", () => {
|
||||
}
|
||||
|
||||
req.body.txids = [
|
||||
`2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266`
|
||||
"2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266"
|
||||
]
|
||||
|
||||
const result = await uut.getTxOutProofBulk(req, res)
|
||||
@@ -1450,8 +1469,8 @@ describe("#BlockchainRouter2", () => {
|
||||
}
|
||||
|
||||
req.body.txids = [
|
||||
`2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266`,
|
||||
`2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266`
|
||||
"2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266",
|
||||
"2c7ae9f865f7ce0c33c189b2f83414176903ce4b06ed9f8b7bcf55efbd4a7266"
|
||||
]
|
||||
|
||||
const result = await uut.getTxOutProofBulk(req, res)
|
||||
|
||||
Reference in New Issue
Block a user