Bug Fixes

This commit is contained in:
Luis Fernando Molina committed 2021-11-04 14:37:29 +01:00
1 parent 198a2690cd
commit 7e0b5cdb5e
4 files changed
+11 -9

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ exports.newDesktopApp = function newDesktopApp() {
/*
We can join now the P2P Network as a client app.
*/
thisObject.p2pMetwork = SA.projects.network.modules.p2pMetwork.newNetworkModulesP2PNetwork()
thisObject.p2pMetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
await thisObject.p2pMetwork.initialize('Network Client')
/*
Here we will pick a Network Node from all users profiles available that do have a Network Node running.
@@ -5,7 +5,8 @@ exports.newNetworkModulesP2PNetworkNode = function newNetworkModulesP2PNetworkNo
let thisObject = {
node: undefined,
userPofile: undefined,
blockchainAccount: undefined,
userProfile: undefined,
/* Framework Functions */
initialize: initialize,
@@ -16,14 +17,16 @@ exports.newNetworkModulesP2PNetworkNode = function newNetworkModulesP2PNetworkNo
function finalize() {
thisObject.node = undefined
thisObject.userPofile = undefined
thisObject.blockchainAccount = undefined
thisObject.userProfile = undefined
}
async function initialize(node, userPofile) {
async function initialize(node, userProfile, blockchainAccount) {
/*
We will setup here the maps and arryas we will need to operate within the P2P Network.
*/
thisObject.node = node
thisObject.userPofile = userPofile
thisObject.userProfile = userProfile
thisObject.blockchainAccount = blockchainAccount
}
}
+2 -3
View File
@@ -64,8 +64,7 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
let config = JSON.parse(signingAccount.config)
let signatureObject = config.signature
let web3 = new SA.nodeModules.web3()
let blockchainAccount = web3.eth.accounts.recover(signatureObject)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_BLOKCHAIN_ACCOUNT.set(blockchainAccount, userProfile)
let blockchainAccount = web3.eth.accounts.recover(signatureObject)
/*
If the Signing Account is for a P2P node, we will add the node to the array of available nodes at the p2p network.
*/
@@ -88,7 +87,7 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
}
p2pNetworkNode = SA.projects.network.modules.p2pNetworkNode.newNetworkModulesP2PNetworkNode()
p2pNetworkNode.initialize(signingAccount.signingAccountChild, userProfile)
p2pNetworkNode.initialize(signingAccount.signingAccountChild, userProfile, blockchainAccount)
SA.projects.network.globals.memory.arrays.P2P_NETWORK_NODES.push(p2pNetworkNode)
}
}
@@ -106,7 +106,7 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb
We will check that the blockchain account taken from the signature matches
the one we have on record for the user profile of the Network Node we are calling.
*/
if (called.blockchainAccount !== p2pNetworkNode.userProfile.blockchainAccount) {
if (called.blockchainAccount !== p2pNetworkNode.blockchainAccount) {
console.log('[ERROR] Web Sockets Client -> stepOneResponse -> The Network Node called does not have the expected Profile Handle.')
reject()
return