Skip to content
Snippets Groups Projects
Commit fc07c46d authored by Roman Khlopkov's avatar Roman Khlopkov 🔜
Browse files

[*] Balances convergence

parent a7da1153
No related branches found
No related tags found
1 merge request!1760support-audit
Pipeline #43586 passed with stage
in 12 minutes and 16 seconds
Subproject commit 76bb290ca9d93e5adac3a56a32d42bc94ad354c5
Subproject commit e97dc15096ffa39761dc8f6c68f9ce8fe53bc49d
......@@ -53,6 +53,7 @@ dap_chain_datum_tx_receipt_t * dap_chain_datum_tx_receipt_create( dap_chain_net_
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->receipt_info.version = 1;
l_ret->size = sizeof(dap_chain_datum_tx_receipt_t) + a_ext_size;
if (a_ext_size && a_ext) {
......@@ -108,7 +109,7 @@ dap_sign_t *dap_chain_datum_tx_receipt_sign_get(dap_chain_datum_tx_receipt_t *a_
return NULL;
dap_sign_t *l_sign = NULL;
for (uint16_t l_sign_position = a_sign_position + 1; l_sign_position; l_sign_position--) {
dap_sign_t *l_sign = (dap_sign_t *)(a_receipt->exts_n_signs + l_offset);
l_sign = (dap_sign_t *)(a_receipt->exts_n_signs + l_offset);
uint64_t l_sign_size = dap_sign_get_size(l_sign);
l_offset += l_sign_size;
if (l_offset > l_total_signs_size)
......@@ -177,5 +178,6 @@ int dap_chain_datum_tx_receipt_check_size(dap_chain_datum_tx_receipt_t *a_receip
l_sign = (dap_sign_t *)((byte_t *)l_sign + l_sign_size);
}
size_t l_sign_offset = (byte_t *)l_sign - (byte_t *)a_receipt;
return l_sign_offset == a_control_size ? 0 : -4; // Receipt is lagrer that two signs need
// Receipt is lagrer that two signs need
return l_sign_offset == a_control_size ? 0 : (a_receipt->receipt_info.version ? -4 : 0);
}
......@@ -33,7 +33,8 @@ typedef struct dap_chain_receipt_info {
uint64_t addition;
#endif
dap_chain_net_srv_price_unit_uid_t units_type;
byte_t padding[4];
byte_t version;
byte_t padding[3];
uint64_t units; // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
uint256_t value_datoshi; // Receipt value
} DAP_ALIGN_PACKED dap_chain_receipt_info_t;
......
......@@ -1034,7 +1034,7 @@ static int s_stake_lock_callback_verificator(dap_ledger_t *a_ledger, dap_chain_t
return -13;
if (!dap_chain_net_srv_uid_compare_scalar(l_receipt->receipt_info.srv_uid, DAP_CHAIN_NET_SRV_STAKE_LOCK_ID))
return -7;
if (l_receipt->exts_size != sizeof(dap_hash_fast_t))
if (l_receipt->exts_size < sizeof(dap_hash_fast_t))
return -8;
l_burning_tx_hash = *(dap_hash_fast_t*)l_receipt->exts_n_signs;
if (dap_hash_fast_is_blank(&l_burning_tx_hash))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment