Merge pull request #4126

bdf14a2 remove output blackballing (tobtoht)
This commit is contained in:
luigi1111 2023-03-28 12:40:07 -04:00
commit b117b9be61
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 0 additions and 185 deletions

View file

@ -50,15 +50,6 @@ Rectangle {
return true
}
function validUnsigned(s) {
if (s.length == 0)
return false
for (var i = 0; i < s.length; ++i)
if ("0123456789".indexOf(s[i]) == -1)
return false
return true
}
function validRing(str, relative) {
var outs = str.split(" ");
if (outs.length == 0)
@ -109,136 +100,6 @@ Rectangle {
color: MoneroComponents.Style.defaultFontColor
}
MoneroComponents.LabelSubheader {
Layout.fillWidth: true
textFormat: Text.RichText
text: qsTr("Outputs marked as spent") + translationManager.emptyString
tooltip: qsTr(
"In order to obscure which inputs in a Monero transaction are being spent, a third party should not be able " +
"to tell which inputs in a ring are already known to be spent. Being able to do so would weaken the protection " +
"afforded by ring signatures. If all but one of the inputs are known to be already spent, then the input being " +
"actually spent becomes apparent, thereby nullifying the effect of ring signatures, one of the three main layers " +
"of privacy protection Monero uses.<br>" +
"To help transactions avoid those inputs, a list of known spent ones can be used to avoid using them in new " +
"transactions. Such a list is maintained by the Monero project and is available on the getmonero.org website, " +
"and you can import this list here.<br>" +
"Alternatively, you can scan the blockchain (and the blockchain of key-reusing Monero clones) yourself " +
"using the monero-blockchain-mark-spent-outputs tool to create a list of known spent outputs.<br>"
) + translationManager.emptyString
}
MoneroComponents.TextPlain {
textFormat: Text.RichText
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14
text: qsTr("This sets which outputs are known to be spent, and thus not to be used as privacy placeholders in ring signatures. ") +
qsTr("You should only have to load a file when you want to refresh the list. Manual adding/removing is possible if needed.") + translationManager.emptyString
wrapMode: Text.Wrap
Layout.fillWidth: true;
color: MoneroComponents.Style.defaultFontColor
}
ColumnLayout {
Layout.fillWidth: true
Layout.topMargin: 12
FileDialog {
id: loadBlackballFileDialog
title: qsTr("Please choose a file from which to load outputs to mark as spent") + translationManager.emptyString;
folder: "file://"
nameFilters: ["*"]
onAccepted: {
loadBlackballFileLine.text = walletManager.urlToLocalPath(loadBlackballFileDialog.fileUrl)
}
}
MoneroComponents.LineEdit {
id: loadBlackballFileLine
Layout.fillWidth: true
fontSize: 16
placeholderFontSize: 16
placeholderText: qsTr("Path to file") + "..." + translationManager.emptyString
labelFontSize: 14
labelText: qsTr("Filename with outputs to mark as spent") + ":" + translationManager.emptyString
copyButton: true
readOnly: false
}
RowLayout {
Layout.fillWidth: true
Layout.topMargin: 18
MoneroComponents.StandardButton {
id: selectBlackballFileButton
text: qsTr("Browse") + translationManager.emptyString
enabled: true
small: true
onClicked: {
loadBlackballFileDialog.open()
}
}
MoneroComponents.StandardButton {
id: loadBlackballFileButton
text: qsTr("Load") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet && loadBlackballFileLine.text !== ""
onClicked: appWindow.currentWallet.blackballOutputs(walletManager.urlToLocalPath(loadBlackballFileDialog.fileUrl), true)
}
}
}
GridLayout {
Layout.fillWidth: true
columnSpacing: 20
MoneroComponents.LineEdit {
id: blackballOutputAmountLine
Layout.fillWidth: true
fontSize: 16
labelFontSize: 14
labelText: qsTr("Or manually mark a single output as spent/unspent:") + translationManager.emptyString
placeholderFontSize: 16
placeholderText: qsTr("Paste output amount") + "..." + translationManager.emptyString
readOnly: false
validator: IntValidator { bottom: 0 }
}
MoneroComponents.LineEdit {
id: blackballOutputOffsetLine
Layout.fillWidth: true
fontSize: 16
labelFontSize: 14
labelText: " "
placeholderFontSize: 16
placeholderText: qsTr("Paste output offset") + "..." + translationManager.emptyString
readOnly: false
validator: IntValidator { bottom: 0 }
}
}
RowLayout {
Layout.fillWidth: true
Layout.topMargin: 18
MoneroComponents.StandardButton {
id: blackballButton
text: qsTr("Mark as spent") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet && validUnsigned(blackballOutputAmountLine.text) && validUnsigned(blackballOutputOffsetLine.text)
onClicked: appWindow.currentWallet.blackballOutput(blackballOutputAmountLine.text, blackballOutputOffsetLine.text)
}
MoneroComponents.StandardButton {
id: unblackballButton
text: qsTr("Mark as unspent") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet && validUnsigned(blackballOutputAmountLine.text) && validUnsigned(blackballOutputOffsetLine.text)
onClicked: appWindow.currentWallet.unblackballOutput(blackballOutputAmountLine.text, blackballOutputOffsetLine.text)
}
}
MoneroComponents.LabelSubheader {
Layout.fillWidth: true
Layout.topMargin: 24

View file

@ -1013,46 +1013,6 @@ QString Wallet::getDaemonLogPath() const
return QString::fromStdString(m_walletImpl->getDefaultDataDir()) + "/bitmonero.log";
}
bool Wallet::blackballOutput(const QString &amount, const QString &offset)
{
return m_walletImpl->blackballOutput(amount.toStdString(), offset.toStdString());
}
bool Wallet::blackballOutputs(const QList<QString> &pubkeys, bool add)
{
std::vector<std::string> std_pubkeys;
foreach (const QString &pubkey, pubkeys) {
std_pubkeys.push_back(pubkey.toStdString());
}
return m_walletImpl->blackballOutputs(std_pubkeys, add);
}
bool Wallet::blackballOutputs(const QString &filename, bool add)
{
QFile file(filename);
try {
if (!file.open(QIODevice::ReadOnly))
return false;
QList<QString> outputs;
QTextStream in(&file);
while (!in.atEnd()) {
outputs.push_back(in.readLine());
}
file.close();
return blackballOutputs(outputs, add);
}
catch (const std::exception &e) {
file.close();
return false;
}
}
bool Wallet::unblackballOutput(const QString &amount, const QString &offset)
{
return m_walletImpl->unblackballOutput(amount.toStdString(), offset.toStdString());
}
QString Wallet::getRing(const QString &key_image)
{
std::vector<uint64_t> cring;

View file

@ -341,12 +341,6 @@ public:
QString getDaemonLogPath() const;
QString getWalletLogPath() const;
// Blackalled outputs
Q_INVOKABLE bool blackballOutput(const QString &amount, const QString &offset);
Q_INVOKABLE bool blackballOutputs(const QList<QString> &outputs, bool add);
Q_INVOKABLE bool blackballOutputs(const QString &filename, bool add);
Q_INVOKABLE bool unblackballOutput(const QString &amount, const QString &offset);
// Rings
Q_INVOKABLE QString getRing(const QString &key_image);
Q_INVOKABLE QString getRings(const QString &txid);