Skip to content

Commit 1880aeb

Browse files
committed
Qt: Get the private key for signing messages via WalletModel
1 parent 3cd836c commit 1880aeb

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/qt/signverifymessagedialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
142142
}
143143

144144
CKey key;
145-
if (!pwalletMain->GetKey(keyID, key))
145+
if (!model->getPrivKey(keyID, key))
146146
{
147147
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
148148
ui->statusLabel_SM->setText(tr("Private key for the entered address is not available."));

src/qt/walletmodel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,11 @@ bool WalletModel::havePrivKey(const CKeyID &address) const
563563
return wallet->HaveKey(address);
564564
}
565565

566+
bool WalletModel::getPrivKey(const CKeyID &address, CKey& vchPrivKeyOut) const
567+
{
568+
return wallet->GetKey(address, vchPrivKeyOut);
569+
}
570+
566571
// returns a list of COutputs from COutPoints
567572
void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs)
568573
{

src/qt/walletmodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class WalletModel : public QObject
188188

189189
bool getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const;
190190
bool havePrivKey(const CKeyID &address) const;
191+
bool getPrivKey(const CKeyID &address, CKey& vchPrivKeyOut) const;
191192
void getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs);
192193
bool isSpent(const COutPoint& outpoint) const;
193194
void listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const;

0 commit comments

Comments
 (0)