def _check_rsig_data(state: State, rsig_data: MoneroTransactionRsigData):
    """
    There are two types of monero ring confidential transactions:
    1. RCTTypeFull = 1 (used if num_inputs == 1 && Borromean)
    2. RCTTypeSimple = 2 (for num_inputs > 1 || !Borromean)

    and four types of range proofs (set in `rsig_data.rsig_type`):
    1. RangeProofBorromean = 0
    2. RangeProofBulletproof = 1
    3. RangeProofMultiOutputBulletproof = 2
    4. RangeProofPaddedBulletproof = 3

    The current code supports only HF9, HF10 thus TX type is always simple
    and RCT algorithm is always Bulletproof.
    """
    state.rsig_grouping = rsig_data.grouping

    if rsig_data.rsig_type == 0:
        raise ValueError("Borromean range sig not supported")

    elif rsig_data.rsig_type not in (1, 2, 3):
        raise ValueError("Unknown rsig type")

    if state.output_count > 2:
        state.rsig_offload = True

    _check_grouping(state)
Ejemplo n.º 2
0
def _check_rsig_data(state: State, rsig_data: MoneroTransactionRsigData):
    """
    There are two types of monero ring confidential transactions:
    1. RCTTypeFull = 1 (used if num_inputs == 1)
    2. RCTTypeSimple = 2 (for num_inputs > 1)

    and four types of range proofs (set in `rsig_data.rsig_type`):
    1. RangeProofBorromean = 0
    2. RangeProofBulletproof = 1
    3. RangeProofMultiOutputBulletproof = 2
    4. RangeProofPaddedBulletproof = 3
    """
    state.rsig_grouping = rsig_data.grouping

    if rsig_data.rsig_type == 0:
        state.rsig_type = RsigType.Borromean
    elif rsig_data.rsig_type in (1, 2, 3):
        state.rsig_type = RsigType.Bulletproof
    else:
        raise ValueError("Unknown rsig type")

    # unintuitively RctType.Simple is used for more inputs
    if state.input_count > 1 or state.rsig_type == RsigType.Bulletproof:
        state.rct_type = RctType.Simple
    else:
        state.rct_type = RctType.Full

    if state.rsig_type == RsigType.Bulletproof and state.output_count > 2:
        state.rsig_offload = True

    _check_grouping(state)