Skip to content

Commit

Permalink
xmr: range sig grouping check added
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Oct 17, 2018
1 parent 012ca76 commit 684c7e1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/apps/monero/protocol/signing/step_01_init_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,22 @@ def _check_rsig_data(state: State, rsig_data: MoneroTransactionRsigData):
if state.rsig_type == RsigType.Bulletproof and state.output_count > 2:
state.rsig_offload = True

_check_grouping(state)


def _check_grouping(state: State):
if state.rsig_grouping is None or len(state.rsig_grouping) == 0:
return

acc = 0
for x in state.rsig_grouping:
if x is None or x <= 0:
raise ValueError("Invalid grouping batch")
acc += x

if acc != state.output_count:
raise ValueError("Invalid grouping")


def _check_change(state: State, outputs: list):
"""
Expand Down

0 comments on commit 684c7e1

Please sign in to comment.