Basic bitcoind/romanz-electrum support to sync the mempool and blocks.

This commit is contained in:
softsimon
2020-12-20 22:36:36 +07:00
parent 5a4a976d55
commit 5dbf6789a7
12 changed files with 393 additions and 38 deletions

View File

@@ -3,6 +3,7 @@ const configFile = require('../mempool-config.json');
interface IConfig {
MEMPOOL: {
NETWORK: 'mainnet' | 'testnet' | 'liquid';
BACKEND: 'electrs' | 'bitcoind' | 'bitcoind-electrs';
HTTP_PORT: number;
SPAWN_CLUSTER_PROCS: number;
API_URL_PREFIX: string;
@@ -11,7 +12,15 @@ interface IConfig {
ELECTRS: {
REST_API_URL: string;
POLL_RATE_MS: number;
HOST: string;
PORT: number;
};
BITCOIND: {
HOST: string;
PORT: number;
USERNAME: string;
PASSWORD: string;
},
DATABASE: {
ENABLED: boolean;
HOST: string,
@@ -44,6 +53,7 @@ interface IConfig {
const defaults: IConfig = {
'MEMPOOL': {
'NETWORK': 'mainnet',
'BACKEND': 'electrs',
'HTTP_PORT': 8999,
'SPAWN_CLUSTER_PROCS': 0,
'API_URL_PREFIX': '/api/v1/',
@@ -51,7 +61,15 @@ const defaults: IConfig = {
},
'ELECTRS': {
'REST_API_URL': 'http://127.0.0.1:3000',
'POLL_RATE_MS': 2000
'POLL_RATE_MS': 2000,
'HOST': '127.0.0.1',
'PORT': 3306
},
'BITCOIND': {
'HOST': "127.0.0.1",
'PORT': 8332,
'USERNAME': "mempoo",
'PASSWORD': "mempool"
},
'DATABASE': {
'ENABLED': true,
@@ -85,6 +103,7 @@ const defaults: IConfig = {
class Config implements IConfig {
MEMPOOL: IConfig['MEMPOOL'];
ELECTRS: IConfig['ELECTRS'];
BITCOIND: IConfig['BITCOIND'];
DATABASE: IConfig['DATABASE'];
STATISTICS: IConfig['STATISTICS'];
BISQ_BLOCKS: IConfig['BISQ_BLOCKS'];
@@ -95,6 +114,7 @@ class Config implements IConfig {
const configs = this.merge(configFile, defaults);
this.MEMPOOL = configs.MEMPOOL;
this.ELECTRS = configs.ELECTRS;
this.BITCOIND = configs.BITCOIND;
this.DATABASE = configs.DATABASE;
this.STATISTICS = configs.STATISTICS;
this.BISQ_BLOCKS = configs.BISQ_BLOCKS;