From b87a04f2c0cfa96dadf46a26c3d6808be2976528 Mon Sep 17 00:00:00 2001 From: eordano Date: Wed, 18 Feb 2015 17:24:31 -0300 Subject: [PATCH] App to HTTP and change lib structure --- etc/bitcoind/bitcoin-livenet.conf | 10 - etc/bitcoind/bitcoin-testnet.conf | 10 - etc/minersPoolStrings.json | 227 ------------------ etc/test-cert.pem | 14 -- etc/test-key.pem | 15 -- {app => http}/controllers/addresses.js | 0 {app => http}/controllers/blocks.js | 0 {app => http}/controllers/common.js | 0 {app => http}/controllers/currency.js | 0 {app => http}/controllers/index.js | 0 {app => http}/controllers/messages.js | 0 {app => http}/controllers/socket.js | 0 {app => http}/controllers/status.js | 0 {app => http}/controllers/transactions.js | 0 {app => http}/models/Address.js | 0 {app => http}/models/Status.js | 0 lib/MessageDb.js | 182 -------------- lib/PoolMatch.js | 32 --- lib/{BlockDb.js => databases/block.js} | 0 .../transaction.js} | 0 lib/{Sync.js => strategies/base.js} | 0 lib/{BlockExtractor.js => strategies/disk.js} | 0 .../historic.js} | 0 lib/{PeerSync.js => strategies/peer.js} | 0 test/integration/addr.json | 138 ----------- test/integration/spent.json | 32 --- test/integration/txitems.json | 62 ----- test/integration/txs.json | 32 --- test/integration/utxo.json | 16 -- test/lib/PeerSync.js | 49 ---- test/mocha.opts | 5 - 31 files changed, 824 deletions(-) delete mode 100644 etc/bitcoind/bitcoin-livenet.conf delete mode 100644 etc/bitcoind/bitcoin-testnet.conf delete mode 100644 etc/minersPoolStrings.json delete mode 100644 etc/test-cert.pem delete mode 100644 etc/test-key.pem rename {app => http}/controllers/addresses.js (100%) rename {app => http}/controllers/blocks.js (100%) rename {app => http}/controllers/common.js (100%) rename {app => http}/controllers/currency.js (100%) rename {app => http}/controllers/index.js (100%) rename {app => http}/controllers/messages.js (100%) rename {app => http}/controllers/socket.js (100%) rename {app => http}/controllers/status.js (100%) rename {app => http}/controllers/transactions.js (100%) rename {app => http}/models/Address.js (100%) rename {app => http}/models/Status.js (100%) delete mode 100644 lib/MessageDb.js delete mode 100644 lib/PoolMatch.js rename lib/{BlockDb.js => databases/block.js} (100%) rename lib/{TransactionDb.js => databases/transaction.js} (100%) rename lib/{Sync.js => strategies/base.js} (100%) rename lib/{BlockExtractor.js => strategies/disk.js} (100%) rename lib/{HistoricSync.js => strategies/historic.js} (100%) rename lib/{PeerSync.js => strategies/peer.js} (100%) delete mode 100644 test/integration/addr.json delete mode 100644 test/integration/spent.json delete mode 100644 test/integration/txitems.json delete mode 100644 test/integration/txs.json delete mode 100644 test/integration/utxo.json delete mode 100644 test/lib/PeerSync.js delete mode 100644 test/mocha.opts diff --git a/etc/bitcoind/bitcoin-livenet.conf b/etc/bitcoind/bitcoin-livenet.conf deleted file mode 100644 index 52e6d088..00000000 --- a/etc/bitcoind/bitcoin-livenet.conf +++ /dev/null @@ -1,10 +0,0 @@ -rpcuser=user -rpcpassword=pass -server=1 -txindex=1 - -# Allow connections outsite localhost? -rpcallowip=192.168.1.* - -rpcport=8332 - diff --git a/etc/bitcoind/bitcoin-testnet.conf b/etc/bitcoind/bitcoin-testnet.conf deleted file mode 100644 index 99bc2608..00000000 --- a/etc/bitcoind/bitcoin-testnet.conf +++ /dev/null @@ -1,10 +0,0 @@ -rpcuser=user -rpcpassword=pass -server=1 -txindex=1 - -# Allow connections outsite localhost? -rpcallowip=192.168.1.* - -rpcport=18332 -testnet=3 diff --git a/etc/minersPoolStrings.json b/etc/minersPoolStrings.json deleted file mode 100644 index 1ad3892d..00000000 --- a/etc/minersPoolStrings.json +++ /dev/null @@ -1,227 +0,0 @@ -[ - { - "poolName":"50BTC", - "url":"https://50btc.com/", - "searchStrings":[ - "50BTC.com", - "50btc.com" - ] - }, - { - "poolName":"175btc", - "url":"http://www.175btc.com/", - "searchStrings":[ - "Mined By 175btc.com" - ] - }, - { - "poolName":"ASICminer", - "url":"https://bitcointalk.org/index.php?topic=99497.0", - "searchStrings":[ - "Mined By ASICMiner" - ] - }, - { - "poolName":"AntMiner", - "url":"https://bitmaintech.com/", - "searchStrings":[ - "AntPool" - ] - }, - { - "poolName":"agentD", - "url":"http://", - "searchStrings":[ - "agentD" - ] - }, - { - "poolName":"Bitfury", - "url":"http://bitfury.org/", - "searchStrings":[ - "2av0id51pct" - ] - }, - { - "poolName":"BitMinter", - "url":"https://bitminter.com/", - "searchStrings":[ - "BitMinter" - ] - }, - { - "poolName":"Bitparking", - "url":"http://bitparking.com/", - "searchStrings":[ - "bitparking" - ] - }, - { - "poolName":"BTC Guild", - "url":"https://www.btcguild.com/", - "searchStrings":[ - "Mined by BTC Guild", - "BTC Guild" - ] - }, - { - "poolName":"bcpool.io", - "url":"https://bcpool.io/", - "searchStrings":[ - "bcpool" - ] - }, - { - "poolName":"Discus Fish", - "url":"http://f2pool.com/", - "searchStrings":[ - "七彩神仙鱼", - "Made in China", - "Mined by user" - ] - }, - { - "poolName":"Discus Fish Solo", - "url":"http://f2pool.com/", - "searchStrings":[ - "For Pierce and Paul" - ] - }, - { - "poolName":"Cointerra", - "url":"http://cointerra.com/", - "searchStrings":[ - "cointerra" - ] - }, - { - "poolName":"Eligius", - "url":"http://eligius.st/", - "searchStrings":[ - "Eligius" - ] - }, - { - "poolName":"EclipseMC", - "url":"https://eclipsemc.com/", - "searchStrings":[ - "Josh Zerlan was here!", - "EclipseMC", - "Aluminum Falcon" - ] - }, - { - "poolName":"GIVE-ME-COINS", - "url":"https://give-me-coins.com/", - "searchStrings":[ - "Mined at GIVE-ME-COINS.com" - ] - }, - { - "poolName":"ghash.io", - "url":"https://ghash.io/", - "searchStrings":[ - "ghash.io", - "GHash.IO" - ] - }, - { - "poolName":"HHTT", - "url":"http://hhtt.1209k.com/", - "searchStrings":[ - "HHTT" - ] - }, - { - "poolName":"KNCminer", - "url":"https://www.kncminer.com/", - "searchStrings":[ - "KnCMiner" - ] - }, - { - "poolName":"Megabigpower", - "url":"http://megabigpower.com/", - "searchStrings":[ - "megabigpower.com" - ] - }, - { - "poolName":"MultiCoin", - "url":"https://multicoin.co/", - "searchStrings":[ - "MultiCoin.co" - ] - }, - { - "poolName":"Mt Red", - "url":"https://mtred.com/‎", - "searchStrings":[ - "/mtred/" - ] - }, - { - "poolName":"MaxBTC", - "url":"https://www.maxbtc.com", - "searchStrings":[ - "MaxBTC" - ] - }, - { - "poolName":"NMCbit", - "url":"http://nmcbit.com/", - "searchStrings":[ - "nmcbit.com" - ] - }, - { - "poolName":"ozcoin", - "url":"https://ozco.in/", - "searchStrings":[ - "ozco.in", - "ozcoin" - ] - }, - { - "poolName":"Polmine.pl", - "url":"https://polmine.pl/‎", - "searchStrings":[ - "by polmine.pl" - ] - }, - { - "poolName":"simplecoin", - "url":"http://simplecoin.us/", - "searchStrings":[ - "simplecoin.us ftw" - ] - }, - { - "poolName":"Slush", - "url":"https://mining.bitcoin.cz/", - "searchStrings":[ - "slush" - ] - }, - { - "poolName":"TripleMining", - "url":"https://www.triplemining.com/", - "searchStrings":[ - "Triplemining.com" - ] - }, - { - "poolName":"wizkid057", - "url":"http://wizkid057.com/btc", - "searchStrings":[ - "wizkid057" - ] - }, - { - "poolName":"Yourbtc.net", - "url":"http://yourbtc.net/", - "searchStrings":[ - "yourbtc.net" - ] - } -] diff --git a/etc/test-cert.pem b/etc/test-cert.pem deleted file mode 100644 index 4e95885d..00000000 --- a/etc/test-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICMjCCAZugAwIBAgIJAK9dKmjfxq+BMA0GCSqGSIb3DQEBCwUAMDIxCzAJBgNV -BAYTAkFSMRMwEQYDVQQIDApTb21lLVN0YXRlMQ4wDAYDVQQKDAVDb3BheTAeFw0x -NDA4MjExNzQyMTBaFw0xNDA5MjAxNzQyMTBaMDIxCzAJBgNVBAYTAkFSMRMwEQYD -VQQIDApTb21lLVN0YXRlMQ4wDAYDVQQKDAVDb3BheTCBnzANBgkqhkiG9w0BAQEF -AAOBjQAwgYkCgYEA1BbMI6V06LKoBrcf5bJ8LH7EjwqbEacIOpiY7B+8W3sAM1bB -6hA2IlPvKL3qTdhMMKFZGZMYypmlAQTI1N+VNSwJHNjyepFbtkdNytSC8qw8bhak -yt4TByYEw1NMYx7I0OOdjh/DKsS+EOIgQDT9zSB+NgErKb0mKrginwgk5XkCAwEA -AaNQME4wHQYDVR0OBBYEFM0G1agUfY4zRNfxJ+0sHV3EsoGKMB8GA1UdIwQYMBaA -FM0G1agUfY4zRNfxJ+0sHV3EsoGKMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEL -BQADgYEAOg7n1RCyB1BJ6TuF99i25H7kpGUSL57ajNyyCKDciTPmpxVJ5knAjPYa -hbXX+dlq2B8QEnfkE5FMDLkO3RS3xU8YfekIDHofDuXR9boD/4rRlsN8md2Jmkr6 -MyRtYPtsPWVeoz0WmG5f1yobHmh7mYf17oN+uRJKX68s8G6b/SQ= ------END CERTIFICATE----- diff --git a/etc/test-key.pem b/etc/test-key.pem deleted file mode 100644 index 7bb97c26..00000000 --- a/etc/test-key.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDUFswjpXTosqgGtx/lsnwsfsSPCpsRpwg6mJjsH7xbewAzVsHq -EDYiU+8ovepN2EwwoVkZkxjKmaUBBMjU35U1LAkc2PJ6kVu2R03K1ILyrDxuFqTK -3hMHJgTDU0xjHsjQ452OH8MqxL4Q4iBANP3NIH42ASspvSYquCKfCCTleQIDAQAB -AoGAMUzDUx3o2RZ+XGFA9uHQX39wLVfnx+itzwEduvV9kT48Q7LNDJ2MF9qu4yeS -SVoYC83Vqk45Gw8v/dag4GrAgdk1NHZZ56Z/G55m06Y45xS6ZarBdbe0N1jdZEab -RG3FgxyPSUiZ5aLIMxMMtgt/DRv9BPpIeLNDMgyQRjVWlMkCQQDzlLwkp4bo+CAY -UMcsSN+KGurEMsuF0qc/+TLqpKDoOaLtd1F+Ntn20tQqeH0YLWktFvzAgY7wYXrb -lhMuAxa7AkEA3ucGEXNqwu1qVP4fXfEN1E0Y5X/euXMsfgNG8IK82hF3h83hnqNM -3FcGFOyKnL7E5TfRlJfxhAGqUfCe+2zjWwJBAKA6CID8CkyZW1NjX4EL9q+8AQ5K -c4J2DTqRzCJ5ZLcdosUeJecmYb5w9MtzMqaCyJq2clCXaNVK6iwjzj4IHh0CQQCY -sgwvIjCtrfQcmyUjtoExwUrf1LPfuK1u+ZG8KuNyQ2rtxjTb9qQtgRPye4QNEoZR -O+a/c0MImhdyIHLYa+RnAkEAwfLD4q+FDx4eX0ANO7/PI/XiJGqi6x1cYUwyRg9o -2S6hN5RnUD/nf2HKHU0esp34UMY/UWMrodCRDZj/ijg4UA== ------END RSA PRIVATE KEY----- diff --git a/app/controllers/addresses.js b/http/controllers/addresses.js similarity index 100% rename from app/controllers/addresses.js rename to http/controllers/addresses.js diff --git a/app/controllers/blocks.js b/http/controllers/blocks.js similarity index 100% rename from app/controllers/blocks.js rename to http/controllers/blocks.js diff --git a/app/controllers/common.js b/http/controllers/common.js similarity index 100% rename from app/controllers/common.js rename to http/controllers/common.js diff --git a/app/controllers/currency.js b/http/controllers/currency.js similarity index 100% rename from app/controllers/currency.js rename to http/controllers/currency.js diff --git a/app/controllers/index.js b/http/controllers/index.js similarity index 100% rename from app/controllers/index.js rename to http/controllers/index.js diff --git a/app/controllers/messages.js b/http/controllers/messages.js similarity index 100% rename from app/controllers/messages.js rename to http/controllers/messages.js diff --git a/app/controllers/socket.js b/http/controllers/socket.js similarity index 100% rename from app/controllers/socket.js rename to http/controllers/socket.js diff --git a/app/controllers/status.js b/http/controllers/status.js similarity index 100% rename from app/controllers/status.js rename to http/controllers/status.js diff --git a/app/controllers/transactions.js b/http/controllers/transactions.js similarity index 100% rename from app/controllers/transactions.js rename to http/controllers/transactions.js diff --git a/app/models/Address.js b/http/models/Address.js similarity index 100% rename from app/models/Address.js rename to http/models/Address.js diff --git a/app/models/Status.js b/http/models/Status.js similarity index 100% rename from app/models/Status.js rename to http/models/Status.js diff --git a/lib/MessageDb.js b/lib/MessageDb.js deleted file mode 100644 index 380c5a1e..00000000 --- a/lib/MessageDb.js +++ /dev/null @@ -1,182 +0,0 @@ -'use strict'; -var soop = require('soop'); -var imports = soop.imports(); -var levelup = require('levelup'); -var config = require('../config/config'); -var Rpc = imports.rpc || require('./Rpc'); -var async = require('async'); -var logger = require('./logger').logger; -var util = require('util'); -var EventEmitter = require('events').EventEmitter; -var microtime = require('microtime'); -var bitcore = require('bitcore'); -var AuthMessage = bitcore.AuthMessage; -var preconditions = require('preconditions').singleton(); - -var MESSAGE_PREFIX = 'msg-'; // msg-- => - -var MAX_OPEN_FILES = 500; -var CONCURRENCY = 5; - - -var db; -var MessageDb = function(opts) { - opts = opts || {}; - this.path = config.leveldb + '/messages' + (opts.name ? ('-' + opts.name) : ''); - this.db = opts.db || db || levelup(this.path, { - maxOpenFiles: MAX_OPEN_FILES, - valueEncoding: 'json' - }); - this.initEvents(); - db = this.db; -}; -util.inherits(MessageDb, EventEmitter); - -MessageDb.prototype.initEvents = function() { - if (db) return; - var self = this; - this.db.on('put', function(key, value) { - var data = {}; - data.key = key; - data.value = value; - var message = MessageDb.fromStorage(data); - self.emit('message', message); - }); - this.db.on('ready', function() { - //console.log('Database ready!'); - }); -}; - -MessageDb.prototype.close = function(cb) { - this.db.close(cb); -}; - - -var messageKey = function(to, ts) { - preconditions.checkArgument(typeof to === 'string'); - preconditions.checkArgument(to.length === 66); - preconditions.checkArgument(!ts || typeof ts === 'number'); - if (!ts) ts = Math.round(microtime.now()); - return MESSAGE_PREFIX + to.toString() + '-' + ts; -}; - -MessageDb.prototype.addMessage = function(m, cb) { - - if (!this.authenticate(m)) { - cb(new Error('Authentication failed')); - return; - } - - var key; - try { - key = messageKey(m.to); - } catch (e) { - cb(new Error('Bad message')); - return; - }; - - var value = m; - this.db.put(key, value, cb); -}; - -MessageDb.prototype.authenticate = function(m) { - preconditions.checkArgument(m.pubkey); - preconditions.checkArgument(m.sig); - preconditions.checkArgument(m.encrypted); - - var frompubkey = new Buffer(m.pubkey, 'hex'); - var sig = new Buffer(m.sig, 'hex'); - var encrypted = new Buffer(m.encrypted, 'hex'); - return AuthMessage._verify(frompubkey, sig, encrypted); -}; - -MessageDb.parseKey = function(key) { - var ret = {}; - var spl = key.split('-'); - - ret.to = spl[1]; - ret.ts = +spl[2]; - - return ret; -}; - -MessageDb.fromStorage = function(data) { - var parsed = MessageDb.parseKey(data.key); - var message = data.value; - message.ts = parsed.ts; - message.to = parsed.to; - return message; -}; - -MessageDb.prototype.getMessages = function(to, lower_ts, upper_ts, cb) { - var list = [], - opts; - lower_ts = lower_ts || 1; - try { - opts = { - start: messageKey(to, lower_ts), - end: messageKey(to, upper_ts), - // limit: limit, TODO - reverse: false, - }; - } catch (e) { - cb(new Error('Bad message range')); - return; - }; - - db.createReadStream(opts) - .on('data', function(data) { - var message = MessageDb.fromStorage(data); - list.push(message); - }) - .on('error', function(err) { - return cb(err); - }) - .on('end', function() { - return cb(null, list); - }); -}; - -MessageDb.prototype.getAll = function(cb) { - var list = []; - db.createReadStream() - .on('data', function(data) { - list.push(MessageDb.fromStorage(data)); - }) - .on('error', function(err) { - return cb(err); - }) - .on('end', function() { - return cb(null, list); - }); -}; - -MessageDb.prototype.removeUpTo = function(ts, cb) { - preconditions.checkArgument(ts); - preconditions.checkArgument(typeof ts === 'number'); - var opts = {}; - var dels = []; - db.createKeyStream(opts) - .on('data', function(key) { - var parsed = MessageDb.parseKey(key); - if (parsed.ts < ts) { - logger.verbose('Deleting message ' + key); - dels.push({ - type: 'del', - key: key - }); - } - }) - .on('error', function(err) { - return cb(err); - }) - .on('end', function() { - db.batch(dels, function(err) { - if (err) return cb(err); - else cb(null, dels.length); - }) - }); - -}; - -module.exports = soop(MessageDb); diff --git a/lib/PoolMatch.js b/lib/PoolMatch.js deleted file mode 100644 index 7c526909..00000000 --- a/lib/PoolMatch.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -var imports = require('soop').imports(); -var fs = require('fs'); -var buffertools = require('buffertools'); -var db = imports.db || JSON.parse( fs.readFileSync(imports.poolMatchFile || './poolMatchFile.json')); - -var PoolMatch = function() { - var self = this; - - self.strings = {}; - db.forEach(function(pool) { - pool.searchStrings.forEach(function(s) { - self.strings[s] = { - poolName: pool.poolName, - url: pool.url - }; - }); - }); -}; - - -PoolMatch.prototype.match = function(buffer) { - var self = this; - for(var k in self.strings) { - if (buffertools.indexOf(buffer, k) >= 0) { - return self.strings[k]; - } - } -}; - -module.exports = require('soop')(PoolMatch); diff --git a/lib/BlockDb.js b/lib/databases/block.js similarity index 100% rename from lib/BlockDb.js rename to lib/databases/block.js diff --git a/lib/TransactionDb.js b/lib/databases/transaction.js similarity index 100% rename from lib/TransactionDb.js rename to lib/databases/transaction.js diff --git a/lib/Sync.js b/lib/strategies/base.js similarity index 100% rename from lib/Sync.js rename to lib/strategies/base.js diff --git a/lib/BlockExtractor.js b/lib/strategies/disk.js similarity index 100% rename from lib/BlockExtractor.js rename to lib/strategies/disk.js diff --git a/lib/HistoricSync.js b/lib/strategies/historic.js similarity index 100% rename from lib/HistoricSync.js rename to lib/strategies/historic.js diff --git a/lib/PeerSync.js b/lib/strategies/peer.js similarity index 100% rename from lib/PeerSync.js rename to lib/strategies/peer.js diff --git a/test/integration/addr.json b/test/integration/addr.json deleted file mode 100644 index c973ce6b..00000000 --- a/test/integration/addr.json +++ /dev/null @@ -1,138 +0,0 @@ -[ - { - "addr": "mm8CDNJnk8PtQPEtTns2ah5nmxN63ENHtY", - "balance": 1.4, - "txApperances": 3 - }, - - { - "addr": "mp3Rzxx9s1A21SY3sjJ3CQoa2Xjph7e5eS", - "balance": 0, - "totalReceived": 50, - "totalSent": 50.0, - "txApperances": 2 - }, - { - "addr": "muyg1K5WsHkfMVCkUXU2y7Xp5ZD6RGzCeH", - "balance": 0.38571339, - "totalReceived": 0.38571339, - "totalSent": 0, - "txApperances": 1 - }, - { - "addr": "mhPEfAmeKVwT7arwMYbhwnL2TfwuWbP4r4", - "totalReceived": 1069, - "txApperances": 13, - "balance": 1065, - "totalSent": 4 - }, - { - "addr": "n47CfqnKWdNwqY1UWxTmNJAqYutFxdH3zY", - "balance": 0, - "totalReceived":26.4245, - "totalSent": 26.4245, - "txApperances": 4 - }, - { - "addr": "mzSyyXgofoBxpr6gYcU3cV345G8hJpixRd", - "balance": 0, - "totalReceived":3.9775, - "totalSent": 3.9775, - "txApperances": 2 - }, - { - "addr": "mgqvRGJMwR9JU5VhJ3x9uX9MTkzTsmmDgQ", - "txApperances": 27, - "balance": 0, - "totalReceived": 54.81284116 - }, - { - "disabled": 1, - "addr": "mzW2hdZN2um7WBvTDerdahKqRgj3md9C29", - "balance": 1363.14677867, - "totalReceived": 1363.14677867, - "totalSent": 0, - "txApperances": 7947, - "unconfirmedTxApperances": 5, - "unconfirmedBalanceSat": 149174913 - }, - { - "addr": "mjRmkmYzvZN3cA3aBKJgYJ65epn3WCG84H", - "txApperances": 7166, - "balance": 6513, - "totalReceived": 357130.17644359, - "totalSent": 350617.17644359 - }, - { - "addr": "mgKY35SXqxFpcKK3Dq9mW9919N7wYXvcFM", - "txApperances": 2, - "balance": 0, - "totalReceived": 0.01979459, - "totalSent": 0, - "transactions": [ "91800d80bb4c69b238c9bfd94eb5155ab821e6b25cae5c79903d12853bbb4ed5" ] - }, - { - "addr": "mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5", - "balance": 5524.61806422, - "totalReceived": 12157.65075053, - "totalSent": 6633.03268631, - "txApperances": 443, - "transactions": [ - "91800d80bb4c69b238c9bfd94eb5155ab821e6b25cae5c79903d12853bbb4ed5", - "f6e80d4fd1a2377406856c67d0cee5ac7e5120993ff97e617ca9aac33b4c6b1e", - "bc27f31caae86750b126d9b09e969362b85b7c15f41421387d682064544bf7e7", - "2cd6a1cb26880276fbc9851396f1bd8081cb2b9107ff6921e8fd65ed2df3df79", - "8bea41f573bccb7b648bc0b1bbfeba8a96da05b1d819ff4a33d39fbcd334ecfd", - "cb0d55c37acc57f759255193673e13858b5ab3d8fdfa7ee8b25f9964bdaa11e3", - "7b007aeace2299d27b6bb6c24d0a8040d6a87e4c2601216c34d226462b75f915", - "a9f40fbaecd2b28a05405e28b95566d7b3bd8ac38a2853debd72517f2994c6fc", - "4123255b7678e37c168b9e929927760bc5d9363b0c78ec61a7b4a78b2a07adab", - "cb3760529c2684c32047a2fddf0e2534c9241e5d72011aac4a8982e0c7b46df3", - "e8d00d8cc744381233dbc95e2d657345084dfb6df785b81285183f4c89b678d4", - "7a748364255c5b64979d9d3da35ea0fbef0114e0d7f96fccd5bea76f6d19f06b", - "d0b7e087040f67ef9bd9f21ccf53d1b5410400351d949cabf127caf28a6e7add", - "209f97873265652b83922921148cad92d7e048c6822e4864e984753e04181470", - "3a4af7755d3061ecced2f3707c2623534104f08aa73a52ca243d7ddecf5fe86d", - "4a4b5c8d464a77814ed35a37e2a28e821d467a803761427c057f67823309b725", - "d85f5265618fb694c3ea3ca6f73eba93df8a644bc1c7286cec2fbc2fbf7d895e", - "0d2c778ed9976b52792c941cac126bda37d3b1453082022d5e36ac401be3b249", - "daf03d666047ca0b5340b4a0027f8562b7c5bac87dca3727093b5393176a541a", - "a0dc03a870e589ea51e3d3a8aed0d34f4f1ae6844acad26dae48fe523b26e764", - "3df1a50e2e5d8525f04bd21a66bad824364a975449fa24fd5c2537d0f713919b", - "7bc26c1f3b4ab5ca57677593d28d13bff468a658f4d5efc379c1612554cf668e", - "ded4cbc9c52fd5599b6a93f89a79cde9aeb5a7f8f56732bb67ae9554325b3666", - "91224a219196a3f6e6f40ad2137b13fe54109e57aaed7527ea34aa903e6b8313", - "ee899a182bbb75e98ef14d83489e631dd66a8c5059dc8255692dd8ca9efba01f", - "0a61590c7548bd4f6a0df1575b268057e5e3e295a44eaeeb1dfbd01332c585ed", - "d56c22950ad2924f404b5b0baa6e49b0df1aaf09d1947842aed9d0178958eb9d", - "c6b5368c5a256141894972fbd02377b3894aa0df7c35fab5e0eca90de064fdc1", - "158e1f9c3f8ec44e88052cadef74e8eb99fbad5697d0b005ba48c933f7d96816", - "7f6191c0f4e3040901ef0d5d6e76af4f16423061ca1347524c86205e35d904d9", - "2c2e20f976b98a0ca76c57eca3653699b60c1bd9503cc9cc2fb755164a679a26", - "59bc81733ff0eaf2b106a70a655e22d2cdeff80ada27b937693993bf0c22e9ea", - "7da38b66fb5e8582c8be85abecfd744a6de89e738dd5f3aaa0270b218ec424eb", - "393d51119cdfbf0a308c0bbde2d4c63546c0961022bad1503c4bbaed0638c837", - "4518868741817ae6757fd98de27693b51fad100e89e5206b9bbf798aeebb804c", - "c58bce14de1e3016504babd8bbe8175207d75074134a2548a71743fa3e56c58d", - "6e69ec4a97515a8fd424f123a5fc1fdfd3c3adcd741292cbc09c09a2cc433bea", - "0e15f2498362050e5ceb6157d0fbf820fdcaf936e447207d433ee7701d7b99c2", - "a3789e113041db907a1217ddb5c3aaf0eff905cc3d913e68d977e1ab4d19acea", - "80b460922faf0ad1e8b8a55533654c9a9f3039bfff0fff2bcf8536b8adf95939" - ] - }, - { - "addr": "mtA6woo1wjCeu1dLkWgpSD3tRnRfrHt3FL", - "balance": 349.845, - "totalReceived": 349.845, - "totalSent": 0, - "txApperances": 13, - "transactions": [ - "794eafc0ad68a3576034eb137d7d20d3bdf1777ecf27e0e20e96e1adcfc66659", - "0130721f29f50b773858c3c9081678bdddebcd18078c5fa2436d979b54ed5cef", - "fb1024947b48d90255aedd3f0f1df3673a7e98d06346bb2ac89b116aa19c5db4" - ] - } - -] - - diff --git a/test/integration/spent.json b/test/integration/spent.json deleted file mode 100644 index 351661be..00000000 --- a/test/integration/spent.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "21798ddc9664ac0ef618f52b151dda82dafaf2e26d2bbef6cdaf55a6957ca237": [ - { - "txid": "bcd8da8ee847da377f8aaca92502c05e5f914c6a2452753146013b0e642a25a0", - "n": 0 - }, - { - "txid": "deb7bddc67e936ae49b97a97885d29e60afc6f6784f6d871f2904614a67250f5", - "n": 0 - } - ], - "b633a6249d4a2bc123e7f8a151cae2d4afd17aa94840009f8697270c7818ceee": [ - { - "txid": "c0c46d6be0183f52c88afe2d649800ecdaa7594ee390c77bafbd06322e6c823d", - "n": 11 - }, - { - "txid": "d60e980419c5a8abd629fdea5032d561678b62e23b3fdba62b42f410c5a29560", - "n": 1 - } - ], - "ca2f42e44455b8a84434de139efea1fe2c7d71414a8939e0a20f518849085c3b": [ - { - "txid": "aa21822f1a69bc54e5a4ab60b25c09503702a821379fd2dfbb696b8ada4ce5b9", - "n": 0 - }, - { - "txid": "a33bd24a47ab6f23758ed09e05716f809614f2e280e5a05a317ec6d839e81225", - "n": 1 - } - ] -} diff --git a/test/integration/txitems.json b/test/integration/txitems.json deleted file mode 100644 index 283e8733..00000000 --- a/test/integration/txitems.json +++ /dev/null @@ -1,62 +0,0 @@ -[ - { - "disabled": 1, - "txid": "75c5ffe6dc2eb0f6bd011a08c041ef115380ccd637d859b379506a0dca4c26fc" - }, - { - "txid": "21798ddc9664ac0ef618f52b151dda82dafaf2e26d2bbef6cdaf55a6957ca237", - "toRm": [ - "txs-86a03cac7d87f596008c6d5a8d3fd8b88842932ea6f0337673eda16f6b472f7f-0", - "txs-bcd8da8ee847da377f8aaca92502c05e5f914c6a2452753146013b0e642a25a0-0" - ], - "items": [ - { - "addr": "mzjLe62faUqCSjkwQkwPAL5nYyR8K132fA", - "value_sat": 134574000, - "index": 0 - }, - { - "addr": "n28wb1cRGxPtfmsenYKFfsvnZ6kRapx3jF", - "value_sat": 31600000, - "index": 1 - } - ] - }, - { - "txid": "b633a6249d4a2bc123e7f8a151cae2d4afd17aa94840009f8697270c7818ceee", - "toRm": [ - "txs-01621403689cb4a95699a3dbae029d7031c5667678ef14e2054793954fb27917-0" - ], - "items": [ - { - "addr": "mhfQJUSissP6nLM5pz6DxHfctukrrLct2T", - "value_sat": 19300000, - "index": 0 - }, - { - "addr": "mzcDhbL877ES3MGftWnc3EuTSXs3WXDDML", - "value_sat": 21440667, - "index": 1 - } - ] - }, - { - "txid": "ca2f42e44455b8a84434de139efea1fe2c7d71414a8939e0a20f518849085c3b", - "toRm": [ - "txs-2d7b680fb06e4d7eeb65ca49ac7522276586e0090b7fe662fc708129429c5e6a-0" - ], - "items": [ - { - "addr": "mhqyL1nDQDo1WLH9qH8sjRjx2WwrnmAaXE", - "value_sat": 1327746, - "index": 0 - }, - { - "addr": "mkGrySSnxcqRbtPCisApj3zXCQVmUUWbf1", - "value_sat": 1049948, - "index": 1 - } - ] - } - -] diff --git a/test/integration/txs.json b/test/integration/txs.json deleted file mode 100644 index 88abb2b1..00000000 --- a/test/integration/txs.json +++ /dev/null @@ -1,32 +0,0 @@ -[{ - "test": "should return non-paginated txs for single address", - "addrs": ["mtA6woo1wjCeu1dLkWgpSD3tRnRfrHt3FL"], - "totalTransactions": 13, - "returnedTransactions": 13 -},{ - "test": "should return paginated txs for single address", - "addrs": ["mtA6woo1wjCeu1dLkWgpSD3tRnRfrHt3FL"], - "totalTransactions": 13, - "from": 8, - "to": 12, - "returnedTransactions": 4 -},{ - "test": "should return non-paginated txs for multiple addresses", - "addrs": ["mqtYvjsUg59XpngBAYjFF51Xauc28a6Ckd","myDZmGN9euuRhM1mniSaXhQjNdqFmUzUkj"], - "totalTransactions": 4, - "returnedTransactions": 4 -},{ - "test": "should return paginated txs for multiple addresses", - "addrs": ["mqtYvjsUg59XpngBAYjFF51Xauc28a6Ckd","myDZmGN9euuRhM1mniSaXhQjNdqFmUzUkj", "n2NbTWCuUyTvpA2YKTpVD4SmCouFLcm8rS"], - "totalTransactions": 6, - "from": 2, - "to": 6, - "returnedTransactions": 4, - "transactions": [ - "3e81723d069b12983b2ef694c9782d32fca26cc978de744acbc32c3d3496e915", - "b701b0680bc2b6f8b58f13d035a754486ecefd2438e3495cd8f395ab7f5e7ba9", - "80fb4fd2a6e5e795a4f30aebeda49424e7ed4d3630b128efb946aa964e0bc9c0", - "855e881892d7cd4a8fa81dbd8f6e9d142d02bffc10ffbe5428036ee55c3e3e0f" - ] -} -] diff --git a/test/integration/utxo.json b/test/integration/utxo.json deleted file mode 100644 index f45dfb69..00000000 --- a/test/integration/utxo.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "addr": "muyg1K5WsHkfMVCkUXU2y7Xp5ZD6RGzCeH", - "length": 1, - "tx0id": "eeabc70063d3f266e190e8735bc4599c811d3a79d138da1364e88502069b029c", - "tx0scriptPubKey": "76a9149e9f6515c70db535abdbbc983c7d8d1bff6c20cd88ac", - "tx0amount": 0.38571339 - }, - { - "addr": "2N1pLkosf6o8Ciqs573iwwgVpuFS6NbNKx5", - "length": 13, - "tx0id": "b9cc61b55814a0f972788e9025db1013157f83716e08239026a156efe892a05c", - "tx0scriptPubKey": "a9145e0461e38796367580305e3615fc1b70e4c3307687", - "tx0amount": 0.001 - } -] diff --git a/test/lib/PeerSync.js b/test/lib/PeerSync.js deleted file mode 100644 index 9c29b11e..00000000 --- a/test/lib/PeerSync.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; -var chai = require('chai'), - expect = chai.expect, - sinon = require('sinon'); - -var PeerSync = require('../../lib/PeerSync.js'); -describe('PeerSync', function() { - var ps; - - beforeEach(function(done) { - ps = new PeerSync(); - done(); - }); - afterEach(function() { - ps.close(); - }); - - - describe('#handleInv()', function() { - var inv_info = { - message: { - invs: [] - }, - conn: { - sendGetData: sinon.spy() - } - }; - it('should return with no errors', function() { - expect(function() { - ps.handleInv(inv_info); - }).not.to.throw(Error); - }); - it('should call sendGetData', function() { - ps.handleInv(inv_info); - expect(inv_info.conn.sendGetData.calledTwice).to.be.ok; - }); - }); - - describe('#run()', function() { - it('should setup peerman', function() { - var startSpy = sinon.spy(ps.peerman, 'start'); - var onSpy = sinon.spy(ps.peerman, 'on'); - ps.run(); - - expect(startSpy.called).to.be.ok; - expect(onSpy.called).to.be.ok; - }); - }); -}); diff --git a/test/mocha.opts b/test/mocha.opts deleted file mode 100644 index a9caeb4a..00000000 --- a/test/mocha.opts +++ /dev/null @@ -1,5 +0,0 @@ ---require should --R spec ---ui bdd ---recursive -