Conversation
| connection: 'connection', | ||
| incommingConnection: 'incommingConnection', | ||
| nodesList: 'nodesList', | ||
| idCreation: 'idCreation', |
There was a problem hiding this comment.
should probably be idCreated
| @@ -1,5 +1,7 @@ | |||
| const _ = require('lodash'); | |||
| const RelayerService = require('./../services/relayerService.js'); | |||
| let event = require('./../relayer.js') | |||
There was a problem hiding this comment.
I do not think you use this and the name is wrong
|
|
||
| static config () { | ||
| mongoose.Promise = global.Promise; | ||
| mongoose.connect('mongodb://127.0.0.1:27017/counterfactual', { useNewUrlParser: true }); |
There was a problem hiding this comment.
The database connection should be passed as param to the node
|
|
||
| socket.on(event.idCreation, async function(data){ | ||
| await databaseManager.addToDatabase(data.counterfactualContractAddress, data) | ||
| console.log(`Identity on address ${data.counterfactualContractAddress} has been created and successfully saved on your database`) |
There was a problem hiding this comment.
It's not yet created but it has been counterfactually created
| socket.on(event.idDeployed, async function(data){ | ||
| let record = await databaseManager.findRecord(data) | ||
|
|
||
| if(record && record.status === 'notDeployed'){ |
There was a problem hiding this comment.
notDeployed should be a constant somewhere
| }, | ||
|
|
||
|
|
||
| emitIdDataOnCreation: function(data){ |
There was a problem hiding this comment.
I feel that this can very easily be confused for actual deployment as opposed to Counterfactual creation. Maybe we should rename this to emitCounterfactualIdentityData
|
|
||
| module.exports = { | ||
|
|
||
| addToDatabase: async function(counterfactualContractAddress, fullCounterfactualData){ |
There was a problem hiding this comment.
I feel these should be much more meaningful in the context - saveCounterfactualData, findCounterfactualData, etc...
| if (counterfactualData) { | ||
| let record = await databaseManager.findRecord(identityAddress) | ||
|
|
||
| if (record) { |
There was a problem hiding this comment.
Should we check if someone has already executed this counterfactual transaction?
No description provided.