| 495 | } |
| 496 | |
| 497 | void Client::resyncStateFromChain() |
| 498 | { |
| 499 | // RESTART MINING |
| 500 | |
| 501 | // ctrace << "resyncStateFromChain()"; |
| 502 | |
| 503 | if (!isMajorSyncing()) |
| 504 | { |
| 505 | bool preChanged = false; |
| 506 | Block newPreMine(chainParams().accountStartNonce); |
| 507 | DEV_READ_GUARDED(x_preSeal) |
| 508 | newPreMine = m_preSeal; |
| 509 | |
| 510 | // TODO: use m_postSeal to avoid re-evaluating our own blocks. |
| 511 | preChanged = newPreMine.sync(bc()); |
| 512 | |
| 513 | if (preChanged || m_postSeal.author() != m_preSeal.author()) |
| 514 | { |
| 515 | DEV_WRITE_GUARDED(x_preSeal) |
| 516 | m_preSeal = newPreMine; |
| 517 | DEV_WRITE_GUARDED(x_working) |
| 518 | m_working = newPreMine; |
| 519 | DEV_READ_GUARDED(x_postSeal) |
| 520 | if (!m_postSeal.isSealed() || m_postSeal.info().hash() != newPreMine.info().parentHash()) |
| 521 | for (auto const& t: m_postSeal.pending()) |
| 522 | { |
| 523 | clog(ClientTrace) << "Resubmitting post-seal transaction " << t; |
| 524 | // ctrace << "Resubmitting post-seal transaction " << t; |
| 525 | auto ir = m_tq.import(t, IfDropped::Retry); |
| 526 | if (ir != ImportResult::Success) |
| 527 | onTransactionQueueReady(); |
| 528 | } |
| 529 | DEV_READ_GUARDED(x_working) DEV_WRITE_GUARDED(x_postSeal) |
| 530 | m_postSeal = m_working; |
| 531 | |
| 532 | onPostStateChanged(); |
| 533 | } |
| 534 | |
| 535 | // Quick hack for now - the TQ at this point already has the prior pending transactions in it; |
| 536 | // we should resync with it manually until we are stricter about what constitutes "knowing". |
| 537 | onTransactionQueueReady(); |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | void Client::resetState() |
| 542 | { |
nothing calls this directly
no test coverage detected