OffsetTime modifies the time instance of a block, implicitly changing its associated difficulty. It's useful to test scenarios where forking is not tied to chain length directly.
(milliseconds int64)
| 146 | // associated difficulty. It's useful to test scenarios where forking is not |
| 147 | // tied to chain length directly. |
| 148 | func (b *BlockGen) OffsetTime(milliseconds int64) { |
| 149 | b.header.Time.Add(b.header.Time, new(big.Int).SetInt64(milliseconds)) |
| 150 | if b.header.Time.Cmp(b.parent.Header().Time) <= 0 { |
| 151 | panic("block time out of range") |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | // GenerateChain creates a chain of n blocks. The first block's |
| 156 | // parent will be the provided parent. db is used to store |