Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
refactor(gw_get_script_hash_by_prefix_fn): use const for prefix arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Flouse authored and jjyr committed Jan 26, 2022
1 parent 44cfb6c commit 515d17d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions c/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void gw_build_data_hash_key(uint8_t data_hash[GW_KEY_BYTES],
}

int gw_build_short_script_hash_to_script_hash_key(
uint8_t *short_script_hash, uint32_t short_script_hash_len,
const uint8_t *short_script_hash, uint32_t short_script_hash_len,
uint8_t raw_key[GW_KEY_BYTES]) {
if (short_script_hash_len > 32 || short_script_hash == NULL) {
return GW_FATAL_INVALID_DATA;
Expand Down Expand Up @@ -267,7 +267,7 @@ int _check_data_hash_exist(gw_context_t *ctx, uint8_t data_hash[32],
}

int _load_script_hash_by_short_script_hash(gw_context_t *ctx,
uint8_t *short_script_hash,
const uint8_t *short_script_hash,
uint32_t short_script_hash_len,
uint8_t script_hash[32]) {
if (ctx == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion c/generator_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ int sys_get_block_hash(gw_context_t *ctx, uint64_t number,
return syscall(GW_SYS_GET_BLOCK_HASH, block_hash, number, 0, 0, 0, 0);
}

int sys_get_script_hash_by_prefix(gw_context_t *ctx, uint8_t *prefix,
int sys_get_script_hash_by_prefix(gw_context_t *ctx, const uint8_t *prefix,
uint64_t prefix_len,
uint8_t script_hash[32]) {
if (ctx == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion c/gw_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ typedef int (*gw_get_block_hash_fn)(struct gw_context_t *ctx, uint64_t number,
* @return The status code, 0 is success
*/
typedef int (*gw_get_script_hash_by_prefix_fn)(struct gw_context_t *ctx,
uint8_t *prefix,
const uint8_t *prefix,
uint64_t prefix_len,
uint8_t script_hash[32]);
/**
Expand Down
2 changes: 1 addition & 1 deletion c/validator_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ int sys_get_block_hash(gw_context_t *ctx, uint64_t number,
return 0;
}

int sys_get_script_hash_by_prefix(gw_context_t *ctx, uint8_t *prefix,
int sys_get_script_hash_by_prefix(gw_context_t *ctx, const uint8_t *prefix,
uint64_t prefix_len,
uint8_t script_hash[32]) {
if (ctx == NULL) {
Expand Down

0 comments on commit 515d17d

Please sign in to comment.