Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
miner.stop test, but it happen error.
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