aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2016-09-08 07:17:33 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2016-10-04 20:30:10 +0000
commit1880aeb0336324ed543c7d181c7b1509bc1cce7a (patch)
tree1a9f1cb4e841d5c3256bea034ddb04343283e1e8 /src/qt
parent3cd836c1d855b92e7c73ab31979f471c4f8dad68 (diff)
Qt: Get the private key for signing messages via WalletModel
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/signverifymessagedialog.cpp2
-rw-r--r--src/qt/walletmodel.cpp5
-rw-r--r--src/qt/walletmodel.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp
index 96f50a2656..fa8cf9d686 100644
--- a/src/qt/signverifymessagedialog.cpp
+++ b/src/qt/signverifymessagedialog.cpp
@@ -142,7 +142,7 @@ void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
}
CKey key;
- if (!pwalletMain->GetKey(keyID, key))
+ if (!model->getPrivKey(keyID, key))
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("Private key for the entered address is not available."));
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index 690ea0811e..62655be517 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -563,6 +563,11 @@ bool WalletModel::havePrivKey(const CKeyID &address) const
return wallet->HaveKey(address);
}
+bool WalletModel::getPrivKey(const CKeyID &address, CKey& vchPrivKeyOut) const
+{
+ return wallet->GetKey(address, vchPrivKeyOut);
+}
+
// returns a list of COutputs from COutPoints
void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs)
{
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index a5e877d81f..f15e5fc6f4 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -188,6 +188,7 @@ public:
bool getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const;
bool havePrivKey(const CKeyID &address) const;
+ bool getPrivKey(const CKeyID &address, CKey& vchPrivKeyOut) const;
void getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs);
bool isSpent(const COutPoint& outpoint) const;
void listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const;