Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sign_inputs and Transaction reviewing improvements #94

Merged
merged 20 commits into from
May 24, 2023

Conversation

capt-nemo429
Copy link
Member

No description provided.

capt-nemo429 and others added 20 commits February 20, 2023 18:50
* In some cases, there is no appropriate
  change box. This commit fixes the behaviour
  where a box was considered to be a change box
  even though it contained non-change assets.
  This was because the change box was simply
  determined by taking the last output
  going to own address.

* Participants inputs are aggregated
  and if an output going to own address
  exists and it only includes assets
  from aggregation of own inputs, this
  output is marked as change box.

* For multiwitness txs, there can be
  different change boxes for each
  participant (the wallet always selects
  the change box in respect to the
  participant).
* Change boxes are selected greedily
  while their sum is not more than
  sum of own inputs.

* The set of change boxes might not be
  unique, but the greedy solution
  finds one of the sets that is
  maximal in terms of inclusion.

* In an attempt to include as many
  tokens as possible in change, we
  consider outputs in order of decreasing
  number of different tokens. For example,
  if there are two valid maximal change box sets,
  one containing a single box with token A
  and the second containing many different
  tokens, we prefer the second one.
Co-authored-by: capt-nemo429 <96133754+capt-nemo429@users.noreply.github.com>
Fix change box handling in tx interpreter
* No ERG present among tokens yet
* ERG is always displayed first now.

* Use BigNumber methods instead of
  BigInts.

* Remove redundant comments, add some new.
* Move delta calculation from TxSignSummary
  to txInterpreter.

* Expose new properties totalIncoming and
  totalLeaving in txInterpreter.

* Use utxoSum and utxoSumResultDiff for deltas
  calculation.

* Extract some parts of the calculation to a
  separate utils file under transaction interpreter.

* Some local functions defined in
  _determineChangeBoxes in txInterpreter
  were also needed for _calcIncomingLeavingTotals,
  so there are slight changes to change box
  function as well.
Add display of wallet changes to TxSignView
@capt-nemo429 capt-nemo429 merged commit 4654105 into master May 24, 2023
2 checks passed
@capt-nemo429 capt-nemo429 deleted the add-sign-inputs branch May 24, 2023 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants