-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8975d55
commit 72ec868
Showing
7 changed files
with
119,654 additions
and
119,574 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/******************************************************************************* | ||
* (c) 2018 - 2023 Zondax AG | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
********************************************************************************/ | ||
#include "parser_impl_masp.h" | ||
#include "parser_impl_common.h" | ||
#include "parser_txdef.h" | ||
|
||
parser_error_t readMaspTx(parser_context_t *ctx, masp_tx_section_t *maspTx) { | ||
if (ctx == NULL || maspTx == NULL) { | ||
return parser_unexpected_error; | ||
} | ||
|
||
uint8_t sectionMaspTx = 0; | ||
CHECK_ERROR(readByte(ctx, §ionMaspTx)) | ||
if (sectionMaspTx != DISCRIMINANT_MASP_TX) { | ||
return parser_unexpected_value; | ||
} | ||
|
||
// Read version for now only MaspV5 that translates to 0x02 | ||
CHECK_ERROR(readUint32(ctx, &maspTx->data.tx_version)) | ||
if (maspTx->data.tx_version != MASPV5_TX_VERSION) { | ||
return parser_unexpected_value; | ||
} | ||
CHECK_ERROR(readUint32(ctx, &maspTx->data.version_group_id)) | ||
if (maspTx->data.version_group_id != MASPV5_VERSION_GROUP_ID) { | ||
return parser_unexpected_value; | ||
} | ||
|
||
// Read branch id, unique enum for now | ||
CHECK_ERROR(readUint32(ctx, &maspTx->data.consensus_branch_id)) | ||
if (maspTx->data.consensus_branch_id != BRANCH_ID_IDENTIFIER) { | ||
return parser_unexpected_value; | ||
} | ||
|
||
// Read lock time | ||
CHECK_ERROR(readUint32(ctx, &maspTx->data.lock_time)) | ||
|
||
// Read expiry_height | ||
CHECK_ERROR(readUint32(ctx, &maspTx->data.expiry_height)) | ||
|
||
CHECK_ERROR(readByte(ctx, &maspTx->data.has_transparent_bundle)) | ||
if(maspTx->data.has_transparent_bundle) { | ||
// funtion to parse transparent bundle | ||
} | ||
|
||
CHECK_ERROR(readByte(ctx, &maspTx->data.has_sapling_bundle)) | ||
if(maspTx->data.has_sapling_bundle) { | ||
// funtion to parse sapling bundle | ||
} | ||
return parser_ok; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/******************************************************************************* | ||
* (c) 2018 - 2022 Zondax AG | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
********************************************************************************/ | ||
#pragma once | ||
#include "parser_common.h" | ||
#include <zxmacros.h> | ||
#include "zxtypes.h" | ||
#include "parser_txdef.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define MASPV5_TX_VERSION 0x02 | ||
#define MASPV5_VERSION_GROUP_ID 0x26A7270A | ||
#define BRANCH_ID_IDENTIFIER 0xE9FF75A6 | ||
|
||
parser_error_t readMaspTx(parser_context_t *ctx, masp_tx_section_t *maspTx); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.