aboutsummaryrefslogtreecommitdiff
path: root/api/routes/receiveZChain/index.js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-03-31 02:30:11 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-03-31 02:30:11 +0300
commit7257ae0bf26f85082c5a5a5ed505a55d49c0d2ac (patch)
treed88185ee32cdd1b9c1547c99bf1028abe5e7d5b7 /api/routes/receiveZChain/index.js
parentbc99d5f59de11e712fd47c1f30c31996f50ef5d0 (diff)
downloadarching-kaos-tools-7257ae0bf26f85082c5a5a5ed505a55d49c0d2ac.tar.gz
arching-kaos-tools-7257ae0bf26f85082c5a5a5ed505a55d49c0d2ac.tar.bz2
arching-kaos-tools-7257ae0bf26f85082c5a5a5ed505a55d49c0d2ac.zip
Fixed ZblockValidator an ZchainValidator
Diffstat (limited to 'api/routes/receiveZChain/index.js')
-rw-r--r--api/routes/receiveZChain/index.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/api/routes/receiveZChain/index.js b/api/routes/receiveZChain/index.js
index 85d1854..6915842 100644
--- a/api/routes/receiveZChain/index.js
+++ b/api/routes/receiveZChain/index.js
@@ -1,4 +1,24 @@
/*
+ * After NS validation went through we examine the return code
+ * of the application that run the test.
+ *
+ * Returns:
+ * - errno on failure
+ * - on success we process with addNSEntriesToFile()
+ *
+ */
+function continuethingsNS(validitycode,sh,res,gotit){
+ if (validitycode === 0){
+ var entry = {
+ zchain: sh,
+ latest: JSON.parse(gotit).Path.replace('/ipfs/','')
+ };
+ addNSEntriesToFile(entry,res);
+ } else {
+ res.send({errno:"Invalid data"});
+ }
+}
+/*
* Accepts a zchain
*
* Checks:
@@ -12,6 +32,7 @@
* function getNSvalidity()
*
*/
+const getNSvalidity = require('../../validators/ZchainValidator')
module.exports = (req, res) => {
if ( (req.body.zchain) && req.body.zchain.length === 62 ){//&& req.body.block_signature.length === 46){