Skip to content

Commit

Permalink
Show correct transaction secret key
Browse files Browse the repository at this point in the history
  • Loading branch information
AxVultis committed Jul 12, 2022
1 parent 075e434 commit 5d6d93f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/WalletAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,12 @@ bool WalletAdapter::checkWalletPassword(const QString& _password) {
return false;
}

crypto::SecretKey WalletAdapter::getTxKey(crypto::Hash& txid)
{
Q_ASSERT(m_wallet != nullptr);
return m_wallet->getTxKey(txid);
}

/* Check if the entered payment ID is valid */
bool WalletAdapter::isValidPaymentId(const QByteArray& _paymentIdString)
{
Expand Down
1 change: 1 addition & 0 deletions src/WalletAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class WalletAdapter : public QObject, public cn::IWalletLegacyObserver {
void transactionUpdated(cn::TransactionId _transactionId) Q_DECL_OVERRIDE;
void depositsUpdated(const std::vector<cn::DepositId>& _depositIds) Q_DECL_OVERRIDE;
bool checkWalletPassword(const QString& _password);
crypto::SecretKey getTxKey(crypto::Hash &txid);
static bool isValidPaymentId(const QByteArray &_paymentIdString);

private:
Expand Down
12 changes: 7 additions & 5 deletions src/gui/TransactionsModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,14 @@ namespace WalletGui
return QByteArray(reinterpret_cast<const char *>(&_transaction.hash), sizeof(_transaction.hash));

case ROLE_SECRETKEY:
if (_transaction.secretKey) {
crypto::SecretKey txkey = _transaction.secretKey.get();
if (txkey != cn::NULL_SECRET_KEY) {
return QByteArray(reinterpret_cast<char*>(&txkey), sizeof(txkey));
}
{
crypto::Hash txHash = _transaction.hash;
crypto::SecretKey txkey = WalletAdapter::instance().getTxKey(txHash);
if (txkey != cn::NULL_SECRET_KEY)
{
return QByteArray(reinterpret_cast<char *>(&txkey), sizeof(txkey));
}
}

case ROLE_ADDRESS:
return QString::fromStdString(_transfer.address);
Expand Down

0 comments on commit 5d6d93f

Please sign in to comment.