From 0fe0ca7948c7de42b39f33caf27c4606ff537394 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 10 May 2018 09:34:19 -0400 Subject: [PATCH] Add contextual comment for GetValueOut() and GetShieldedValueIn() --- src/primitives/transaction.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 0fb7491de..1066601a1 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -651,6 +651,17 @@ public: return header; } + /* + * Context for the two methods below: + * As at most one of vpub_new and vpub_old is non-zero in every JoinSplit, + * we can think of a JoinSplit as an input or output according to which one + * it is (e.g. if vpub_new is non-zero the joinSplit is "giving value" to + * the outputs in the transaction). Similarly, we can think of the Sapling + * shielded part of the transaction as an input or output according to + * whether valueBalance - the sum of shielded input values minus the sum of + * shielded output values - is positive or negative. + */ + // Return sum of txouts, (negative valueBalance or zero) and JoinSplit vpub_old. CAmount GetValueOut() const; // GetValueIn() is a method on CCoinsViewCache, because