From 9a594f4784ad68f84bed906271f410cb71650326 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Fri, 16 Oct 2020 14:21:45 +0200 Subject: [PATCH] fix(core): Fix CoinJoin anonymity gain check in bitcoin approver. --- core/src/apps/bitcoin/sign_tx/approvers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/apps/bitcoin/sign_tx/approvers.py b/core/src/apps/bitcoin/sign_tx/approvers.py index 5b71f0e9c6..82a8e7e019 100644 --- a/core/src/apps/bitcoin/sign_tx/approvers.py +++ b/core/src/apps/bitcoin/sign_tx/approvers.py @@ -159,10 +159,6 @@ class CoinJoinApprover(Approver): self._add_output(txo, script_pubkey) async def approve_tx(self) -> None: - # Ensure that at least one of the user's outputs is in a group with an external output. - if not self.anonymity: - raise wire.ProcessError("No anonymity gain") - # The mining fee of the transaction as a whole. mining_fee = self.total_in - self.total_out @@ -184,6 +180,11 @@ class CoinJoinApprover(Approver): if our_fees > our_coordinator_fee + our_max_mining_fee: raise wire.ProcessError("Total fee over threshold") + # Ensure that at least one of the user's outputs is in a group with an external output. + # Note: _get_coordinator_fee() needs to be called before checking this. + if not self.anonymity: + raise wire.ProcessError("No anonymity gain") + if self.tx.lock_time > 0: raise wire.ProcessError("nLockTime not allowed in CoinJoin")