Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
16
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
Show more breadcrumbs
cellframe
cellframe-sdk
Commits
4213694a
Commit
4213694a
authored
1 year ago
by
Roman Khlopkov
🔜
Committed by
Roman Khlopkov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
hotfix-10122+
parent
bb8e7f85
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/service/xchange/dap_chain_net_srv_xchange.c
+13
-8
13 additions, 8 deletions
modules/service/xchange/dap_chain_net_srv_xchange.c
with
13 additions
and
8 deletions
modules/service/xchange/dap_chain_net_srv_xchange.c
+
13
−
8
View file @
4213694a
...
...
@@ -567,13 +567,18 @@ static dap_chain_datum_tx_t *s_xchange_tx_create_exchange(dap_chain_net_srv_xcha
return
NULL
;
}
bool
l_pay_with_native
=
!
dap_strcmp
(
a_price
->
token_sell
,
l_native_ticker
);
bool
l_buy_with_native
=
!
dap_strcmp
(
a_price
->
token_buy
,
l_native_ticker
);
if
(
!
l_pay_with_native
)
{
l_list_fee_out
=
dap_ledger_get_list_tx_outs_with_val
(
l_ledger
,
l_native_ticker
,
&
l_buyer_addr
,
l_total_fee
,
&
l_fee_transfer
);
if
(
!
l_list_fee_out
)
{
dap_list_free_full
(
l_list_used_out
,
NULL
);
log_it
(
L_WARNING
,
"Not enough funds to pay fee"
);
return
NULL
;
if
(
l_buy_with_native
)
SUM_256_256
(
l_value_need
,
l_total_fee
,
&
l_value_need
);
else
{
l_list_fee_out
=
dap_ledger_get_list_tx_outs_with_val
(
l_ledger
,
l_native_ticker
,
&
l_buyer_addr
,
l_total_fee
,
&
l_fee_transfer
);
if
(
!
l_list_fee_out
)
{
dap_list_free_full
(
l_list_used_out
,
NULL
);
log_it
(
L_WARNING
,
"Not enough funds to pay fee"
);
return
NULL
;
}
}
}
...
...
@@ -589,7 +594,7 @@ static dap_chain_datum_tx_t *s_xchange_tx_create_exchange(dap_chain_net_srv_xcha
log_it
(
L_ERROR
,
"Can't compose the transaction input"
);
return
NULL
;
}
if
(
!
l_pay_with_native
)
{
if
(
!
l_pay_with_native
&&
!
l_buy_with_native
)
{
// add 'in' items to fee
uint256_t
l_value_fee_items
=
dap_chain_datum_tx_add_in_item_list
(
&
l_tx
,
l_list_fee_out
);
dap_list_free_full
(
l_list_fee_out
,
NULL
);
...
...
@@ -725,7 +730,7 @@ static dap_chain_datum_tx_t *s_xchange_tx_create_exchange(dap_chain_net_srv_xcha
debug_if
(
s_debug_more
,
L_NOTICE
,
"l_value_transfer = %s"
,
dap_chain_balance_to_coins
(
l_value_transfer
));
debug_if
(
s_debug_more
,
L_NOTICE
,
"l_value_back = %s"
,
dap_chain_balance_to_coins
(
l_value_back
));
// fee back
if
(
!
l_pay_with_native
)
{
if
(
!
l_pay_with_native
&&
!
l_buy_with_native
)
{
SUBTRACT_256_256
(
l_fee_transfer
,
l_total_fee
,
&
l_value_back
);
if
(
!
IS_ZERO_256
(
l_value_back
))
{
if
(
dap_chain_datum_tx_add_out_ext_item
(
&
l_tx
,
&
l_buyer_addr
,
l_value_back
,
l_native_ticker
)
==
-
1
)
{
...
...
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