Skip to content

Commit

Permalink
fix: ensure api messages are initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
as-iotex authored and as-iotex committed Apr 17, 2022
1 parent 84c9ffe commit a67ff71
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/protobuf/pb_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ struct AccountMeta
{
char address[IOTEX_ADDRESS_C_STRING_SIZE] = {0};
char balance[IOTEX_MAX_BALANCE_STRLEN + 1] = {0};
IotexString nonce;
IotexString pendingNonce;
IotexString numActions;
bool isContract;
IotexString nonce = "";
IotexString pendingNonce = "";
IotexString numActions = "";
bool isContract = false;
};

enum Encoding
Expand All @@ -48,31 +48,31 @@ struct Transfer
{
char amount[IOTEX_MAX_BALANCE_STRLEN + 1] = {0};
char recipient[IOTEX_ADDRESS_C_STRING_SIZE] = {0};
IotexString payload;
IotexString payload = "";
};

struct Execution
{
char amount[IOTEX_MAX_BALANCE_STRLEN + 1] = {0};
char contract[IOTEX_ADDRESS_C_STRING_SIZE] = {0};
IotexString data;
IotexString data = "";
};

struct ActionCore_Transfer
{
uint32_t version;
uint64_t nonce;
uint64_t gasLimit;
uint32_t version = 0;
uint64_t nonce = 0;
uint64_t gasLimit = 0;
char gasPrice[IOTEX_MAX_BALANCE_STRLEN + 1] = {0};
uint32_t chainId;
uint32_t chainId = 0;
Transfer transfer;
};

struct ActionCore_Execution
{
uint32_t version;
uint64_t nonce;
uint64_t gasLimit;
uint32_t version = 0;
uint64_t nonce = 0;
uint64_t gasLimit = 0;
char gasPrice[IOTEX_MAX_BALANCE_STRLEN + 1] = {0};
Execution execution;
};
Expand All @@ -99,7 +99,7 @@ struct ActionInfo_Transfer
char actHash[IOTEX_HASH_C_STRING_SIZE] = {0};
char blkHash[IOTEX_HASH_C_STRING_SIZE] = {0};
char timestamp[IOTEX_TIMESTAMP_STRLEN + 1] = {0};
IotexString blkHeight;
IotexString blkHeight = "";
char sender[IOTEX_ADDRESS_C_STRING_SIZE] = {0};
char gasFee[IOTEX_MAX_BALANCE_STRLEN + 1] = {0};
};
Expand All @@ -110,15 +110,15 @@ struct ActionInfo_Execution
char actHash[IOTEX_HASH_C_STRING_SIZE] = {0};
char blkHash[IOTEX_HASH_C_STRING_SIZE] = {0};
char timestamp[IOTEX_TIMESTAMP_STRLEN + 1] = {0};
IotexString blkHeight;
IotexString blkHeight = "";
char sender[IOTEX_ADDRESS_C_STRING_SIZE] = {0};
char gasFee[IOTEX_MAX_BALANCE_STRLEN + 1] = {0};
};

struct BlockIdentifier
{
char hash[IOTEX_HASH_C_STRING_SIZE] = {0};
IotexString height;
IotexString height = "";
};

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -180,13 +180,13 @@ struct Receipt
ResultCode fromJson(IotexString jsonString);

public:
uint64_t status;
uint64_t blkHeight;
uint64_t status = 0;
uint64_t blkHeight = 0;
char actHash[IOTEX_HASH_C_STRING_SIZE] = {0};
uint64_t gasConsumed;
uint64_t gasConsumed = 0;
char contractAddress[IOTEX_ADDRESS_C_STRING_SIZE] = {0};
IotexString executionRevertMsg;
uint32_t txIndex;
IotexString executionRevertMsg = "";
uint32_t txIndex = 0;
};

struct ReadContractResponse
Expand All @@ -195,7 +195,7 @@ struct ReadContractResponse
ResultCode fromJson(IotexString jsonString);

public:
IotexString data;
IotexString data = "";
Receipt receipt;
};

Expand Down

0 comments on commit a67ff71

Please sign in to comment.