Last active
July 7, 2020 14:26
-
-
Save nakajo2011/2d45cef2cec971987f2a63db1fceae48 to your computer and use it in GitHub Desktop.
miner.stop test, but it happen error.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('multi transfer in same block', async () => { | |
web3.extend({property: 'mine', methods: [{ name: 'start', call: 'miner_start', params:0}]}) | |
web3.extend({property: 'mine', methods: [{ name: 'stop', call: 'miner_stop', params:0}]}) | |
const instance = await MyERC20Token.new() | |
const beforeBlock = await web3.eth.getBlockNumber() | |
await web3.mine.stop() | |
// queued tx1 | |
await instance.transfer(accounts[1], 100) | |
// queued tx2 | |
await instance.transfer(accounts[2], 100) | |
await web3.mine.start() | |
const afterBlock = await web3.eth.getBlockNumber(); | |
assert.equal(beforeBlock+1, afterBlock) // block increase just +1. | |
assert.equal(await Instance.balanceOf(accounts[1]), 100) | |
assert.equal(await Instance.balanceOf(accounts[2]), 100) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment