test: avoid port collision with a running regtest node
This commit is contained in:
parent
1a18040ad4
commit
3ab296ce22
@ -11,30 +11,38 @@ const Outpoint = require('../lib/primitives/outpoint');
|
|||||||
const MTX = require('../lib/primitives/mtx');
|
const MTX = require('../lib/primitives/mtx');
|
||||||
const FullNode = require('../lib/node/fullnode');
|
const FullNode = require('../lib/node/fullnode');
|
||||||
const pkg = require('../lib/pkg');
|
const pkg = require('../lib/pkg');
|
||||||
const Network = require('../lib/protocol/network');
|
|
||||||
const network = Network.get('regtest');
|
|
||||||
|
|
||||||
if (process.browser)
|
if (process.browser)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const ports = {
|
||||||
|
p2p: 49331,
|
||||||
|
node: 49332,
|
||||||
|
wallet: 49333
|
||||||
|
};
|
||||||
|
|
||||||
const node = new FullNode({
|
const node = new FullNode({
|
||||||
network: 'regtest',
|
network: 'regtest',
|
||||||
apiKey: 'foo',
|
apiKey: 'foo',
|
||||||
walletAuth: true,
|
walletAuth: true,
|
||||||
memory: true,
|
memory: true,
|
||||||
workers: true,
|
workers: true,
|
||||||
plugins: [require('../lib/wallet/plugin')]
|
plugins: [require('../lib/wallet/plugin')],
|
||||||
});
|
port: ports.p2p,
|
||||||
|
httpPort: ports.node,
|
||||||
|
env: {
|
||||||
|
'BCOIN_WALLET_HTTP_PORT': ports.wallet.toString()
|
||||||
|
}});
|
||||||
|
|
||||||
const {NodeClient, WalletClient} = require('bclient');
|
const {NodeClient, WalletClient} = require('bclient');
|
||||||
|
|
||||||
const nclient = new NodeClient({
|
const nclient = new NodeClient({
|
||||||
port: network.rpcPort,
|
port: ports.node,
|
||||||
apiKey: 'foo'
|
apiKey: 'foo'
|
||||||
});
|
});
|
||||||
|
|
||||||
const wclient = new WalletClient({
|
const wclient = new WalletClient({
|
||||||
port: network.walletPort,
|
port: ports.wallet,
|
||||||
apiKey: 'foo'
|
apiKey: 'foo'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -16,12 +16,23 @@ const Peer = require('../lib/net/peer');
|
|||||||
const InvItem = require('../lib/primitives/invitem');
|
const InvItem = require('../lib/primitives/invitem');
|
||||||
const invTypes = InvItem.types;
|
const invTypes = InvItem.types;
|
||||||
|
|
||||||
|
const ports = {
|
||||||
|
p2p: 49331,
|
||||||
|
node: 49332,
|
||||||
|
wallet: 49333
|
||||||
|
};
|
||||||
|
|
||||||
const node = new FullNode({
|
const node = new FullNode({
|
||||||
memory: true,
|
memory: true,
|
||||||
apiKey: 'foo',
|
apiKey: 'foo',
|
||||||
network: 'regtest',
|
network: 'regtest',
|
||||||
workers: true,
|
workers: true,
|
||||||
plugins: [require('../lib/wallet/plugin')]
|
plugins: [require('../lib/wallet/plugin')],
|
||||||
|
port: ports.p2p,
|
||||||
|
httpPort: ports.node,
|
||||||
|
env: {
|
||||||
|
'BCOIN_WALLET_HTTP_PORT': ports.wallet.toString()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const chain = node.chain;
|
const chain = node.chain;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user