diff --git a/config/config.js b/config/config.js index 0b811fe0..379e9830 100644 --- a/config/config.js +++ b/config/config.js @@ -89,6 +89,7 @@ if (!fs.existsSync(db)) { } module.exports = { + version: version, root: rootPath, publicPath: process.env.INSIGHT_PUBLIC_PATH || false, appName: 'Insight ' + env, diff --git a/insight.js b/insight.js index 338f3a1e..6c41b9b7 100755 --- a/insight.js +++ b/insight.js @@ -26,32 +26,32 @@ console.log( /___/_/ /_/____/_/\\__, /_/ /_/\\__/ /_/ |_/ .___/_/ \n\ /____/ /_/ \n\ \n\t\t\t\t\t\tv%s\n\ - # Configuration:\n\ -\t\tNetwork: %s\tINSIGHT_NETWORK\n\ -\t\tDatabase Path: %s\tINSIGHT_DB\n\ -\t\tSafe Confirmations: %s\tINSIGHT_SAFE_CONFIRMATIONS\n\ -\t\tIgnore Cache: %s\tINSIGHT_IGNORE_CACHE\n\ +# Configuration:\n\ +\tINSIGHT_NETWORK (Network): %s\n\ +\tINSIGHT_DB (Database Path): %s\n\ +\tINSIGHT_SAFE_CONFIRMATIONS (Safe Confirmations): %s\n\ +\tINSIGHT_IGNORE_CACHE (Ignore Cache): %s\n\ # Bicoind Connection configuration:\n\ -\t\tRPC Username: %s\tBITCOIND_USER\n\ -\t\tRPC Password: %s\tBITCOIND_PASS\n\ -\t\tRPC Protocol: %s\tBITCOIND_PROTO\n\ -\t\tRPC Host: %s\tBITCOIND_HOST\n\ -\t\tRPC Port: %s\tBITCOIND_PORT\n\ -\t\tP2P Port: %s\tBITCOIND_P2P_PORT\n\ -\t\tData Dir: %s\tBITCOIND_DATADIR\n\ -\t\t%s\n\ -\nChange setting by assigning the enviroment variables in the last column. Example:\n\ +\tRPC Username: %s\t\tBITCOIND_USER\n\ +\tRPC Password: %s\tBITCOIND_PASS\n\ +\tRPC Protocol: %s\t\tBITCOIND_PROTO\n\ +\tRPC Host: %s\t\tBITCOIND_HOST\n\ +\tRPC Port: %s\t\t\tBITCOIND_PORT\n\ +\tP2P Port: %s\t\t\tBITCOIND_P2P_PORT\n\ +\tBITCOIND_DATADIR: %s\n\ +\t%s\n\ +\nChange setting by assigning the enviroment variables above. Example:\n\ $ INSIGHT_NETWORK="testnet" BITCOIND_HOST="123.123.123.123" ./insight.js\ \n\n', - version, - network, home, safeConfirmations, ignoreCache ? 'yes' : 'no', - bitcoindConf.user, - bitcoindConf.pass ? 'Yes(hidden)' : 'No', - bitcoindConf.protocol, - bitcoindConf.host, - bitcoindConf.port, - bitcoindConf.p2pPort, - dataDir + (network === 'testnet' ? '*' : ''), (network === 'testnet' ? '* (/testnet3 is added automatically)' : '') + config.version, + config.network, config.leveldb, config.safeConfirmations, config.ignoreCache ? 'yes' : 'no', + config.bitcoind.user, + config.bitcoind.pass ? 'Yes(hidden)' : 'No', + config.bitcoind.protocol, + config.bitcoind.host, + config.bitcoind.port, + config.bitcoind.p2pPort, + config.bitcoind.dataDir + (config.network === 'testnet' ? '*' : ''), (config.network === 'testnet' ? '* (/testnet3 is added automatically)' : '') ); /** diff --git a/lib/MessageDb.js b/lib/MessageDb.js index 0dc502e8..c8d1766f 100644 --- a/lib/MessageDb.js +++ b/lib/MessageDb.js @@ -34,7 +34,7 @@ MessageDb.prototype.close = function(cb) { var messageKey = function(from, to, ts) { - if (!ts) ts = Math.round(new Date().getTime() / 1000); + if (!ts) ts = Math.round(new Date().getTime()); return MESSAGE_PREFIX + from.toString() + '-' + to.toString() + '-' + ts; }; diff --git a/test/test.MessageDb.js b/test/test.MessageDb.js index d4a11ee8..b5012a89 100644 --- a/test/test.MessageDb.js +++ b/test/test.MessageDb.js @@ -4,6 +4,8 @@ var chai = require('chai'); var should = chai.should; var MessageDb = require('../lib/MessageDb'); +var bitcore = require('bitcore'); +var SIN = bitcore.SIN; describe('MessageDb', function() { it('should be able to create instance', function() { @@ -12,7 +14,10 @@ describe('MessageDb', function() { it('should receive events', function(done) { var mdb = new MessageDb(); var message = {}; - mdb.addMessage(message, 'from', 'to', function(err) { + var from = new SIN(new Buffer('dadbad00', 'hex')); + var to = new SIN(new Buffer('bacacafe', 'hex')); + console.log(to.toString()); + mdb.addMessage(message, from, to, function(err) { done(); }); });