mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Wallet Repair Buttons: initial commit
This commit is contained in:
parent
de562d89f7
commit
8c4175b359
5
src/qt/bitcoingui.cpp
Normal file → Executable file
5
src/qt/bitcoingui.cpp
Normal file → Executable file
@ -217,6 +217,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
|
||||
connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(showConsole()));
|
||||
connect(openNetworkAction, SIGNAL(triggered()), rpcConsole, SLOT(showNetwork()));
|
||||
connect(openPeersAction, SIGNAL(triggered()), rpcConsole, SLOT(showPeers()));
|
||||
connect(openRepairAction, SIGNAL(triggered()), rpcConsole, SLOT(showRepair()));
|
||||
connect(openConfEditorAction, SIGNAL(triggered()), rpcConsole, SLOT(showConfEditor()));
|
||||
connect(showBackupsAction, SIGNAL(triggered()), rpcConsole, SLOT(showBackups()));
|
||||
connect(labelConnectionsIcon, SIGNAL(clicked()), rpcConsole, SLOT(showPeers()));
|
||||
@ -352,6 +353,8 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
|
||||
openNetworkAction->setStatusTip(tr("Show network monitor"));
|
||||
openPeersAction = new QAction(QIcon(":/icons/connect_4"), tr("&Peers list"), this);
|
||||
openPeersAction->setStatusTip(tr("Show peers info"));
|
||||
openRepairAction = new QAction(QIcon(":/icons/options"), tr("&Repair Wallet"), this);
|
||||
openRepairAction->setStatusTip(tr("Repair Wallet Options"));
|
||||
openConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open &Configuration File"), this);
|
||||
openConfEditorAction->setStatusTip(tr("Open configuration file"));
|
||||
showBackupsAction = new QAction(QIcon(":/icons/browse"), tr("Show Automatic &Backups"), this);
|
||||
@ -435,6 +438,7 @@ void BitcoinGUI::createMenuBar()
|
||||
tools->addAction(openRPCConsoleAction);
|
||||
tools->addAction(openNetworkAction);
|
||||
tools->addAction(openPeersAction);
|
||||
tools->addAction(openRepairAction);
|
||||
tools->addSeparator();
|
||||
tools->addAction(openConfEditorAction);
|
||||
tools->addAction(showBackupsAction);
|
||||
@ -602,6 +606,7 @@ void BitcoinGUI::createTrayIconMenu()
|
||||
trayIconMenu->addAction(openRPCConsoleAction);
|
||||
trayIconMenu->addAction(openNetworkAction);
|
||||
trayIconMenu->addAction(openPeersAction);
|
||||
trayIconMenu->addAction(openRepairAction);
|
||||
trayIconMenu->addSeparator();
|
||||
trayIconMenu->addAction(openConfEditorAction);
|
||||
trayIconMenu->addAction(showBackupsAction);
|
||||
|
1
src/qt/bitcoingui.h
Normal file → Executable file
1
src/qt/bitcoingui.h
Normal file → Executable file
@ -109,6 +109,7 @@ private:
|
||||
QAction *openRPCConsoleAction;
|
||||
QAction *openNetworkAction;
|
||||
QAction *openPeersAction;
|
||||
QAction *openRepairAction;
|
||||
QAction *openConfEditorAction;
|
||||
QAction *showBackupsAction;
|
||||
QAction *openAction;
|
||||
|
@ -1064,6 +1064,257 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_repair">
|
||||
<attribute name="title">
|
||||
<string>&Wallet Repair</string>
|
||||
</attribute>
|
||||
<widget class="QPushButton" name="btn_salvagewallet">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Salvage Wallet</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_rescan">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rescan blockhain files</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_zapwallettxes1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>190</y>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Recover transactions 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_zapwallettxes2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>240</y>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Recover transactions 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_upgradewallet">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>290</y>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Upgrade wallet format</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_repair_helptext">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>711</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>The buttons below will restart the wallet with command-line options to repair the wallet, fix issues with corrupt blockhain files or missing/obsolete transactions.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_repair_salvage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>80</y>
|
||||
<width>511</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-salvagewallet: Attempt to recover private keys from a corrupt wallet.dat.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_repair_rescan">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>129</y>
|
||||
<width>511</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-rescan: Rescan the block chain for missing wallet transactions.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_repair_zap1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>179</y>
|
||||
<width>511</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-zapwallettxes=1: Recover transactions from blockchain (keep meta-data, e.g. account owner).</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_repair_zap2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>229</y>
|
||||
<width>511</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-zapwallettxes=2: Recover transactions from blockchain (drop meta-data).</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_repair_upgrade">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>279</y>
|
||||
<width>511</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-upgradewallet: Upgrade wallet to latest format on startup. (Note: this is NOT an update of the wallet itself !)</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_repair_header">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>711</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Wallet repair options.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_reindex">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>340</y>
|
||||
<width>181</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rebuild index</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_repair_reindex">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>330</y>
|
||||
<width>511</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-reindex: Rebuild block chain index from current blk000??.dat files.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -221,6 +221,14 @@ RPCConsole::RPCConsole(QWidget *parent) :
|
||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||
connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear()));
|
||||
|
||||
// Wallet Repair
|
||||
connect(ui->btn_salvagewallet, SIGNAL(clicked()), this, SLOT(wallet_salvage()));
|
||||
connect(ui->btn_rescan, SIGNAL(clicked()), this, SLOT(wallet_rescan()));
|
||||
connect(ui->btn_zapwallettxes1, SIGNAL(clicked()), this, SLOT(wallet_zaptxes1()));
|
||||
connect(ui->btn_zapwallettxes2, SIGNAL(clicked()), this, SLOT(wallet_zaptxes2()));
|
||||
connect(ui->btn_upgradewallet, SIGNAL(clicked()), this, SLOT(wallet_upgrade()));
|
||||
connect(ui->btn_reindex, SIGNAL(clicked()), this, SLOT(wallet_reindex()));
|
||||
|
||||
// set library version labels
|
||||
ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION));
|
||||
#ifdef ENABLE_WALLET
|
||||
@ -336,6 +344,61 @@ static QString categoryClass(int category)
|
||||
}
|
||||
}
|
||||
|
||||
void RPCConsole::wallet_salvage()
|
||||
{
|
||||
restart(1);
|
||||
}
|
||||
|
||||
void RPCConsole::wallet_rescan()
|
||||
{
|
||||
restart(2);
|
||||
}
|
||||
|
||||
void RPCConsole::wallet_zaptxes1()
|
||||
{
|
||||
restart(3);
|
||||
}
|
||||
|
||||
void RPCConsole::wallet_zaptxes2()
|
||||
{
|
||||
restart(4);
|
||||
}
|
||||
|
||||
void RPCConsole::wallet_upgrade()
|
||||
{
|
||||
restart(5);
|
||||
}
|
||||
|
||||
void RPCConsole::wallet_reindex()
|
||||
{
|
||||
restart(6);
|
||||
}
|
||||
|
||||
void RPCConsole::restart(int reason)
|
||||
{
|
||||
switch(reason)
|
||||
{
|
||||
case 1: // -salvagewallet
|
||||
printf("-salvagewallet\n");
|
||||
break;
|
||||
case 2: // -rescan
|
||||
printf("-rescan\n");
|
||||
break;
|
||||
case 3: // -zapwallettxes=1
|
||||
printf("-zapwallettxes=1\n");
|
||||
break;
|
||||
case 4: // -zapwallettxes=2
|
||||
printf("-zapwallettxes=2\n");
|
||||
break;
|
||||
case 5: // -upgradewallet
|
||||
printf("-upgradewallet\n");
|
||||
break;
|
||||
case 6: // -reindex
|
||||
printf("-reindex\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RPCConsole::clear()
|
||||
{
|
||||
ui->messagesWidget->clear();
|
||||
@ -550,6 +613,12 @@ void RPCConsole::showPeers()
|
||||
show();
|
||||
}
|
||||
|
||||
void RPCConsole::showRepair()
|
||||
{
|
||||
ui->tabWidget->setCurrentIndex(4);
|
||||
show();
|
||||
}
|
||||
|
||||
void RPCConsole::showConfEditor()
|
||||
{
|
||||
GUIUtil::openConfigfile();
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
~RPCConsole();
|
||||
|
||||
void setClientModel(ClientModel *model);
|
||||
void restart(int reason);
|
||||
|
||||
enum MessageClass {
|
||||
MC_ERROR,
|
||||
@ -59,6 +60,15 @@ private slots:
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
||||
/** Wallet repair options */
|
||||
void wallet_salvage();
|
||||
void wallet_rescan();
|
||||
void wallet_zaptxes1();
|
||||
void wallet_zaptxes2();
|
||||
void wallet_upgrade();
|
||||
void wallet_reindex();
|
||||
|
||||
void reject();
|
||||
void message(int category, const QString &message, bool html = false);
|
||||
/** Set number of connections shown in the UI */
|
||||
@ -79,6 +89,8 @@ public slots:
|
||||
void showNetwork();
|
||||
/** Switch to peers tab and show */
|
||||
void showPeers();
|
||||
/** Switch to wallet-repair tab and show */
|
||||
void showRepair();
|
||||
/** Open external (default) editor with dash.conf */
|
||||
void showConfEditor();
|
||||
/** Handle selection of peer in peers list */
|
||||
|
Loading…
Reference in New Issue
Block a user