From 74b78452f990c97647de657f20dbdee2fd1e094d Mon Sep 17 00:00:00 2001 From: "daniil.frolov" <daniil.frolov@demlabs.net> Date: Mon, 15 Apr 2024 09:52:17 +0000 Subject: [PATCH] hotfix-11399_port_to_rc --- modules/net/srv/dap_chain_net_srv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/net/srv/dap_chain_net_srv.c b/modules/net/srv/dap_chain_net_srv.c index e471eed038..ec100f7fb7 100644 --- a/modules/net/srv/dap_chain_net_srv.c +++ b/modules/net/srv/dap_chain_net_srv.c @@ -794,7 +794,7 @@ static bool s_pay_verificator_callback(dap_ledger_t * a_ledger, dap_chain_tx_out return false; } - if( compare256(uint256_0, l_prev_out_cond->subtype.srv_pay.unit_price_max_datoshi) && + if( !IS_ZERO_256(l_prev_out_cond->subtype.srv_pay.unit_price_max_datoshi) && compare256(l_unit_price, l_prev_out_cond->subtype.srv_pay.unit_price_max_datoshi) > 0){ log_it(L_ERROR, "Value in receipt is exceed max allowable price."); return false; @@ -820,7 +820,7 @@ static bool s_pay_verificator_callback(dap_ledger_t * a_ledger, dap_chain_tx_out case TX_ITEM_TYPE_OUT_COND: { dap_chain_tx_out_cond_t *l_tx_out = (dap_chain_tx_out_cond_t *)l_list_tmp->data; if (l_tx_out->header.subtype == DAP_CHAIN_TX_OUT_COND_SUBTYPE_FEE){ - SUM_256_256(l_value, l_cond_out_value = l_tx_out->header.value, &l_value); + SUM_256_256(l_value, l_tx_out->header.value, &l_value); } else if (l_tx_out->header.subtype == DAP_CHAIN_TX_OUT_COND_SUBTYPE_SRV_PAY){ l_cond_out_value = l_tx_out->header.value; } @@ -829,7 +829,9 @@ static bool s_pay_verificator_callback(dap_ledger_t * a_ledger, dap_chain_tx_out } } - if (!compare256(l_value, l_cond_out_value)){ + + SUBTRACT_256_256(l_prev_out_cond->header.value, l_value, &l_value); + if (compare256(l_value, l_cond_out_value)){ log_it(L_ERROR, "Value in tx out is invalid!"); dap_list_free(l_list_out); return false; -- GitLab