From 06ce14096cc8588666c7b8241ca9ef8543293d42 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Tue, 1 Dec 2020 10:08:38 +0100 Subject: [PATCH] chore(core): Reject replacement transactions which involve negative fees. --- core/src/apps/bitcoin/sign_tx/approvers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/apps/bitcoin/sign_tx/approvers.py b/core/src/apps/bitcoin/sign_tx/approvers.py index 70ae69ee52..b5645ad8bd 100644 --- a/core/src/apps/bitcoin/sign_tx/approvers.py +++ b/core/src/apps/bitcoin/sign_tx/approvers.py @@ -151,6 +151,11 @@ class BasicApprover(Approver): ) orig_fee = self.orig_total_in - self.orig_total_out + if fee < 0 or orig_fee < 0: + raise wire.ProcessError( + "Negative fees not supported in transaction replacement." + ) + # Replacement transactions are only allowed to make amendments which # do not increase the amount that we are spending on external outputs. # In other words, the total amount being sent out of the wallet must