@@ -258,19 +258,19 @@ static status_t ta_mam_init(mam_api_t *const api, const iota_config_t *const ico
258
258
259
259
if (seed ) {
260
260
if (mam_api_init (api , seed ) != RC_OK ) {
261
- ta_log_error ("%s\n" , " SC_MAM_FAILED_INIT" );
261
+ ta_log_error ("%s\n" , ta_error_to_string ( SC_MAM_FAILED_INIT ) );
262
262
return SC_MAM_FAILED_INIT ;
263
263
}
264
264
} else {
265
265
// Use local MAM file on the current machine
266
266
retcode_t rc = mam_api_load (iconf -> mam_file_path , api , NULL , 0 );
267
267
if (rc == RC_UTILS_FAILED_TO_OPEN_FILE ) {
268
268
if (mam_api_init (api , (tryte_t * )iconf -> seed ) != RC_OK ) {
269
- ta_log_error ("%s\n" , " SC_MAM_FAILED_INIT" );
269
+ ta_log_error ("%s\n" , ta_error_to_string ( SC_MAM_FAILED_INIT ) );
270
270
return SC_MAM_FAILED_INIT ;
271
271
}
272
272
} else if (rc != RC_OK ) {
273
- ta_log_error ("%s\n" , " SC_MAM_FAILED_INIT" );
273
+ ta_log_error ("%s\n" , ta_error_to_string ( SC_MAM_FAILED_INIT ) );
274
274
return SC_MAM_FAILED_INIT ;
275
275
}
276
276
}
@@ -295,7 +295,7 @@ static status_t create_channel_fetch_all_transactions(const iota_client_service_
295
295
if (!first_iter ) {
296
296
if (mam_api_channel_create (api , channel_depth , chid ) != RC_OK ) {
297
297
ret = SC_MAM_FAILED_CREATE_OR_GET_ID ;
298
- ta_log_error ("%s\n" , "SC_MAM_FAILED_CREATE_OR_GET_ID" );
298
+ ta_log_error ("%s\n" , ta_error_to_string ( ret ) );
299
299
goto done ;
300
300
}
301
301
}
@@ -306,8 +306,8 @@ static status_t create_channel_fetch_all_transactions(const iota_client_service_
306
306
// TODO use `ta_find_transaction_objects(service, obj_req, obj_res)` instead of the original 'iota.c' function
307
307
retcode_t ret_rc = iota_client_find_transaction_objects (service , txn_req , obj_res );
308
308
if (ret_rc && ret_rc != RC_NULL_PARAM ) {
309
- ret = SC_MAM_FAILED_DESTROYED ;
310
- ta_log_error ("%s\n" , "SC_MAM_FAILED_DESTROYED" );
309
+ ret = SC_MAM_FAILED_RESPONSE ;
310
+ ta_log_error ("%s\n" , ta_error_to_string ( ret ) );
311
311
goto done ;
312
312
}
313
313
@@ -482,7 +482,7 @@ static status_t ta_mam_written_msg_to_bundle(const iota_client_service_t *const
482
482
// Writing packet to bundle
483
483
if (ta_mam_write_packet (api , payload , msg_id_trits , * bundle )) {
484
484
ret = SC_MAM_FAILED_WRITE ;
485
- ta_log_error ("%s\n" , "SC_MAM_FAILED_WRITE" );
485
+ ta_log_error ("%s\n" , ta_error_to_string ( ret ) );
486
486
goto done ;
487
487
}
488
488
@@ -516,13 +516,13 @@ static status_t ta_mam_write_announce_to_bundle(mam_api_t *const api, const size
516
516
trit_t msg_id [MAM_MSG_ID_SIZE ];
517
517
if (mam_api_channel_create (api , channel_depth , chid1 ) != RC_OK ) {
518
518
ret = SC_MAM_FAILED_CREATE_OR_GET_ID ;
519
- ta_log_error ("%s\n" , "SC_MAM_FAILED_CREATE_OR_GET_ID" );
519
+ ta_log_error ("%s\n" , ta_error_to_string ( ret ) );
520
520
goto done ;
521
521
}
522
522
523
523
if (mam_api_bundle_announce_channel (api , chid , chid1 , mam_key .psks , mam_key .ntru_pks , * bundle , msg_id ) != RC_OK ) {
524
524
ret = SC_MAM_FAILED_WRITE_HEADER ;
525
- ta_log_error ("%s\n" , "SC_MAM_FAILED_WRITE_HEADER" );
525
+ ta_log_error ("%s\n" , ta_error_to_string ( ret ) );
526
526
goto done ;
527
527
}
528
528
@@ -680,6 +680,7 @@ status_t ta_recv_mam_message(const iota_config_t *const iconf, const iota_client
680
680
bundle_array_t * bundle_array = NULL ;
681
681
bundle_array_new (& bundle_array );
682
682
mam_pk_t_set_t init_trusted_ch = NULL ;
683
+ mam_encrypt_key_t mam_key = {.psks = NULL , .ntru_pks = NULL , .ntru_sks = NULL };
683
684
recv_mam_data_id_mam_v1_t * data_id = (recv_mam_data_id_mam_v1_t * )req -> data_id ;
684
685
recv_mam_key_mam_v1_t * key = (recv_mam_key_mam_v1_t * )req -> key ;
685
686
if (mam_api_init (& mam , (tryte_t * )iconf -> seed ) != RC_OK ) {
@@ -716,7 +717,6 @@ status_t ta_recv_mam_message(const iota_config_t *const iconf, const iota_client
716
717
}
717
718
718
719
// Add decryption keys
719
- mam_encrypt_key_t mam_key = {.psks = NULL , .ntru_pks = NULL , .ntru_sks = NULL };
720
720
ret = ta_set_mam_key (& mam_key , key -> psk_array , NULL , key -> ntru_array );
721
721
if (ret != SC_OK ) {
722
722
ta_log_error ("%s\n" , ta_error_to_string (ret ));
0 commit comments