How can one set the block height of testrpc so that a contract can react on the new height.
Concrete problem is that I want to write an automated test that shows that after a certain block number conditional can be executed.
How can one set the block height of testrpc so that a contract can react on the new height.
Concrete problem is that I want to write an automated test that shows that after a certain block number conditional can be executed.
Since testrpc mines one block per transaction, you could just send transactions until the corrrect block height is reached.
If you're doing automated testing, you can use the evm_snapshot and evm_revert commands so that you don't need to send the transactions on every test, just once at the beginning.
evm_snapshot?
– Yuanfei Zhu
Jul 26 '17 at 10:02
block2.number - block1.numberis sufficient? – Raine Revere Jul 11 '16 at 17:51testrpcand run exactly enough transactions to get to a certain block number, but that seems unrealistic. In the real world you will only be able to control relative block numbers, not exact. – Raine Revere Jul 11 '16 at 17:52