Skip to content

Commit

Permalink
Remove extra separator as this is added by the encoding function
Browse files Browse the repository at this point in the history
  • Loading branch information
neithanmo committed Nov 26, 2024
1 parent 583d23a commit 8c32012
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,18 @@
#define SEPARATOR_LENGTH 1

// Some defines for address and asset encoding
#define ADDR_BECH32_PREFIX "penumbra" BECH32_SEPARATOR
#define ADDR_BECH32_PREFIX "penumbra"
// #define FIXED_ADDR_PREFIX ADDR_BECH32_PREFIX BECH32_SEPARATOR
#define ASSET_BECH32_PREFIX "passet" BECH32_SEPARATOR
#define ASSET_BECH32_PREFIX "passet"
#define ASSET_ID_LEN 32
// HRP length + 1 (separator) + 52 (data) + 6 (checksum) + 1 (null terminator)
// 6 + 1 + 52 + 6 + 1 = 66
// 6 + 1 + 52 + 6 + 2 = 67
#define ENCODED_ASSET_SIZE (strlen(ASSET_BECH32_PREFIX) + ((ASSET_ID_LEN * BITS_PER_BYTE + BECH32_BITS_PER_CHAR - 1) / BECH32_BITS_PER_CHAR) + CHECKSUM_LENGTH + 1)

#define ADDR_HRP_LENGTH (sizeof(ADDR_BECH32_PREFIX) - 1)

#define ENCODED_DATA_LENGTH \
(((ADDRESS_LEN_BYTES + CHECKSUM_LENGTH) * BITS_PER_BYTE + BECH32_BITS_PER_CHAR - 1) / BECH32_BITS_PER_CHAR)

#define ENCODED_ADDR_LEN (ADDR_HRP_LENGTH + SEPARATOR_LENGTH + ENCODED_DATA_LENGTH)
#define ENCODED_ADDR_LEN (sizeof(ADDR_BECH32_PREFIX) + SEPARATOR_LENGTH + ENCODED_DATA_LENGTH)

#define ENCODED_ADDR_BUFFER_SIZE (ENCODED_ADDR_LEN + 2)

Expand Down

0 comments on commit 8c32012

Please sign in to comment.