commit
87fecad007
|
@ -65,6 +65,7 @@ module.exports = {
|
|||
network: process.env.INSIGHT_NETWORK || 'testnet',
|
||||
disableP2pSync: false,
|
||||
disableHistoricSync: false,
|
||||
poolMatchFile: './etc/minersPoolStrings.json',
|
||||
|
||||
// Time to refresh the currency rate. In minutes
|
||||
currencyRefresh: 10
|
||||
|
|
|
@ -10,14 +10,14 @@ var RpcClient = require('../node_modules/bitcore/RpcClient').class();
|
|||
var config = require('../config/config');
|
||||
|
||||
|
||||
// var hash = process.argv[2] || '0000000000b6288775bbd326bedf324ca8717a15191da58391535408205aada4';
|
||||
var hash = process.argv[2] || 'f6c2901f39fd07f2f2e503183d76f73ecc1aee9ac9216fde58e867bc29ce674e';
|
||||
var hash = process.argv[2] || '0000000000b6288775bbd326bedf324ca8717a15191da58391535408205aada4';
|
||||
//var hash = process.argv[2] || 'f6c2901f39fd07f2f2e503183d76f73ecc1aee9ac9216fde58e867bc29ce674e';
|
||||
|
||||
hash = 'e2253359458db3e732c82a43fc62f56979ff59928f25a2df34dfa443e9a41160';
|
||||
//hash = 'e2253359458db3e732c82a43fc62f56979ff59928f25a2df34dfa443e9a41160';
|
||||
|
||||
var rpc = new RpcClient(config.bitcoind);
|
||||
|
||||
rpc.getBlockCount( function(err, ret) {
|
||||
rpc.getBlock( hash, function(err, ret) {
|
||||
|
||||
console.log('Err:');
|
||||
console.log(err);
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
[
|
||||
{
|
||||
"poolName":"50BTC",
|
||||
"url":"https://50btc.com/",
|
||||
"searchStrings":[
|
||||
"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":"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":"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":"Eligius",
|
||||
"url":"http://eligius.st/",
|
||||
"searchStrings":[
|
||||
"Eligius"
|
||||
]
|
||||
},
|
||||
{
|
||||
"poolName":"EclipseMC",
|
||||
"url":"https://eclipsemc.com/",
|
||||
"searchStrings":[
|
||||
"Josh Zerlan was here!",
|
||||
"EclipseMC",
|
||||
"Aluminum Falcons"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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":"Horrible Horrendous Terrible Tremendous",
|
||||
"url":"http://hhtt.1209k.com/",
|
||||
"searchStrings":[
|
||||
"HHTT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"poolName":"Megabigpower",
|
||||
"url":"http://megabigpower.com/",
|
||||
"searchStrings":[
|
||||
"megabigpower.com"
|
||||
]
|
||||
},
|
||||
{
|
||||
"poolName":"Mt Red",
|
||||
"url":"https://mtred.com/",
|
||||
"searchStrings":[
|
||||
"/mtred/"
|
||||
]
|
||||
},
|
||||
{
|
||||
"poolName":"MaxBTC",
|
||||
"url":"https://www.maxbtc.com",
|
||||
"searchStrings":[
|
||||
"MaxBTC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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":"Yourbtc.net",
|
||||
"url":"http://yourbtc.net/",
|
||||
"searchStrings":[
|
||||
"yourbtc.net"
|
||||
]
|
||||
}
|
||||
]
|
|
@ -73,9 +73,12 @@ if (!config.disableHistoricSync) {
|
|||
else {
|
||||
historicSync.smartImport({}, function(err){
|
||||
var txt = 'ended.';
|
||||
if (err) txt = 'ABORTED with error: ' + err.message;
|
||||
else
|
||||
if (err)
|
||||
txt = 'ABORTED with error: ' + err.message;
|
||||
else if (ps) {
|
||||
ps.allowReorgs = true;
|
||||
ps.historicSync = historicSync;
|
||||
}
|
||||
|
||||
console.log('[historic_sync] ' + txt, historicSync.info());
|
||||
});
|
||||
|
|
|
@ -23,10 +23,13 @@ function spec(b) {
|
|||
config = require('../config/config');
|
||||
var db = b.db || levelup(config.leveldb + '/blocks',{maxOpenFiles: MAX_OPEN_FILES} );
|
||||
var Rpc = b.rpc || require('./Rpc').class();
|
||||
var PoolMatch = b.poolMatch || require('./PoolMatch').class(config);
|
||||
|
||||
var BlockDb = function() {
|
||||
BlockDb.super(this, arguments);
|
||||
this.poolMatch = new PoolMatch();
|
||||
};
|
||||
|
||||
BlockDb.superclass = superclass;
|
||||
|
||||
BlockDb.prototype.close = function(cb) {
|
||||
|
@ -172,6 +175,7 @@ function spec(b) {
|
|||
if (err) return cb(err);
|
||||
|
||||
info.isMainChain = val ? true : false;
|
||||
// info.poolInfo = self.poolMatch.match(info.hex);
|
||||
|
||||
return cb(null, {
|
||||
hash: hash,
|
||||
|
|
|
@ -28,14 +28,6 @@ function spec() {
|
|||
this.genesis = genesisHashReversed.reverse().toString('hex');
|
||||
|
||||
|
||||
//available status: starting / syncing / finished / aborted
|
||||
this.status = 'starting';
|
||||
this.error = null;
|
||||
|
||||
this.syncPercentage = 0;
|
||||
this.syncedBlocks = 0;
|
||||
this.orphanBlocks = 0;
|
||||
this.type ='';
|
||||
}
|
||||
|
||||
function p() {
|
||||
|
@ -343,6 +335,15 @@ function spec() {
|
|||
var lastBlock;
|
||||
var tip;
|
||||
|
||||
//available status: starting / syncing / finished / aborted
|
||||
this.status = 'starting';
|
||||
this.error = null;
|
||||
|
||||
this.syncPercentage = 0;
|
||||
this.syncedBlocks = 0;
|
||||
this.orphanBlocks = 0;
|
||||
this.type ='';
|
||||
|
||||
async.series([
|
||||
function(s_c) {
|
||||
if (!scanOpts.destroy) return s_c();
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
'use strict';
|
||||
|
||||
require('classtool');
|
||||
|
||||
function spec(b) {
|
||||
|
||||
var fs = require('fs');
|
||||
var buffertools = require('buffertools');
|
||||
var db = b.db || JSON.parse( fs.readFileSync(b.poolMatchFile || './poolMatchFile.json'));
|
||||
|
||||
var PoolMatch = function() {
|
||||
var self = this;
|
||||
|
||||
self.strings={};
|
||||
db.forEach(function(pool) {
|
||||
pool.searchStrings.forEach(function(s) {
|
||||
if (!self.strings[s]) self.strings[s] = [];
|
||||
self.strings[s].push(pool);
|
||||
});
|
||||
});
|
||||
Object.keys( self.strings, function(s) {
|
||||
delete self.strings[s].searchStrings;
|
||||
});
|
||||
self.stringsK = Object.keys(self.strings);
|
||||
self.stringsKl = self.stringsK.length;
|
||||
};
|
||||
|
||||
PoolMatch.prototype.match = function(buffer) {
|
||||
var self = this;
|
||||
|
||||
var match;
|
||||
var i =0;
|
||||
while (!match && i < self.stringsKl) {
|
||||
var k = self.stringsK[i++];
|
||||
if ( buffertools.indexOf(buffer,self.strings[k]) >= 0 ) {
|
||||
match = self.strings[k];
|
||||
}
|
||||
}
|
||||
return match;
|
||||
};
|
||||
|
||||
return PoolMatch;
|
||||
}
|
||||
module.defineClass(spec);
|
||||
|
||||
|
|
@ -93,8 +93,6 @@ function spec(b) {
|
|||
return cb(err,info.result);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return Rpc;
|
||||
}
|
||||
module.defineClass(spec);
|
||||
|
|
|
@ -103,6 +103,10 @@ function spec() {
|
|||
|
||||
self.bDb.has(newPrev, function(err, val) {
|
||||
if (!val && newPrev.match(/^0+$/)) return c();
|
||||
/// AQUI! -> return is reor...
|
||||
//
|
||||
// needSync
|
||||
// =>
|
||||
return c(err ||
|
||||
(!val ? new Error('WARN: Ignoring block with non existing prev:' + b.hash) : null));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue