testChain.State() is used multiple times to reset the pending state. when simulate is true it will create a state that indicates that tx0 and tx1 are included in the chain.
()
| 160 | // when simulate is true it will create a state that indicates |
| 161 | // that tx0 and tx1 are included in the chain. |
| 162 | func (c *testChain) State() (*state.StateDB, error) { |
| 163 | // delay "state change" by one. The tx pool fetches the |
| 164 | // state multiple times and by delaying it a bit we simulate |
| 165 | // a state change between those fetches. |
| 166 | stdb := c.statedb |
| 167 | if *c.trigger { |
| 168 | c.statedb, _ = state.New(common.Hash{}, state.NewDatabase(database.NewMemDatabase())) |
| 169 | // simulate that the new head block included tx0 and tx1 |
| 170 | c.statedb.SetNonce(c.address, 2) |
| 171 | c.statedb.SetBalance(c.address, new(big.Int).SetUint64(configs.Cpc)) |
| 172 | *c.trigger = false |
| 173 | } |
| 174 | return stdb, nil |
| 175 | } |
| 176 | |
| 177 | // This test simulates a scenario where a new block is imported during a |
| 178 | // state reset and tests whether the pending state is in sync with the |
nothing calls this directly
no test coverage detected