Skip to content

Commit 3673210

Browse files
Tarak Ben Youssefpsiemens
Tarak Ben Youssef
authored andcommitted
add tx offset macro
1 parent 58e3cb1 commit 3673210

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/src/common/tx.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ storage_t NV_CONST N_appdata_impl __attribute__ ((aligned(64)));
4444

4545
parser_context_t ctx_parsed_tx;
4646

47-
#define DOMAIN_TAG_LENGTH 32
4847
// UTF-8 encoding of "FLOW-V0.0-transaction" padded with zeros to 32 bytes
48+
#define DOMAIN_TAG_LENGTH 32
4949
const uint8_t TX_DOMAIN_TAG[DOMAIN_TAG_LENGTH] = {\
5050
0x46, 0x4C, 0x4F, 0x57, 0x2D, 0x56, 0x30, 0x2E,
5151
0x30, 0x2D, 0x74, 0x72, 0x61, 0x6E, 0x73, 0x61,
5252
0x63, 0x74, 0x69, 0x6F, 0x6E, 0, 0, 0,
5353
0, 0, 0, 0, 0, 0, 0, 0,
5454
};
5555

56+
#define TX_BUFFER_OFFSET DOMAIN_TAG_LENGTH
57+
5658
void tx_initialize() {
5759
buffering_init(
5860
ram_buffer,
@@ -72,8 +74,8 @@ uint32_t tx_append(unsigned char *buffer, uint32_t length) {
7274
}
7375

7476
uint32_t tx_get_buffer_length() {
75-
if (buffering_get_buffer()->pos >= DOMAIN_TAG_LENGTH) {
76-
return buffering_get_buffer()->pos - DOMAIN_TAG_LENGTH;
77+
if (buffering_get_buffer()->pos >= TX_BUFFER_OFFSET) {
78+
return buffering_get_buffer()->pos - TX_BUFFER_OFFSET;
7779
}
7880
return 0;
7981
}
@@ -83,7 +85,7 @@ uint32_t get_signable_length() {
8385
}
8486

8587
uint8_t *tx_get_buffer() {
86-
return buffering_get_buffer()->data + DOMAIN_TAG_LENGTH;
88+
return buffering_get_buffer()->data + TX_BUFFER_OFFSET;
8789
}
8890

8991
uint8_t *get_signable() {

0 commit comments

Comments
 (0)