Commit e2fd7c8a authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #1037 Remove any reference to duniter-(bma|crawler|keypair)

parent d795202e
......@@ -52,10 +52,6 @@ If you wish to participate/debate on Duniter, you can:
### Developement
Duniter is using modules on different git repositories:
- [Common](https://github.com/duniter/duniter-common): commons tools for Duniter core and modules.
- [Crawler](https://github.com/duniter/duniter-crawler): network crawler.
- [BMA API](https://github.com/duniter/duniter-bma): Basic Merkled API.
- [Keypair](https://github.com/duniter/duniter-keypair): provide the cryptographic keypair.
- [WotB](https://github.com/duniter/wotb): compute Web of Trust.
- [Debug](https://github.com/duniter/duniter-debug): debug tool.
- [Web admin](https://github.com/duniter/duniter-ui): web administration interface (optional).
......
......@@ -43,54 +43,54 @@ export const bma = function(server:Server, interfaces:NetworkInterface[], httpLo
const wot = new WOTBinding(server)
const transactions = new TransactionBinding(server)
const dividend = new UDBinding(server)
httpMethods.httpGET( '/', node.summary, dtos.Summary, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/node/summary', node.summary, dtos.Summary, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/node/sandboxes', node.sandboxes, dtos.Sandboxes, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/parameters', blockchain.parameters, dtos.Parameters, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/blockchain/membership', blockchain.parseMembership, dtos.Membership, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/memberships/:search', blockchain.memberships, dtos.Memberships, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/blockchain/block', blockchain.parseBlock, dtos.Block, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/block/:number', blockchain.promoted, dtos.Block, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/blocks/:count/:from', blockchain.blocks, dtos.Blocks, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/current', blockchain.current, dtos.Block, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/hardship/:search', blockchain.hardship, dtos.Hardship, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/difficulties', blockchain.difficulties, dtos.Difficulties, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/newcomers', blockchain.with.newcomers, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/certs', blockchain.with.certs, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/joiners', blockchain.with.joiners, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/actives', blockchain.with.actives, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/leavers', blockchain.with.leavers, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/excluded', blockchain.with.excluded, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/revoked', blockchain.with.revoked, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/ud', blockchain.with.ud, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/tx', blockchain.with.tx, dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/branches', blockchain.branches, dtos.Branches, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/network/peering', net.peer, dtos.Peer, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/network/peering/peers', net.peersGet, dtos.MerkleOfPeers, BMALimitation.limitAsVeryHighUsage());
httpMethods.httpPOST( '/network/peering/peers', net.peersPost, dtos.Peer, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/network/peers', net.peers, dtos.Peers, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/wot/add', wot.add, dtos.Identity, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/wot/certify', wot.certify, dtos.Cert, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/wot/revoke', wot.revoke, dtos.Result, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/lookup/:search', wot.lookup, dtos.Lookup, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/members', wot.members, dtos.Members, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/pending', wot.pendingMemberships, dtos.MembershipList, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/requirements/:search', wot.requirements, dtos.Requirements, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/requirements-of-pending/:minsig', wot.requirementsOfPending, dtos.Requirements, BMALimitation.limitAsLowUsage());
httpMethods.httpGET( '/wot/certifiers-of/:search', wot.certifiersOf, dtos.Certifications, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/certified-by/:search', wot.certifiedBy, dtos.Certifications, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/identity-of/:search', wot.identityOf, dtos.SimpleIdentity, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/tx/process', transactions.parseTransaction, dtos.Transaction, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/hash/:hash', transactions.getByHash, dtos.Transaction, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/sources/:pubkey', transactions.getSources, dtos.Sources, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/history/:pubkey', transactions.getHistory, dtos.TxHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/history/:pubkey/blocks/:from/:to', transactions.getHistoryBetweenBlocks, dtos.TxHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/history/:pubkey/times/:from/:to', transactions.getHistoryBetweenTimes, dtos.TxHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/history/:pubkey/pending', transactions.getPendingForPubkey, dtos.TxHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/pending', transactions.getPending, dtos.TxPending, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/ud/history/:pubkey', dividend.getHistory, dtos.UDHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/ud/history/:pubkey/blocks/:from/:to', dividend.getHistoryBetweenBlocks, dtos.UDHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/ud/history/:pubkey/times/:from/:to', dividend.getHistoryBetweenTimes, dtos.UDHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/', (req:any) => node.summary(), dtos.Summary, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/node/summary', (req:any) => node.summary(), dtos.Summary, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/node/sandboxes', (req:any) => node.sandboxes(), dtos.Sandboxes, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/parameters', (req:any) => blockchain.parameters(), dtos.Parameters, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/blockchain/membership', (req:any) => blockchain.parseMembership(req), dtos.Membership, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/memberships/:search', (req:any) => blockchain.memberships(req), dtos.Memberships, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/blockchain/block', (req:any) => blockchain.parseBlock(req), dtos.Block, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/block/:number', (req:any) => blockchain.promoted(req), dtos.Block, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/blocks/:count/:from', (req:any) => blockchain.blocks(req), dtos.Blocks, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/current', (req:any) => blockchain.current(), dtos.Block, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/hardship/:search', (req:any) => blockchain.hardship(req), dtos.Hardship, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/difficulties', (req:any) => blockchain.difficulties(), dtos.Difficulties, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/newcomers', (req:any) => blockchain.with.newcomers(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/certs', (req:any) => blockchain.with.certs(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/joiners', (req:any) => blockchain.with.joiners(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/actives', (req:any) => blockchain.with.actives(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/leavers', (req:any) => blockchain.with.leavers(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/excluded', (req:any) => blockchain.with.excluded(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/revoked', (req:any) => blockchain.with.revoked(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/ud', (req:any) => blockchain.with.ud(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/with/tx', (req:any) => blockchain.with.tx(req), dtos.Stat, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/branches', (req:any) => blockchain.branches(), dtos.Branches, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/network/peering', (req:any) => net.peer(), dtos.Peer, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/network/peering/peers', (req:any) => net.peersGet(req), dtos.MerkleOfPeers, BMALimitation.limitAsVeryHighUsage());
httpMethods.httpPOST( '/network/peering/peers', (req:any) => net.peersPost(req), dtos.Peer, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/network/peers', (req:any) => net.peers(), dtos.Peers, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/wot/add', (req:any) => wot.add(req), dtos.Identity, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/wot/certify', (req:any) => wot.certify(req), dtos.Cert, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/wot/revoke', (req:any) => wot.revoke(req), dtos.Result, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/lookup/:search', (req:any) => wot.lookup(req), dtos.Lookup, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/members', (req:any) => wot.members(), dtos.Members, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/pending', (req:any) => wot.pendingMemberships(), dtos.MembershipList, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/requirements/:search', (req:any) => wot.requirements(req), dtos.Requirements, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/requirements-of-pending/:minsig', (req:any) => wot.requirementsOfPending(req), dtos.Requirements, BMALimitation.limitAsLowUsage());
httpMethods.httpGET( '/wot/certifiers-of/:search', (req:any) => wot.certifiersOf(req), dtos.Certifications, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/certified-by/:search', (req:any) => wot.certifiedBy(req), dtos.Certifications, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/wot/identity-of/:search', (req:any) => wot.identityOf(req), dtos.SimpleIdentity, BMALimitation.limitAsHighUsage());
httpMethods.httpPOST( '/tx/process', (req:any) => transactions.parseTransaction(req), dtos.Transaction, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/hash/:hash', (req:any) => transactions.getByHash(req), dtos.Transaction, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/sources/:pubkey', (req:any) => transactions.getSources(req), dtos.Sources, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/history/:pubkey', (req:any) => transactions.getHistory(req), dtos.TxHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/history/:pubkey/blocks/:from/:to', (req:any) => transactions.getHistoryBetweenBlocks(req), dtos.TxHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/history/:pubkey/times/:from/:to', (req:any) => transactions.getHistoryBetweenTimes(req), dtos.TxHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/history/:pubkey/pending', (req:any) => transactions.getPendingForPubkey(req), dtos.TxHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/tx/pending', (req:any) => transactions.getPending(), dtos.TxPending, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/ud/history/:pubkey', (req:any) => dividend.getHistory(req), dtos.UDHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/ud/history/:pubkey/blocks/:from/:to', (req:any) => dividend.getHistoryBetweenBlocks(req), dtos.UDHistory, BMALimitation.limitAsHighUsage());
httpMethods.httpGET( '/ud/history/:pubkey/times/:from/:to', (req:any) => dividend.getHistoryBetweenTimes(req), dtos.UDHistory, BMALimitation.limitAsHighUsage());
}, (httpServer:any) => {
......
import {AbstractController} from "./AbstractController"
import {ParametersService} from "../parameters"
import {Source} from "../entity/source"
import {BMAConstants} from "../constants";
const _ = require('underscore');
const common = require('duniter-common');
......@@ -11,7 +12,7 @@ const Transaction = common.document.Transaction
export class TransactionBinding extends AbstractController {
parseTransaction(req:any) {
return this.pushEntity(req, http2raw.transaction, constants.ENTITY_TRANSACTION)
return this.pushEntity(req, http2raw.transaction, BMAConstants.ENTITY_TRANSACTION)
}
async getSources(req:any) {
......@@ -32,7 +33,7 @@ export class TransactionBinding extends AbstractController {
const hash = ParametersService.getHash(req);
const tx = await this.server.dal.getTxByHash(hash);
if (!tx) {
throw constants.ERRORS.TX_NOT_FOUND;
throw BMAConstants.ERRORS.TX_NOT_FOUND;
}
if (tx.block_number) {
tx.written_block = tx.block_number
......
......@@ -163,7 +163,7 @@ export const Network = {
}
// Return API
return new BmaApi(interfaces, ddosInstance, httpServers, logger)
return new BmaApi(name, interfaces, ddosInstance, httpServers, logger)
}
}
......@@ -172,6 +172,7 @@ export class BmaApi {
private listenings:boolean[]
constructor(
private name:string,
private interfaces:any,
private ddosInstance:any,
private httpServers:any,
......@@ -192,7 +193,7 @@ export class BmaApi {
const isListening = this.listenings[i];
if (isListening) {
this.listenings[i] = false;
this.logger && this.logger.info(name + ' stop listening');
this.logger && this.logger.info(this.name + ' stop listening');
await Q.Promise((resolve:any, reject:any) => {
httpServer.errorPropagates((err:any) => {
reject(err);
......
import {CrawlerConstants} from "./constants"
const rp = require('request-promise');
const sanitize = require('duniter-bma').duniter.methods.sanitize;
const dtos = require('duniter-bma').duniter.methods.dtos;
const sanitize = require('../../../modules/bma').BmaDependency.duniter.methods.sanitize;
const dtos = require('../../../modules/bma').BmaDependency.duniter.methods.dtos;
export class Contacter {
......
......@@ -374,7 +374,7 @@ export class BlockCrawler {
return server.dal.getCurrentBlockOrNull()
}
async remoteCurrent(source?: any): Promise<BlockDTO | null> {
return thePeer.getCurrent()
return source.getCurrent()
}
async remotePeers(source?: any): Promise<PeerDTO[]> {
return Promise.resolve([node])
......
......@@ -3,9 +3,9 @@ import {BlockGenerator, BlockGeneratorWhichProves} from "./lib/blockGenerator"
import {Constants} from "./lib/constants"
import {BlockProver} from "./lib/blockProver"
import {Prover} from "./lib/prover"
import {Contacter} from "../crawler/lib/contacter";
const async = require('async');
const contacter = require('duniter-crawler').duniter.methods.contacter;
const common = require('duniter-common');
const Peer = common.document.Peer
......@@ -191,7 +191,7 @@ function proveAndSend(program:any, server:any, block:any, issuer:any, difficulty
program.show && console.log(proven.getRawSigned());
logger.info('Posted block ' + proven.getRawSigned());
const p = Peer.fromJSON(peer);
const contact = contacter(p.getHostPreferDNS(), p.getPort());
const contact = new Contacter(p.getHostPreferDNS(), p.getPort());
await contact.postBlock(proven.getRawSigned());
} catch(e) {
next(e);
......
......@@ -49,18 +49,28 @@
"archiver": "1.3.0",
"async": "2.2.0",
"bindings": "1.2.1",
"body-parser": "1.17.1",
"bs58": "^4.0.1",
"co": "4.6.0",
"colors": "1.1.2",
"cors": "2.8.2",
"commander": "2.9.0",
"daemonize2": "0.4.2",
"ddos": "0.1.16",
"duniter-common": "1.4.x",
"event-stream": "3.3.4",
"errorhandler": "1.5.0",
"express": "4.15.2",
"express-cors": "0.0.3",
"express-fileupload": "0.0.5",
"heapdump": "^0.3.9",
"inquirer": "3.0.6",
"merkle": "0.5.1",
"moment": "2.18.1",
"morgan": "1.8.1",
"multimeter": "0.1.1",
"naclb": "1.3.9",
"nnupnp": "1.0.2",
"node-pre-gyp": "0.6.34",
"optimist": "0.6.1",
"q-io": "1.13.2",
......@@ -69,6 +79,7 @@
"request-promise": "4.2.0",
"seedrandom": "^2.4.3",
"sha1": "1.1.1",
"scryptb": "6.0.4",
"spawn-sync": "^1.0.15",
"sqlite3": "3.1.4",
"superagent": "3.5.2",
......@@ -78,14 +89,14 @@
"unzip": "0.1.11",
"unzip2": "0.2.5",
"winston": "2.3.1",
"wotb": "0.5.x"
"wotb": "0.5.x",
"ws": "1.1.1"
},
"devDependencies": {
"@types/mocha": "^2.2.41",
"@types/node": "^8.0.9",
"@types/should": "^8.3.0",
"coveralls": "2.11.4",
"duniter-ui": "1.3.x",
"eslint": "3.13.1",
"eslint-plugin-mocha": "4.8.0",
"istanbul": "0.4.0",
......
......@@ -66,7 +66,7 @@ export class Server extends stream.Duplex implements HookableServer {
this.paramsP = directory.getHomeParams(memoryOnly, home)
this.MerkleService = require("./app/lib/helpers/merkle");
this.MerkleService = require("./app/lib/helpers/merkle").processForURL
this.IdentityService = new IdentityService()
this.MembershipService = new MembershipService()
this.PeeringService = new PeeringService(this)
......
......@@ -4,7 +4,7 @@ const _ = require('underscore');
const co = require('co');
const should = require('should');
const duniter = require('../../index');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const rp = require('request-promise');
const httpTest = require('./tools/http');
......
......@@ -3,7 +3,7 @@
const co = require('co');
const _ = require('underscore');
const duniter = require('../../index');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const constants = require('../../app/lib/constants');
const rp = require('request-promise');
......@@ -15,7 +15,7 @@ const expectJSON = httpTest.expectJSON;
const expectHttpCode = httpTest.expectHttpCode;
if (constants.MUTE_LOGS_DURING_UNIT_TESTS) {
require('../../app/lib/logger').NewLogger().mute();
// require('../../app/lib/logger').NewLogger().mute();
}
// Trace these errors
......@@ -72,8 +72,8 @@ describe("SelfFork", function() {
yield s1.initWithDAL().then(bma).then((bmapi) => bmapi.openConnections());
yield s2.initWithDAL().then(bma).then((bmapi) => bmapi.openConnections());
s1.getMainEndpoint = require('duniter-bma').duniter.methods.getMainEndpoint
s2.getMainEndpoint = require('duniter-bma').duniter.methods.getMainEndpoint
s1.getMainEndpoint = require('../../app/modules/bma').BmaDependency.duniter.methods.getMainEndpoint
s2.getMainEndpoint = require('../../app/modules/bma').BmaDependency.duniter.methods.getMainEndpoint
// Server 1
yield cat.createIdentity();
......@@ -106,7 +106,7 @@ describe("SelfFork", function() {
yield s1.singleWritePromise(s2p);
// Forking S1 from S2
return require('duniter-crawler').duniter.methods.pullBlocks(s1, s2p.pubkey);
return require('../../app/modules/crawler').CrawlerDependency.duniter.methods.pullBlocks(s1, s2p.pubkey);
}));
describe("Server 1 /blockchain", function() {
......
......@@ -3,7 +3,7 @@
const co = require('co');
const _ = require('underscore');
const duniter = require('../../index');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const rp = require('request-promise');
const httpTest = require('./tools/http');
......
......@@ -2,7 +2,7 @@
const co = require('co');
const _ = require('underscore');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const toolbox = require('./tools/toolbox');
const commit = require('./tools/commit');
......
......@@ -3,14 +3,14 @@
const co = require('co');
const _ = require('underscore');
const duniter = require('../../index');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const rp = require('request-promise');
const httpTest = require('./tools/http');
const commit = require('./tools/commit');
require('../../app/modules/prover/lib/constants').Constants.CORES_MAXIMUM_USE_IN_PARALLEL = 1
require('duniter-bma').duniter.methods.noLimit(); // Disables the HTTP limiter
require('../../app/modules/bma').BmaDependency.duniter.methods.noLimit(); // Disables the HTTP limiter
const expectJSON = httpTest.expectJSON;
const expectHttpCode = httpTest.expectHttpCode;
......
......@@ -2,7 +2,7 @@
const co = require('co');
const should = require('should');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const commit = require('./tools/commit');
const toolbox = require('./tools/toolbox');
......
......@@ -3,7 +3,7 @@
const co = require('co');
const _ = require('underscore');
const duniter = require('../../index');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const rp = require('request-promise');
const httpTest = require('./tools/http');
......@@ -57,8 +57,8 @@ describe("Switch", function() {
before(() => co(function *() {
yield s1.initWithDAL().then(bma).then((bmapi) => bmapi.openConnections());
yield s2.initWithDAL().then(bma).then((bmapi) => bmapi.openConnections());
s1.getMainEndpoint = require('duniter-bma').duniter.methods.getMainEndpoint
s2.getMainEndpoint = require('duniter-bma').duniter.methods.getMainEndpoint
s1.getMainEndpoint = require('../../app/modules/bma').BmaDependency.duniter.methods.getMainEndpoint
s2.getMainEndpoint = require('../../app/modules/bma').BmaDependency.duniter.methods.getMainEndpoint
yield cat.createIdentity();
yield toc.createIdentity();
yield toc.cert(cat);
......@@ -87,7 +87,7 @@ describe("Switch", function() {
yield s1.singleWritePromise(s2p);
// Forking S1 from S2
yield require('duniter-crawler').duniter.methods.pullBlocks(s1, s2p.pubkey);
yield require('../../app/modules/crawler').CrawlerDependency.duniter.methods.pullBlocks(s1, s2p.pubkey);
// S1 should have switched to the other branch
}));
......
......@@ -4,7 +4,7 @@ const _ = require('underscore');
const co = require('co');
const should = require('should');
const duniter = require('../../index');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const constants = require('../../app/lib/constants');
const rp = require('request-promise');
......
......@@ -5,7 +5,7 @@ const co = require('co');
const assert = require('assert');
const should = require('should');
const duniter = require('../../index');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const constants = require('../../app/lib/constants');
const toolbox = require('./tools/toolbox');
......
......@@ -3,7 +3,7 @@
const co = require('co');
const _ = require('underscore');
const duniter = require('../../index');
const bma = require('duniter-bma').duniter.methods.bma;
const bma = require('../../app/modules/bma').BmaDependency.duniter.methods.bma;
const user = require('./tools/user');
const commit = require('./tools/commit');
const httpTest = require('./tools/http');
......
......@@ -106,7 +106,7 @@ describe("Continous proof-of-work", function() {
yield s2.until('block', 15);
s2.stopBlockComputation();
yield [
require('duniter-crawler').duniter.methods.pullBlocks(s3),
require('../../app/modules/crawler').CrawlerDependency.duniter.methods.pullBlocks(s3),
s3.startBlockComputation()
];
yield s3.expectJSON('/blockchain/current', { number: 15 });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment