Skip to content

Make it possible to turn off automatic txout ordering #9269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions electrum/gui/qt/confirm_tx_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ def add_cv_action(configvar: 'ConfigVarWithConfig', action: Callable[[], None]):
add_cv_action(self.config.cv.WALLET_MERGE_DUPLICATE_OUTPUTS, self.toggle_merge_duplicate_outputs)
add_cv_action(self.config.cv.WALLET_SPEND_CONFIRMED_ONLY, self.toggle_confirmed_only)
add_cv_action(self.config.cv.WALLET_COIN_CHOOSER_OUTPUT_ROUNDING, self.toggle_output_rounding)
add_cv_action(self.config.cv.WALLET_SORT_TX_OUTPUTS, self.toggle_sort_outputs)
self.pref_button = QToolButton()
self.pref_button.setIcon(read_QIcon("preferences.png"))
self.pref_button.setMenu(self.pref_menu)
Expand Down Expand Up @@ -467,6 +468,11 @@ def toggle_confirmed_only(self):
self.config.WALLET_SPEND_CONFIRMED_ONLY = b
self.trigger_update()

def toggle_sort_outputs(self):
b = not self.config.WALLET_SORT_TX_OUTPUTS
self.config.WALLET_SORT_TX_OUTPUTS = b
self.trigger_update()

def toggle_io_visibility(self):
b = not self.config.GUI_QT_TX_EDITOR_SHOW_IO
self.config.GUI_QT_TX_EDITOR_SHOW_IO = b
Expand Down
12 changes: 12 additions & 0 deletions electrum/simple_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,18 @@ def _default_swapserver_url(self) -> str:
short_desc=lambda: _('Send change to Lightning'),
long_desc=lambda: _('If possible, send the change of this transaction to your channels, with a submarine swap'),
)
# TODO: once randomizing transaction outputs is implemented, replace the language here to randomize
WALLET_SORT_TX_OUTPUTS = ConfigVar(
'sort_tx_outputs', default=True, type_=bool,
short_desc=lambda: _('Sort transaction outputs (BIP-69)'),
long_desc=lambda: _("""Transaction outputs can be arbitrarily sorted, and transfers are still going to work.

This means that from the ordering, one could deduce the client that was used to generate the transaction.

By having a normalized order for the outputs of a transaction, the BIP-69 standard makes this fingerprinting impossible.

This option is enabled by default, as it increases privacy, and it only should be turned off, if the generated transaction has to have a specific output ordering."""),
)

FX_USE_EXCHANGE_RATE = ConfigVar('use_exchange_rate', default=False, type_=bool)
FX_CURRENCY = ConfigVar('currency', default='EUR', type_=str)
Expand Down
2 changes: 1 addition & 1 deletion electrum/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,7 @@ def fee_estimator(size: Union[int, float, Decimal]) -> int:

(x,i) = i_max[-1]
outputs[i].value += (amount - distr_amount)
tx = PartialTransaction.from_io(list(coins), list(outputs))
tx = PartialTransaction.from_io(list(coins), list(outputs), BIP69_sort = self.config.WALLET_SORT_TX_OUTPUTS)

# Timelock tx to current height.
tx.locktime = get_locktime_for_new_transaction(self.network)
Expand Down