From 7257ae0bf26f85082c5a5a5ed505a55d49c0d2ac Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 31 Mar 2023 02:30:11 +0300 Subject: Fixed ZblockValidator an ZchainValidator --- api/routes/receiveZChain/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'api/routes') 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,3 +1,23 @@ +/* + * 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 * @@ -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){ -- cgit v1.2.3