Skip to content
Snippets Groups Projects
Commit f0a15f7c authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[*] Some renames

[+] C++ ifdef
parent f92ab625
No related branches found
No related tags found
No related merge requests found
......@@ -188,9 +188,13 @@ typedef struct dap_chain_receipt{
dap_chain_net_srv_price_unit_uid_t units_type;
uint64_t units; // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
uint64_t value_datoshi; // Receipt value
} dap_chain_receipt_t;
} dap_chain_receipt_info_t;
#ifdef __cplusplus
extern "C" {
#endif
size_t dap_chain_hash_slow_to_str(dap_chain_hash_slow_t * a_hash, char * a_str, size_t a_str_max);
char* dap_chain_addr_to_str(const dap_chain_addr_t *a_addr);
......@@ -246,3 +250,8 @@ static inline dap_chain_hash_slow_kind_t dap_chain_hash_slow_kind_check(dap_chai
else
return HASH_SILVER;
}
#ifdef __cplusplus
}
#endif
......@@ -33,11 +33,16 @@
*/
typedef struct dap_chain_datum_tx_receipt {
dap_chain_tx_item_type_t type :8; // Transaction item type
dap_chain_receipt_t receipt; // Receipt itself
dap_chain_receipt_info_t receipt_info; // Receipt itself
uint16_t size;
byte_t signs[]; // Signatures, first from provider, second from client
}DAP_ALIGN_PACKED dap_chain_datum_tx_receipt_t;
#ifdef __cplusplus
extern "C" {
#endif
dap_chain_datum_tx_receipt_t * dap_chain_datum_tx_receipt_create( dap_chain_net_srv_uid_t srv_uid,
dap_chain_net_srv_price_unit_uid_t units_type,
uint64_t units, uint64_t value_datoshi);
......@@ -49,3 +54,7 @@ static inline uint16_t dap_chain_datum_tx_receipt_get_size(const dap_chain_datum
return l_receipt->size;
}
#ifdef __cplusplus
}
#endif
......@@ -44,11 +44,11 @@ dap_chain_datum_tx_receipt_t * dap_chain_datum_tx_receipt_create( dap_chain_net_
{
dap_chain_datum_tx_receipt_t * l_ret = DAP_NEW_Z(dap_chain_datum_tx_receipt_t);
l_ret->type = TX_ITEM_TYPE_RECEIPT;
l_ret->receipt.units_type = a_units_type;
l_ret->receipt.srv_uid = a_srv_uid;
l_ret->receipt.units = a_units;
l_ret->receipt.value_datoshi = a_value_datoshi;
l_ret->size = 1+sizeof (l_ret->receipt);
l_ret->receipt_info.units_type = a_units_type;
l_ret->receipt_info.srv_uid = a_srv_uid;
l_ret->receipt_info.units = a_units;
l_ret->receipt_info.value_datoshi = a_value_datoshi;
l_ret->size = 1+sizeof (l_ret->receipt_info);
return l_ret;
}
......@@ -58,7 +58,7 @@ size_t dap_chain_datum_tx_receipt_sign_add(dap_chain_datum_tx_receipt_t * a_rece
log_it( L_ERROR, "NULL receipt, can't add sign");
return 0;
}
dap_sign_t * l_sign = dap_sign_create(a_key,&a_receipt->receipt,sizeof (a_receipt->receipt),0);
dap_sign_t * l_sign = dap_sign_create(a_key,&a_receipt->receipt_info,sizeof (a_receipt->receipt_info),0);
size_t l_sign_size = l_sign? dap_sign_get_size( l_sign ) : 0;
if ( ! l_sign || ! l_sign_size ){
log_it( L_ERROR, "Can't sign the receipt, may be smth with key?");
......@@ -80,7 +80,7 @@ size_t dap_chain_datum_tx_receipt_sign_add(dap_chain_datum_tx_receipt_t * a_rece
*/
dap_sign_t* dap_chain_datum_tx_receipt_sign_get(dap_chain_datum_tx_receipt_t * l_receipt, size_t l_receipt_size,uint16_t a_sign_position )
{
if ( l_receipt_size <= sizeof (l_receipt->receipt)+1)
if ( l_receipt_size <= sizeof (l_receipt->receipt_info)+1)
return NULL;
dap_sign_t * l_sign = (dap_sign_t *) l_receipt->signs;
for ( ; a_sign_position && l_receipt_size > (size_t) ( (byte_t *) l_sign - (byte_t *) l_receipt ) ; a_sign_position-- ){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment