Skip to content

Commit f51e0d0

Browse files
committed
feat(qt): Add flag to allow duplicate recipient addresses in GUI
This enables users of the Qt wallet to send to the same address in a single transaction. This is useful for setting up multiple MN collateral transactions, but probably only for advanced users and developers. Usage: ./qt/dash-qt -allowduplicaterecipients I'm ok if there's no desire to merge this. I just thought it was a nice feature to send all collateral in a single TX instead of having to send multiple. I presume this is mostly just useful for testnet, as a hardware wallet would be preferred for mainnet, but it may also work to create an unsigned TX which could be signed by a HW wallet w/the right UI.
1 parent 3b9c29d commit f51e0d0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/qt/bitcoin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ static void SetupUIArgs(ArgsManager& argsman)
498498
argsman.AddArg("-splash", strprintf(QObject::tr("Show splash screen on startup (default: %u)").toStdString(), DEFAULT_SPLASHSCREEN), ArgsManager::ALLOW_ANY, OptionsCategory::GUI);
499499
argsman.AddArg("-uiplatform", strprintf("Select platform to customize UI for (one of windows, macosx, other; default: %s)", BitcoinGUI::DEFAULT_UIPLATFORM), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI);
500500
argsman.AddArg("-debug-ui", "Updates the UI's stylesheets in realtime with changes made to the css files in -custom-css-dir and forces some widgets to show up which are usually only visible under certain circumstances. (default: 0)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI);
501+
argsman.AddArg("-allowduplicaterecipients", "Allow sending to duplicate recipient addresses in a single transaction. For testing purposes only. (default: 0)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI);
501502
argsman.AddArg("-windowtitle=<name>", _("Sets a window title which is appended to \"Dash Core - \"").translated, ArgsManager::ALLOW_ANY, OptionsCategory::GUI);
502503
}
503504

src/qt/walletmodel.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
212212
return TransactionCreationFailed;
213213
}
214214

215+
// Check if duplicate recipients are allowed (debug/testing feature)
216+
bool fAllowDuplicateDestAddr = gArgs.GetBoolArg("-allowduplicaterecipients", false);
217+
215218
QSet<QString> setAddress; // Used to detect duplicates
216219
int nAddresses = 0;
217220

@@ -239,7 +242,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
239242
total += rcp.amount;
240243
}
241244
}
242-
if(setAddress.size() != nAddresses)
245+
if(setAddress.size() != nAddresses && !fAllowDuplicateDestAddr)
243246
{
244247
return DuplicateAddress;
245248
}

0 commit comments

Comments
 (0)