aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-08-05 15:08:42 -0400
committerAndrew Chow <achow101-github@achow101.com>2022-08-05 15:19:03 -0400
commit35305c759a4afe983272c3509675095743987aa5 (patch)
tree2b2171bab21a9e9a6a89af4e74ea0db25f2408d6 /test/functional/test_framework
parent7d3817b29a2ad6a1ca5bae6c342472bc74e2a7fe (diff)
parentdb10cf8ae36693cb4d3ed1b47b84709cf9c0d849 (diff)
downloadbitcoin-35305c759a4afe983272c3509675095743987aa5.tar.xz
Merge bitcoin/bitcoin#22751: rpc/wallet: add simulaterawtransaction RPC
db10cf8ae36693cb4d3ed1b47b84709cf9c0d849 rpc/wallet: add simulaterawtransaction RPC (Karl-Johan Alm) 701a64f548662e01821765b2934b6e4b321fda6d test: add support for Decimal to assert_approx (Karl-Johan Alm) Pull request description: (note: this was originally titled "add analyzerawtransaction RPC") This command iterates over the inputs and outputs of the given transactions, and tallies up the balance change for the given wallet. This can be useful e.g. when verifying that a coin join like transaction doesn't contain unexpected inputs that the wallet will then sign for unintentionally. I originally proposed this to Elements (https://github.com/ElementsProject/elements/pull/1016) and it was suggested that I propose this upstream. There is an alternative #22776 to instead add this info to `getbalances` when providing an optional transaction as argument. ACKs for top commit: jonatack: ACK db10cf8ae36693cb4d3ed1b47b84709cf9c0d849 achow101: re-ACK db10cf8ae36693cb4d3ed1b47b84709cf9c0d849 Tree-SHA512: adf222ec7dcdc068d007ae6f465dbc35b692dc7bb2db337be25340ad0c2f9c64cfab4124df23400995c700f41c83c29a2c34812121782c26063b100c7969b89d
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r--test/functional/test_framework/util.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index fe61ff95f8..bfc835f272 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -29,6 +29,10 @@ logger = logging.getLogger("TestFramework.utils")
def assert_approx(v, vexp, vspan=0.00001):
"""Assert that `v` is within `vspan` of `vexp`"""
+ if isinstance(v, Decimal) or isinstance(vexp, Decimal):
+ v=Decimal(v)
+ vexp=Decimal(vexp)
+ vspan=Decimal(vspan)
if v < vexp - vspan:
raise AssertionError("%s < [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan)))
if v > vexp + vspan: