Skip to content

Commit 5e56ef5

Browse files
qt: use CHashWriter also in SignVerifyMessageDialog
This eliminates unnecessary copying of data being hashed.
1 parent 08e9c57 commit 5e56ef5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/qt/signverifymessagedialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
148148
return;
149149
}
150150

151-
CDataStream ss(SER_GETHASH, 0);
151+
CHashWriter ss(SER_GETHASH, 0);
152152
ss << strMessageMagic;
153153
ss << ui->messageIn_SM->document()->toPlainText().toStdString();
154154

155155
std::vector<unsigned char> vchSig;
156-
if (!key.SignCompact(Hash(ss.begin(), ss.end()), vchSig))
156+
if (!key.SignCompact(ss.GetHash(), vchSig))
157157
{
158158
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
159159
ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signing failed.") + QString("</nobr>"));
@@ -223,12 +223,12 @@ void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked()
223223
return;
224224
}
225225

226-
CDataStream ss(SER_GETHASH, 0);
226+
CHashWriter ss(SER_GETHASH, 0);
227227
ss << strMessageMagic;
228228
ss << ui->messageIn_VM->document()->toPlainText().toStdString();
229229

230230
CPubKey pubkey;
231-
if (!pubkey.RecoverCompact(Hash(ss.begin(), ss.end()), vchSig))
231+
if (!pubkey.RecoverCompact(ss.GetHash(), vchSig))
232232
{
233233
ui->signatureIn_VM->setValid(false);
234234
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");

0 commit comments

Comments
 (0)