diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2022-03-02 19:03:14 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2022-03-02 19:03:14 -0500 |
| commit | 1610b93975c26cdc7cf686abdb3f4e12cf5579f8 (patch) | |
| tree | 348f8636b459d98a874134800bcb8f781beb68ae /main.qml | |
| parent | 8ece450f18446f22f595bd789513d6d4123ceaf4 (diff) | |
| parent | 2bf0dd840f907b406271863540c8efe002b2cdc3 (diff) | |
| download | monzero-gui-1610b93975c26cdc7cf686abdb3f4e12cf5579f8.tar.gz monzero-gui-1610b93975c26cdc7cf686abdb3f4e12cf5579f8.tar.xz monzero-gui-1610b93975c26cdc7cf686abdb3f4e12cf5579f8.zip | |
Merge pull request #3828
2bf0dd8 Advanced: ReserveProof: Resolve review by selsta (reemuru)
0f67580 Advanced: ReserveProof: Add support for reserve proof (reemuru)
Diffstat (limited to 'main.qml')
| -rw-r--r-- | main.qml | 54 |
1 files changed, 35 insertions, 19 deletions
@@ -985,24 +985,28 @@ ApplicationWindow { } // called on "getProof" - function handleGetProof(txid, address, message) { - console.log("Getting payment proof: ") - console.log("\ttxid: ", txid, - ", address: ", address, - ", message: ", message); - - function spendProofFallback(txid, result){ - if (!result || result.indexOf("error|") === 0) { - currentWallet.getSpendProofAsync(txid, message, txProofComputed); - } else { - txProofComputed(txid, result); + function handleGetProof(txid, address, message, amount) { + if (amount.length > 0) { + var result = currentWallet.getReserveProof(false, currentWallet.currentSubaddressAccount, walletManager.amountFromString(amount), message) + txProofComputed(null, result) + } else { + console.log("Getting payment proof: ") + console.log("\ttxid: ", txid, + ", address: ", address, + ", message: ", message); + function spendProofFallback(txid, result){ + if (!result || result.indexOf("error|") === 0) { + currentWallet.getSpendProofAsync(txid, message, txProofComputed); + } else { + txProofComputed(txid, result); + } } + if (address.length > 0) + currentWallet.getTxProofAsync(txid, address, message, spendProofFallback); + else + spendProofFallback(txid, null); } - - if (address.length > 0) - currentWallet.getTxProofAsync(txid, address, message, spendProofFallback); - else - spendProofFallback(txid, null); + informationPopup.open() } function txProofComputed(txid, result){ @@ -1025,12 +1029,18 @@ ApplicationWindow { ", signature: ", signature); var result; - if (address.length > 0) + var isReserveProof = signature.indexOf("ReserveProofV") === 0; + if (address.length > 0 && !isReserveProof) { result = currentWallet.checkTxProof(txid, address, message, signature); - else + } + else if (isReserveProof) { + result = currentWallet.checkReserveProof(address, message, signature); + } + else { result = currentWallet.checkSpendProof(txid, message, signature); + } var results = result.split("|"); - if (address.length > 0 && results.length == 5 && results[0] === "true") { + if (address.length > 0 && results.length == 5 && results[0] === "true" && !isReserveProof) { var good = results[1] === "true"; var received = results[2]; var in_pool = results[3] === "true"; @@ -1058,6 +1068,12 @@ ApplicationWindow { informationPopup.title = qsTr("Payment proof check") + translationManager.emptyString; informationPopup.icon = good ? StandardIcon.Information : StandardIcon.Critical; informationPopup.text = good ? qsTr("Good signature") : qsTr("Bad signature"); + } + else if (isReserveProof && results[0] === "true") { + var good = results[1] === "true"; + informationPopup.title = qsTr("Reserve proof check") + translationManager.emptyString; + informationPopup.icon = good ? StandardIcon.Information : StandardIcon.Critical; + informationPopup.text = good ? qsTr("Good signature on %1 total and %2 spent.").arg(results[2]).arg(results[3]) : qsTr("Bad signature"); } else { informationPopup.title = qsTr("Error") + translationManager.emptyString; |
