diff --git a/modules/net/srv/dap_chain_net_srv.c b/modules/net/srv/dap_chain_net_srv.c index e471eed038271665317e49aa2a10f3590fe570b6..ec100f7fb7a7de86722fc5b9b2dc11a35dc5b0b8 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;