src/parser.c
// Also covers AddDelegator transactions; the structure is identical but
// thresholds and result are different. We've already notified the user of
// which we are doing before we reach this stage.
Also covers AddDelegator transactions; the structure is identical but
thresholds and result are different. We've already notified the user of
which we are doing before we reach this stage.
Also covers AddDelegator transactions ; the structure is identical but thresholds and result are different . We ' ve already notified the user of which we are doing before we reach this stage .
enum parse_rv parse_AddValidatorTransaction(struct AddValidatorTransactionState
    *const state, parser_meta_state_t *const meta) {
    enum parse_rv sub_rv = PARSE_RV_INVALID;
    switch (state->state) {
        case 0: 
          CALL_SUBPARSER(validatorState, Validator);
          state->state++;
          INIT_SUBPARSER(outputsState, TransferableOutputs);
        case 1: {
            meta->swap_output = true;
            CALL_SUBPARSER(outputsState, TransferableOutputs);
            state->state++;
            INIT_SUBPARSER(ownersState, SECP256K1OutputOwners);
        }
        case 2: {
            if ( meta->staking_weight != meta->staked ) REJECT("Stake total did not match sum of stake UTXOs: %.*h %.*h", 8, &meta->staking_weight, 8, &meta->staked);
            CALL_SUBPARSER(ownersState, SECP256K1OutputOwners);
            state->state++;
            INIT_SUBPARSER(uint32State, uint32_t);
                }
        case 3: {
            if(meta->type_id==TRANSACTION_TYPE_ID_ADD_DELEGATOR) {
              sub_rv = PARSE_RV_DONE;
              state->state++;
              break;
            }
            CALL_SUBPARSER(uint32State, uint32_t);
            state->state++;
            if(ADD_PROMPT("Delegation Fee", &state->uint32State.val, sizeof(uint32_t), delegation_fee_to_string)) break;
                }
        case 4:
            sub_rv = PARSE_RV_DONE;
    }
    return sub_rv;
}
enum parse_rv parse_AddValidatorTransaction ( struct AddValidatorTransactionState * const state , parser_meta_state_t * const meta ) { enum parse_rv sub_rv = PARSE_RV_INVALID ; switch ( state -> state ) { case 0 : CALL_SUBPARSER ( validatorState , Validator ) ; state -> state ++ ; INIT_SUBPARSER ( outputsState , TransferableOutputs ) ; case 1 : { meta -> swap_output = true ; CALL_SUBPARSER ( outputsState , TransferableOutputs ) ; state -> state ++ ; INIT_SUBPARSER ( ownersState , SECP256K1OutputOwners ) ; } case 2 : { if ( meta -> staking_weight != meta -> staked ) REJECT ( " " , 8 , & meta -> staking_weight , 8 , & meta -> staked ) ; CALL_SUBPARSER ( ownersState , SECP256K1OutputOwners ) ; state -> state ++ ; INIT_SUBPARSER ( uint32State , uint32_t ) ; } case 3 : { if ( meta -> type_id == TRANSACTION_TYPE_ID_ADD_DELEGATOR ) { sub_rv = PARSE_RV_DONE ; state -> state ++ ; break ; } CALL_SUBPARSER ( uint32State , uint32_t ) ; state -> state ++ ; if ( ADD_PROMPT ( " " , & state -> uint32State . val , sizeof ( uint32_t ) , delegation_fee_to_string ) ) break ; } case 4 : sub_rv = PARSE_RV_DONE ; } return sub_rv ; }
Also covers AddDelegator transactions; the structure is identical but
thresholds and result are different.
Also covers AddDelegator transactions ; the structure is identical but thresholds and result are different .
// ChainID // Value // Add delegator transactions don't include shares. // This is bc we call the parser recursively, and, at the end, it gets called with // nothing to parse...But it exits without unwinding the stack, so if we are here, // we need to set this in order to exit properly