-
Notifications
You must be signed in to change notification settings - Fork 16
Add cache operations to ta_get_transaction_object #56
Conversation
Add cache operations to ta_get_transaction_object and modify how it checks response, because get_trytes always return trytes even if transaction not found.
get_transaction_obj would set value into cache after iota api called. This may cause test case errors since they expect call iota api at least one, but in reality they just find results in cache.
@@ -5,6 +5,8 @@ | |||
#include <stdlib.h> | |||
#include <string.h> | |||
|
|||
#include "types/types.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this inclusion necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For defined macros used in backeend_cache.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Affirmative. However, I would like to change the name scheme "types/types.h"
, which looks lousy. I'll propose changes later.
@@ -37,7 +37,7 @@ static int redis_get(redisContext* c, const char* const key, char* res) { | |||
|
|||
redisReply* reply = redisCommand(c, "GET %s", key); | |||
if (reply->type == REDIS_REPLY_STRING) { | |||
strcpy(res, reply->str); | |||
strncpy(res, reply->str, FLEX_TRIT_SIZE_8019); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI. File hooks/scripts/cpplint.py
searches for the occurrence of strcpy
and warn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. It suggests snprintf
.
Add cache operations to ta_get_transaction_object and modify how it checks response, because get_trytes always return trytes even if transaction not found.
Part of #55