Skip to content

Commit

Permalink
Merge 861460f into 6de1b4d
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjablack committed Sep 5, 2019
2 parents 6de1b4d + 861460f commit f462ac7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/bitcoin-rpc-provider/lib/BitcoinRpcProvider.js
Expand Up @@ -80,7 +80,8 @@ export default class BitcoinRpcProvider extends JsonRpcProvider {
}

async generateBlock (numberOfBlocks) {
return this.jsonrpc('generate', numberOfBlocks)
const newAddress = await this.jsonrpc('getnewaddress')
return this.jsonrpc('generatetoaddress', numberOfBlocks, newAddress)
}

async getBlockByHash (blockHash, includeTx = false) {
Expand Down
22 changes: 20 additions & 2 deletions test/integration/chain/chain.js
Expand Up @@ -20,10 +20,28 @@ function testGetBlock (chain) {
})
}

describe('Send Transactions', function () {
function testGenerateBlock (chain) {
it('should generate a new block', async () => {
const blockHeightBefore = await chain.client.chain.getBlockHeight()
await chain.client.chain.generateBlock(1)
const blockHeightAfter = await chain.client.chain.getBlockHeight()

expect(blockHeightAfter).to.equal(blockHeightBefore + 1)
})
}

describe('Block Numbers', function () {
this.timeout(config.timeout)

describe('Bitcoin - Ledger', () => {
describe('Bitcoin - Node', () => {
testGetBlock(chains.bitcoinWithNode)
})
})

describe('Block Generate', function () {
this.timeout(config.timeout)

describe('Bitcoin - Node', () => {
testGenerateBlock(chains.bitcoinWithNode)
})
})
2 changes: 1 addition & 1 deletion test/integration/config.js
@@ -1,7 +1,7 @@
export default {
bitcoin: {
rpc: {
host: 'http://localhost:18332',
host: 'http://localhost:18443',
username: 'bitcoin',
password: 'local321'
},
Expand Down

0 comments on commit f462ac7

Please sign in to comment.