Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-stream-ch-chain-net-srv
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-stream-ch-chain-net-srv
Commits
51c01481
Commit
51c01481
authored
5 years ago
by
dmitriy.gerasimov
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature-2963' into 'master'
fixed signing a receipt See merge request
!6
parents
001b68d4
74ac90c4
No related branches found
No related tags found
1 merge request
!6
fixed signing a receipt
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dap_stream_ch_chain_net_srv.c
+16
-12
16 additions, 12 deletions
dap_stream_ch_chain_net_srv.c
with
16 additions
and
12 deletions
dap_stream_ch_chain_net_srv.c
+
16
−
12
View file @
51c01481
...
@@ -234,13 +234,16 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch , void* a_arg)
...
@@ -234,13 +234,16 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch , void* a_arg)
l_ticker
=
dap_chain_ledger_tx_get_token_ticker_by_hash
(
l_ledger
,
&
l_request
->
hdr
.
tx_cond
);
l_ticker
=
dap_chain_ledger_tx_get_token_ticker_by_hash
(
l_ledger
,
&
l_request
->
hdr
.
tx_cond
);
dap_stpcpy
(
l_usage
->
token_ticker
,
l_ticker
);
dap_stpcpy
(
l_usage
->
token_ticker
,
l_ticker
);
dap_chain_net_srv_price_t
*
l_price
;
dap_chain_net_srv_price_t
*
l_price_tmp
;
DL_FOREACH
(
l_srv
->
pricelist
,
l_price
)
{
DL_FOREACH
(
l_srv
->
pricelist
,
l_price_tmp
)
{
if
(
l_price
->
net
->
pub
.
id
.
uint64
==
l_request
->
hdr
.
net_id
.
uint64
if
(
l_price_tmp
->
net
->
pub
.
id
.
uint64
==
l_request
->
hdr
.
net_id
.
uint64
&&
dap_strcmp
(
l_price
->
token
,
l_ticker
)
==
0
&&
dap_strcmp
(
l_price_tmp
->
token
,
l_ticker
)
==
0
&&
l_price
->
units_uid
.
enm
==
l_tx_out_cond
->
subtype
.
srv_pay
.
header
.
unit
.
enm
&&
l_price_tmp
->
units_uid
.
enm
==
l_tx_out_cond
->
subtype
.
srv_pay
.
header
.
unit
.
enm
&&
(
l_price
->
value_datoshi
/
l_price
->
units
)
<
l_tx_out_cond
->
subtype
.
srv_pay
.
header
.
unit_price_max_datoshi
)
)
//&& (l_price_tmp->value_datoshi/l_price_tmp->units) < l_tx_out_cond->subtype.srv_pay.header.unit_price_max_datoshi)
break
;
{
l_price
=
l_price_tmp
;
break
;
}
}
}
if
(
!
l_price
)
{
if
(
!
l_price
)
{
log_it
(
L_WARNING
,
"Request can't be processed because no acceptable price in pricelist for token %s in network %s"
,
log_it
(
L_WARNING
,
"Request can't be processed because no acceptable price in pricelist for token %s in network %s"
,
...
@@ -299,8 +302,9 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch , void* a_arg)
...
@@ -299,8 +302,9 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch , void* a_arg)
DAP_DELETE
(
l_success
);
DAP_DELETE
(
l_success
);
}
}
if
(
l_receipt
)
// l_receipt used in l_usage->receipt
DAP_DELETE
(
l_receipt
);
//if(l_receipt)
// DAP_DELETE(l_receipt);
}
break
;
}
break
;
case
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_SIGN_REQUEST
:{
case
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_SIGN_REQUEST
:{
log_it
(
L_NOTICE
,
"Requested smth to sign"
);
log_it
(
L_NOTICE
,
"Requested smth to sign"
);
...
@@ -332,7 +336,7 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch , void* a_arg)
...
@@ -332,7 +336,7 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch , void* a_arg)
log_it
(
L_WARNING
,
"Can't find receipt in usages thats equal to response receipt"
);
log_it
(
L_WARNING
,
"Can't find receipt in usages thats equal to response receipt"
);
l_err
.
code
=
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_RECEIPT_CANT_FIND
;
l_err
.
code
=
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_RECEIPT_CANT_FIND
;
dap_stream_ch_pkt_write
(
a_ch
,
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR
,
&
l_err
,
sizeof
(
l_err
)
);
dap_stream_ch_pkt_write
(
a_ch
,
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR
,
&
l_err
,
sizeof
(
l_err
)
);
if
(
l_usage
->
service
->
callback_response_error
)
if
(
l_usage
&&
l_usage
->
service
&&
l_usage
->
service
->
callback_response_error
)
l_usage
->
service
->
callback_response_error
(
l_usage
->
service
,
l_usage
->
id
,
l_usage
->
clients
,
&
l_err
,
sizeof
(
l_err
)
);
l_usage
->
service
->
callback_response_error
(
l_usage
->
service
,
l_usage
->
id
,
l_usage
->
clients
,
&
l_err
,
sizeof
(
l_err
)
);
break
;
break
;
}
}
...
@@ -360,8 +364,8 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch , void* a_arg)
...
@@ -360,8 +364,8 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch , void* a_arg)
l_usage
->
service
->
callback_response_error
(
l_usage
->
service
,
l_usage
->
id
,
l_usage
->
clients
,
&
l_err
,
sizeof
(
l_err
)
);
l_usage
->
service
->
callback_response_error
(
l_usage
->
service
,
l_usage
->
id
,
l_usage
->
clients
,
&
l_err
,
sizeof
(
l_err
)
);
break
;
break
;
}
}
// get a second signature - from the client (first sign in server, second sign in client)
dap_sign_t
*
l_receipt_sign
=
dap_chain_datum_tx_receipt_sign_get
(
l_receipt
,
l_receipt_size
,
0
);
dap_sign_t
*
l_receipt_sign
=
dap_chain_datum_tx_receipt_sign_get
(
l_receipt
,
l_receipt_size
,
1
);
if
(
!
l_receipt_sign
){
if
(
!
l_receipt_sign
){
l_err
.
code
=
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_RECEIPT_CANT_FIND
;
l_err
.
code
=
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_RECEIPT_CANT_FIND
;
dap_stream_ch_pkt_write
(
a_ch
,
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR
,
&
l_err
,
sizeof
(
l_err
)
);
dap_stream_ch_pkt_write
(
a_ch
,
DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR
,
&
l_err
,
sizeof
(
l_err
)
);
...
...
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