Merge pull request #966

d8f3a52 Bugfix with tx proof + update
This commit is contained in:
luigi1111 2017-11-29 17:27:22 -06:00
commit d9d2050f29
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
4 changed files with 24 additions and 17 deletions

View file

@ -65,8 +65,8 @@ Rectangle {
signal paymentClicked(string address, string paymentId, string amount, int mixinCount, int priority, string description) signal paymentClicked(string address, string paymentId, string amount, int mixinCount, int priority, string description)
signal sweepUnmixableClicked() signal sweepUnmixableClicked()
signal generatePaymentIdInvoked() signal generatePaymentIdInvoked()
signal getTxProofClicked(string txid, string address, string message); signal getProofClicked(string txid, string address, string message);
signal checkTxProofClicked(string txid, string address, string message, string signature); signal checkProofClicked(string txid, string address, string message, string signature);
color: "#F0EEEE" color: "#F0EEEE"

View file

@ -243,8 +243,8 @@ ApplicationWindow {
currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged) currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
middlePanel.paymentClicked.disconnect(handlePayment); middlePanel.paymentClicked.disconnect(handlePayment);
middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable); middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable);
middlePanel.getTxProofClicked.disconnect(handleGetTxProof); middlePanel.getProofClicked.disconnect(handleGetProof);
middlePanel.checkTxProofClicked.disconnect(handleCheckTxProof); middlePanel.checkProofClicked.disconnect(handleCheckProof);
} }
currentWallet = undefined; currentWallet = undefined;
@ -276,8 +276,8 @@ ApplicationWindow {
currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged) currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged)
middlePanel.paymentClicked.connect(handlePayment); middlePanel.paymentClicked.connect(handlePayment);
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable); middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
middlePanel.getTxProofClicked.connect(handleGetTxProof); middlePanel.getProofClicked.connect(handleGetProof);
middlePanel.checkTxProofClicked.connect(handleCheckTxProof); middlePanel.checkProofClicked.connect(handleCheckProof);
console.log("Recovering from seed: ", persistentSettings.is_recovering) console.log("Recovering from seed: ", persistentSettings.is_recovering)
@ -757,8 +757,8 @@ ApplicationWindow {
currentWallet.store(); currentWallet.store();
} }
// called on "getTxProof" // called on "getProof"
function handleGetTxProof(txid, address, message) { function handleGetProof(txid, address, message) {
console.log("Getting payment proof: ") console.log("Getting payment proof: ")
console.log("\ttxid: ", txid, console.log("\ttxid: ", txid,
", address: ", address, ", address: ", address,
@ -778,8 +778,8 @@ ApplicationWindow {
informationPopup.open() informationPopup.open()
} }
// called on "checkTxProof" // called on "checkProof"
function handleCheckTxProof(txid, address, message, signature) { function handleCheckProof(txid, address, message, signature) {
console.log("Checking payment proof: ") console.log("Checking payment proof: ")
console.log("\ttxid: ", txid, console.log("\ttxid: ", txid,
", address: ", address, ", address: ", address,

View file

@ -64,8 +64,16 @@ Rectangle {
} }
function checkSignature(signature) { function checkSignature(signature) {
return signature.startsWith("OutProofV") && check256(signature, 142) || if (signature.startsWith("OutProofV")) {
signature.startsWith("InProofV") && check256(signature, 141) if ((signature.length - 10) % 132 != 0)
return false;
return check256(signature, signature.length);
} else if (signature.startsWith("InProofV")) {
if ((signature.length - 9) % 132 != 0)
return false;
return check256(signature, signature.length);
}
return false;
} }
/* main layout */ /* main layout */

View file

@ -506,11 +506,10 @@ QString Wallet::checkTxKey(const QString &txid, const QString &tx_key, const QSt
QString Wallet::getTxProof(const QString &txid, const QString &address, const QString &message) const QString Wallet::getTxProof(const QString &txid, const QString &address, const QString &message) const
{ {
std::string error_str; std::string result = m_walletImpl->getTxProof(txid.toStdString(), address.toStdString(), message.toStdString());
QString result = QString::fromStdString(m_walletImpl->getTxProof(txid.toStdString(), address.toStdString(), message.toStdString(), error_str)); if (result.empty())
if (!error_str.empty()) result = "error|" + m_walletImpl->errorString();
result = QString::fromStdString("error|" + error_str); return QString::fromStdString(result);
return result;
} }
QString Wallet::checkTxProof(const QString &txid, const QString &address, const QString &message, const QString &signature) QString Wallet::checkTxProof(const QString &txid, const QString &address, const QString &message, const QString &signature)