Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Revert "Backporting changes from development."
Browse files Browse the repository at this point in the history
This reverts commit 6e30d5f.
  • Loading branch information
Oliver Beddows committed Nov 30, 2016
1 parent ac2ebe5 commit ea2a601
Show file tree
Hide file tree
Showing 29 changed files with 220 additions and 628 deletions.
3 changes: 0 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ if (program.snapshot) {
);
}

// Define top endpoint availability
process.env.TOP = appConfig.topAccounts;

var config = {
db: appConfig.db,
modules: {
Expand Down
1 change: 0 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"logFileName": "logs/lisk.log",
"consoleLogLevel": "info",
"trustProxy": false,
"topAccounts": false,
"db": {
"host": "localhost",
"port": 5432,
Expand Down
40 changes: 0 additions & 40 deletions helpers/z_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,6 @@
var ip = require('ip');
var z_schema = require('z-schema');

z_schema.registerFormat('id', function (str) {
if (str.length === 0) {
return true;
}

return /^[0-9]+$/g.test(str);
});

z_schema.registerFormat('address', function (str) {
if (str.length === 0) {
return true;
}

return /^[0-9]+[L]$/ig.test(str);
});

z_schema.registerFormat('username', function (str) {
if (str.length === 0) {
return true;
}

return /^[a-z0-9!@$&_.]+$/ig.test(str);
});

z_schema.registerFormat('hex', function (str) {
try {
new Buffer(str, 'hex');
Expand Down Expand Up @@ -101,22 +77,6 @@ z_schema.registerFormat('ip', function (str) {
return ip.isV4Format(str);
});

z_schema.registerFormat('os', function (str) {
if (str.length === 0) {
return true;
}

return /^[a-z0-9-_.]+$/ig.test(str);
});

z_schema.registerFormat('version', function (str) {
if (str.length === 0) {
return true;
}

return /^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})([a-z]{1})?$/g.test(str);
});

// var registeredFormats = z_schema.getRegisteredFormats();
// console.log(registeredFormats);

Expand Down
3 changes: 1 addition & 2 deletions logic/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var ByteBuffer = require('bytebuffer');
var constants = require('../helpers/constants.js');
var crypto = require('crypto');
var exceptions = require('../helpers/exceptions.js');
var extend = require('extend');
var slots = require('../helpers/slots.js');
var sql = require('../sql/transactions.js');

Expand Down Expand Up @@ -821,7 +820,7 @@ Transaction.prototype.dbRead = function (raw) {
var asset = __private.types[tx.type].dbRead.call(this, raw);

if (asset) {
tx.asset = extend(tx.asset, asset);
tx.asset = _.extend(tx.asset, asset);
}

return tx;
Expand Down
3 changes: 0 additions & 3 deletions modules/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ __private.openAccount = function (secret, cb) {
}

if (account) {
if (account.publicKey == null) {
account.publicKey = publicKey;
}
return setImmediate(cb, null, account);
} else {
return setImmediate(cb, null, {
Expand Down
9 changes: 0 additions & 9 deletions modules/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,15 +502,6 @@ Blocks.prototype.getCommonBlock = function (peer, height, cb) {
}
});
},
function (res, waterCb) {
library.schema.validate(res.body.common, schema.getCommonBlock, function (err) {
if (err) {
return setImmediate(waterCb, err[0].message);
} else {
return setImmediate(waterCb, null, res);
}
});
},
function (res, waterCb) {
library.db.query(sql.getCommonBlock(res.body.common.previousBlock), {
id: res.body.common.id,
Expand Down
2 changes: 1 addition & 1 deletion modules/dapps.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ __private.getInstalledIds = function (cb) {
if (err) {
return setImmediate(cb, err);
} else {
var regExp = new RegExp(/[0-9]{1,20}/);
var regExp = new RegExp(/[0-9]{18,20}/);

ids = _.filter(ids, function (f) {
return regExp.test(f.toString());
Expand Down
3 changes: 1 addition & 2 deletions modules/peers.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ __private.getByFilter = function (filter, cb) {
var where = [];
var params = {};

if (filter.state >= 0) {
if (filter.state) {
where.push('"state" = ${state}');
params.state = filter.state;
}
Expand Down Expand Up @@ -216,7 +216,6 @@ Peers.prototype.inspect = function (peer) {
}

peer.port = parseInt(peer.port);
peer.port = isNaN(peer.port) ? 0 : peer.port;

if (peer.ip) {
peer.string = (peer.ip + ':' + peer.port || 'unknown');
Expand Down
7 changes: 2 additions & 5 deletions modules/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ __private.addUnconfirmedTransaction = function (transaction, sender, cb) {
if (err) {
self.removeUnconfirmedTransaction(transaction.id);
return setImmediate(cb, err);
} else if (modules.loader.syncing()) {
self.undoUnconfirmed(transaction, cb);
} else {
transaction.receivedAt = new Date();
__private.unconfirmedTransactions.push(transaction);
Expand Down Expand Up @@ -235,11 +237,6 @@ Transactions.prototype.processUnconfirmedTransaction = function (transaction, br
return setImmediate(cb, 'Missing transaction');
}

// Ignore transaction when syncing
if (modules.loader.syncing()) {
return setImmediate(cb);
}

// Check transaction indexes
if (__private.unconfirmedTransactionsIdIndex[transaction.id] !== undefined) {
library.logger.debug('Transaction is already processed: ' + transaction.id);
Expand Down
2 changes: 1 addition & 1 deletion modules/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ Transport.prototype.getFromPeer = function (peer, options, cb) {
var req = {
url: 'http://' + peer.ip + ':' + peer.port + url,
method: options.method,
headers: extend({}, __private.headers, options.headers),
headers: _.extend({}, __private.headers, options.headers),
timeout: library.config.peers.options.timeout
};

Expand Down
25 changes: 7 additions & 18 deletions schema/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ module.exports = {
properties: {
address: {
type: 'string',
format: 'address',
minLength: 1,
maxLength: 22
minLength: 1
}
},
required: ['address']
Expand All @@ -32,9 +30,7 @@ module.exports = {
properties: {
address: {
type: 'string',
format: 'address',
minLength: 1,
maxLength: 22
minLength: 1
}
},
required: ['address']
Expand All @@ -45,8 +41,7 @@ module.exports = {
properties: {
secret: {
type: 'string',
minLength: 1,
maxLength: 100
minLength: 1
}
},
required: ['secret']
Expand All @@ -57,9 +52,7 @@ module.exports = {
properties: {
address: {
type: 'string',
format: 'address',
minLength: 1,
maxLength: 22
minLength: 1
}
},
required: ['address']
Expand All @@ -70,17 +63,15 @@ module.exports = {
properties: {
secret: {
type: 'string',
minLength: 1,
maxLength: 100
minLength: 1
},
publicKey: {
type: 'string',
format: 'publicKey'
},
secondSecret: {
type: 'string',
minLength: 1,
maxLength: 100
minLength: 1
}
}
},
Expand All @@ -90,9 +81,7 @@ module.exports = {
properties: {
address: {
type: 'string',
format: 'address',
minLength: 1,
maxLength: 22
minLength: 1
}
},
required: ['address']
Expand Down
37 changes: 4 additions & 33 deletions schema/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ module.exports = {
properties: {
id: {
type: 'string',
format: 'id',
minLength: 1,
maxLength: 20
minLength: 1
}
},
required: ['id']
Expand All @@ -26,7 +24,7 @@ module.exports = {
properties: {
limit: {
type: 'integer',
minimum: 1,
minimum: 0,
maximum: 100
},
orderBy: {
Expand Down Expand Up @@ -55,38 +53,11 @@ module.exports = {
minimum: 0
},
previousBlock: {
type: 'string',
format: 'id',
minLength: 1,
maxLength: 20
type: 'string'
},
height: {
type: 'integer',
minimum: 1
type: 'integer'
}
}
},
getCommonBlock: {
id: 'blocks.getCommonBlock',
type: 'object',
properties: {
id: {
type: 'string',
format: 'id',
minLength: 1,
maxLength: 20
},
previousBlock: {
type: 'string',
format: 'id',
minLength: 1,
maxLength: 20
},
height: {
type: 'integer',
minimum: 1
}
},
required: ['id', 'previousBlock', 'height']
}
};
Loading

0 comments on commit ea2a601

Please sign in to comment.