Skip to content

Commit

Permalink
GUI-level exchange address checks when creating a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
psolstice committed Nov 22, 2023
1 parent 50fa4cc commit 6e9b1cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/spark/sparkwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,10 @@ CWalletTx CSparkWallet::CreateSparkSpendTransaction(
for (size_t i = 0; i < recipients.size(); i++) {
auto& recipient = recipients[i];

if (recipient.scriptPubKey.IsPayToExchangeAddress()) {
throw std::runtime_error("Cannot create private transaction with exchange address as a destination");
}

if (!MoneyRange(recipient.nAmount)) {
throw std::runtime_error(boost::str(boost::format(_("Recipient has invalid amount")) % i));
}
Expand Down
4 changes: 4 additions & 0 deletions src/wallet/lelantusjoinsplitbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ CWalletTx LelantusJoinSplitBuilder::Build(
for (size_t i = 0; i < recipients.size(); i++) {
auto& recipient = recipients[i];

if (recipient.scriptPubKey.IsPayToExchangeAddress()) {
throw std::runtime_error("Cannot create private transaction with exchange address as a destination");
}

if (!MoneyRange(recipient.nAmount)) {
throw std::runtime_error(boost::str(boost::format(_("Recipient has invalid amount")) % i));
}
Expand Down

0 comments on commit 6e9b1cc

Please sign in to comment.