Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
fix(pow): Fix error detection in serializing txn
Browse files Browse the repository at this point in the history
A defined array would never be NULL, so the comparison at
line 84 in pow.c would never be true. Therefore, we should
use the return value of `transaction_serialize_on_flex_trits()`
to detect if error happaned.
  • Loading branch information
howjmay committed Jan 13, 2020
1 parent be67330 commit 50c8ec2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions accelerator/core/pow.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ status_t ta_pow(const bundle_transactions_t* bundle, const flex_trit_t* const tr
transaction_set_attachment_timestamp_upper(tx, 3812798742493LL);
transaction_set_attachment_timestamp_lower(tx, 0);

transaction_serialize_on_flex_trits(tx, tx_trits);
if (tx_trits == NULL) {
size_t offset = transaction_serialize_on_flex_trits(tx, tx_trits);
if (offset != NUM_TRITS_SERIALIZED_TRANSACTION) {
ret = SC_CCLIENT_INVALID_FLEX_TRITS;
ta_log_error("%s\n", "SC_CCLIENT_INVALID_FLEX_TRITS");
goto done;
Expand Down

0 comments on commit 50c8ec2

Please sign in to comment.