wallet-rpc-test: don't modify global coinbase.
This commit is contained in:
parent
782801689e
commit
c7605ac5d0
@ -13,6 +13,7 @@ const Script = require('../lib/script/script');
|
|||||||
const Address = require('../lib/primitives/address');
|
const Address = require('../lib/primitives/address');
|
||||||
const network = Network.get('regtest');
|
const network = Network.get('regtest');
|
||||||
const mnemonics = require('./data/mnemonic-english.json');
|
const mnemonics = require('./data/mnemonic-english.json');
|
||||||
|
const {forValue} = require('./util/common');
|
||||||
// Commonly used test mnemonic
|
// Commonly used test mnemonic
|
||||||
const phrase = mnemonics[0][1];
|
const phrase = mnemonics[0][1];
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ const node = new FullNode({
|
|||||||
walletAuth: true,
|
walletAuth: true,
|
||||||
memory: true,
|
memory: true,
|
||||||
workers: true,
|
workers: true,
|
||||||
|
workersSize: 2,
|
||||||
plugins: [require('../lib/wallet/plugin')],
|
plugins: [require('../lib/wallet/plugin')],
|
||||||
port: ports.p2p,
|
port: ports.p2p,
|
||||||
httpPort: ports.node,
|
httpPort: ports.node,
|
||||||
@ -40,7 +42,8 @@ const {wdb} = node.require('walletdb');
|
|||||||
|
|
||||||
const nclient = new NodeClient({
|
const nclient = new NodeClient({
|
||||||
port: ports.node,
|
port: ports.node,
|
||||||
apiKey: 'bar'
|
apiKey: 'bar',
|
||||||
|
timeout: 15000
|
||||||
});
|
});
|
||||||
|
|
||||||
const wclient = new WalletClient({
|
const wclient = new WalletClient({
|
||||||
@ -48,8 +51,6 @@ const wclient = new WalletClient({
|
|||||||
apiKey: 'bar'
|
apiKey: 'bar'
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultCoinbaseMaturity = consensus.COINBASE_MATURITY;
|
|
||||||
|
|
||||||
describe('Wallet RPC Methods', function() {
|
describe('Wallet RPC Methods', function() {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
|
|
||||||
@ -64,7 +65,6 @@ describe('Wallet RPC Methods', function() {
|
|||||||
let utxo = null;
|
let utxo = null;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
consensus.COINBASE_MATURITY = 0;
|
|
||||||
await node.open();
|
await node.open();
|
||||||
|
|
||||||
// Derive the xpub using the well known
|
// Derive the xpub using the well known
|
||||||
@ -100,10 +100,12 @@ describe('Wallet RPC Methods', function() {
|
|||||||
const account = await walletMiner.getAccount('default');
|
const account = await walletMiner.getAccount('default');
|
||||||
addressMiner = account.receiveAddress;
|
addressMiner = account.receiveAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await nclient.execute('generatetoaddress', [102, addressMiner]);
|
||||||
|
await forValue(wdb, 'height', 102);
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
consensus.COINBASE_MATURITY = defaultCoinbaseMaturity;
|
|
||||||
await node.close();
|
await node.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -134,7 +136,6 @@ describe('Wallet RPC Methods', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should rpc sendtoaddress', async () => {
|
it('should rpc sendtoaddress', async () => {
|
||||||
await nclient.execute('generatetoaddress', [2, addressMiner]);
|
|
||||||
await wclient.execute('selectwallet', ['miner']);
|
await wclient.execute('selectwallet', ['miner']);
|
||||||
|
|
||||||
const txid = await wclient.execute('sendtoaddress', [addressHot, 0.1234]);
|
const txid = await wclient.execute('sendtoaddress', [addressHot, 0.1234]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user