diff options
-rw-r--r-- | src/xact.cc | 2 | ||||
-rw-r--r-- | test/regress/commodity_equivalency.test | 13 | ||||
-rw-r--r-- | test/regress/commodity_equivalency_2.test | 13 |
3 files changed, 27 insertions, 1 deletions
diff --git a/src/xact.cc b/src/xact.cc index 749eb3e5..0c7f65a1 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -265,7 +265,7 @@ bool xact_base_t::finalize() DEBUG("xact.finalize", "per_unit_cost = " << per_unit_cost); foreach (post_t * post, posts) { - const amount_t& amt(post->amount); + const amount_t& amt(post->amount.reduced()); if (post->must_balance() && amt.commodity() == comm) { balance -= amt; diff --git a/test/regress/commodity_equivalency.test b/test/regress/commodity_equivalency.test new file mode 100644 index 00000000..400ab2bf --- /dev/null +++ b/test/regress/commodity_equivalency.test @@ -0,0 +1,13 @@ +C 1.00000000 BTC = 100000000 sat + +2022/10/01 Sell + Bank $20000 + Wallet -1 BTC + +test bal + $20000 Bank + -1.00000000 BTC Wallet +-------------------- + $20000 + -1.00000000 BTC +end test diff --git a/test/regress/commodity_equivalency_2.test b/test/regress/commodity_equivalency_2.test new file mode 100644 index 00000000..a5d2de74 --- /dev/null +++ b/test/regress/commodity_equivalency_2.test @@ -0,0 +1,13 @@ +C 1.00000000 BTC = 100000000 sat + +2022/10/01 Sell + Wallet -1 BTC + Bank $20000 + +test bal + $20000 Bank + -1.00000000 BTC Wallet +-------------------- + $20000 + -1.00000000 BTC +end test |