Sort recipients in SendCoins dialog via BIP69 rule (#2546)

This commit is contained in:
UdjinM6 2018-12-10 16:57:22 +03:00 committed by Alexander Block
parent 5830353373
commit 18cd5965cc
2 changed files with 14 additions and 0 deletions

View File

@ -254,6 +254,11 @@ void SendCoinsDialog::on_sendButton_clicked()
return;
}
// apply BIP69
if (bBIP69Enabled) {
std::sort(recipients.begin(), recipients.end(), CompareSendCoinsRecipientBIP69());
}
QString strFunds = tr("using") + " <b>" + tr("anonymous funds") + "</b>";
QString strFee = "";
recipients[0].inputType = ONLY_DENOMINATED;

View File

@ -101,6 +101,15 @@ public:
}
};
// same as CompareOutputBIP69 in primitives/transaction.h
struct CompareSendCoinsRecipientBIP69
{
inline bool operator()(const SendCoinsRecipient& a, const SendCoinsRecipient& b) const
{
return a.amount < b.amount || (a.amount == b.amount && a.address < b.address);
}
};
/** Interface to Bitcoin wallet from Qt view code. */
class WalletModel : public QObject
{