Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-chain-common
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-chain-common
Commits
f0a15f7c
Commit
f0a15f7c
authored
5 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[*] Some renames
[+] C++ ifdef
parent
f92ab625
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/dap_chain_common.h
+10
-1
10 additions, 1 deletion
include/dap_chain_common.h
include/dap_chain_datum_tx_receipt.h
+10
-1
10 additions, 1 deletion
include/dap_chain_datum_tx_receipt.h
src/dap_chain_datum_tx_receipt.c
+7
-7
7 additions, 7 deletions
src/dap_chain_datum_tx_receipt.c
with
27 additions
and
9 deletions
include/dap_chain_common.h
+
10
−
1
View file @
f0a15f7c
...
...
@@ -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
This diff is collapsed.
Click to expand it.
include/dap_chain_datum_tx_receipt.h
+
10
−
1
View file @
f0a15f7c
...
...
@@ -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
This diff is collapsed.
Click to expand it.
src/dap_chain_datum_tx_receipt.c
+
7
−
7
View file @
f0a15f7c
...
...
@@ -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
--
){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment