Exemple #1
0
void MixClient::resetState(std::unordered_map<Address, Account> const& _accounts,  Secret const& _miner)
{
	WriteGuard l(x_state);
	Guard fl(x_filtersWatches);

	m_filters.clear();
	for (auto& i: m_specialFilters)
		i.second.clear();
	m_watches.clear();

	m_stateDB = OverlayDB();
	SecureTrieDB<Address, MemoryDB> accountState(&m_stateDB);
	accountState.init();

	dev::eth::commit(_accounts, accountState);
	h256 stateRoot = accountState.root();
	m_bc.reset();
	m_bc.reset(new MixBlockChain(m_dbPath, stateRoot));
	Block b(m_stateDB, BaseState::PreExisting, KeyPair(_miner).address());
	b.sync(bc());
	m_preMine = b;
	m_postMine = b;
	WriteGuard lx(x_executions);
	m_executions.clear();
}
Exemple #2
0
void MixClient::resetState(std::map<Secret, u256> _accounts, Secret _miner)
{
	WriteGuard l(x_state);
	Guard fl(x_filtersWatches);
	m_filters.clear();
	m_watches.clear();

	m_stateDB = OverlayDB();
	SecureTrieDB<Address, MemoryDB> accountState(&m_stateDB);
	accountState.init();

	m_userAccounts.clear();
	std::map<Address, Account> genesisState;
	for (auto account: _accounts)
	{
		KeyPair a = KeyPair(account.first);
		m_userAccounts.push_back(a);
		genesisState.insert(std::make_pair(a.address(), Account(account.second, Account::NormalCreation)));
	}

	dev::eth::commit(genesisState, static_cast<MemoryDB&>(m_stateDB), accountState);
	h256 stateRoot = accountState.root();
	m_bc.reset();
	m_bc.reset(new MixBlockChain(m_dbPath, stateRoot));
	m_state = eth::State(m_stateDB, BaseState::PreExisting, KeyPair(_miner).address());
	m_state.sync(bc());
	m_startState = m_state;
	WriteGuard lx(x_executions);
	m_executions.clear();
}
void IssuesWidget::showFolderErrors(const QString &folderAlias)
{
    auto folder = FolderMan::instance()->folder(folderAlias);
    if (!folder)
        return;

    _ui->filterAccount->setCurrentIndex(
        qMax(0, _ui->filterAccount->findData(QVariant::fromValue(folder->accountState()))));
    _ui->filterFolder->setCurrentIndex(
        qMax(0, _ui->filterFolder->findData(folderAlias)));
    _ui->showIgnores->setChecked(false);
    _ui->showWarnings->setChecked(false);
}
bool IssuesWidget::shouldBeVisible(QTreeWidgetItem *item, AccountState *filterAccount,
    const QString &filterFolderAlias) const
{
    bool visible = true;
    auto status = ProtocolItem::status(item);
    visible &= (_ui->showIgnores->isChecked() || status != SyncFileItem::FileIgnored);
    visible &= (_ui->showWarnings->isChecked()
        || (status != SyncFileItem::SoftError
               && status != SyncFileItem::Restoration));

    auto folderalias = ProtocolItem::folderName(item);
    if (filterAccount) {
        auto folder = FolderMan::instance()->folder(folderalias);
        visible &= folder && folder->accountState() == filterAccount;
    }
    visible &= (filterFolderAlias.isEmpty() || filterFolderAlias == folderalias);

    return visible;
}
Exemple #5
0
void Folder::etagRetreivedFromSyncEngine(const QString& etag)
{
    qDebug() << "Root etag from during sync:" << etag;
    accountState()->tagLastSuccessfullETagRequest();
    _lastEtag = etag;
}
Exemple #6
0
bool Folder::canSync() const
{
    return !syncPaused() && accountState()->isConnected();
}