Skip to content

Commit

Permalink
code refactoring #2
Browse files Browse the repository at this point in the history
  • Loading branch information
ibudisteanu committed Dec 24, 2019
1 parent ae7fc2e commit 5a73e72
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ class InterfaceBlockchainBlockDataTransactions {

for (let i=0; i<this.transactions.length; i++) {

if (typeof blockValidationType === 'undefined') {
if ( !blockValidationType )
blockValidationType = {};
}


blockValidationType['take-transactions-list-in-consideration'] = {
validation : true,
Expand Down Expand Up @@ -199,14 +199,14 @@ class InterfaceBlockchainBlockDataTransactions {
return offset;
}

_processBlockDataTransaction(blockHeight, transaction, multiplicationFactor = 1 , minerAddress = undefined, revertActions = undefined, showUpdate) {
_processBlockDataTransaction(blockHeight, transaction, multiplicationFactor = 1 , minerAddress , revertActions , showUpdate) {

//skipping checking the Transaction in case it requires reverting
if (multiplicationFactor === 1) {
if (!transaction.validateTransactionOnce(blockHeight)) {
if (multiplicationFactor === 1)
if (!transaction.validateTransactionOnce(blockHeight))
throw {message: 'couldn\'t process the transaction ', transaction: transaction.txId };
}
}



transaction.processTransaction(multiplicationFactor, minerAddress, revertActions, showUpdate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class TransactionsDownloadManager{
if( this._transactionsQueue[txId].fails <= 2 ){

//Check if tx has socket and is still valid
if ( this._transactionsQueue[txId].socket !== undefined )
if ( this._transactionsQueue[txId].socket )
return {id:txId };
else
this.removeTransaction(txId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class PoolManagement{

await Blockchain.MinerPoolManagement.setMinerPoolStarted(false);

if (Blockchain.ServerPoolManagement !== undefined)
if (Blockchain.ServerPoolManagement)
await Blockchain.ServerPoolManagement.setServerPoolStarted(false);

}
Expand Down
6 changes: 3 additions & 3 deletions src/node/webrtc/web-peer/node-web-peer-webRTC.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class NodeWebPeerRTC {

},
(error) => {
resolve({result:false, message: "Generating Initiator - Error Setting Local Description " +(error !== undefined ? error.toString() : '')});
resolve({result:false, message: "Generating Initiator - Error Setting Local Description " +(error ? error.toString() : '')});
console.error("Generating Initiator - Error Setting Local Description ", error);
}
);
Expand Down Expand Up @@ -350,7 +350,7 @@ class NodeWebPeerRTC {

this.peer.oniceconnectionstatechange = function() {

if (this.peer !== undefined && this.peer.iceConnectionState === 'disconnected') {
if (this.peer && this.peer.iceConnectionState === 'disconnected') {

console.log('iceConnection Disconnected');
if (this.peer.connected === true) {
Expand Down Expand Up @@ -399,7 +399,7 @@ class NodeWebPeerRTC {
done = true;

for (let i=0; i < chunks; i++)
if (message.chunks[i] === undefined){
if ( !message.chunks[i] ){
done = false;
break;
}
Expand Down

0 comments on commit 5a73e72

Please sign in to comment.