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

Commit 50c8ec2

Browse files
committed
fix(pow): Fix error detection in serializing txn
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.
1 parent be67330 commit 50c8ec2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

accelerator/core/pow.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ status_t ta_pow(const bundle_transactions_t* bundle, const flex_trit_t* const tr
8080
transaction_set_attachment_timestamp_upper(tx, 3812798742493LL);
8181
transaction_set_attachment_timestamp_lower(tx, 0);
8282

83-
transaction_serialize_on_flex_trits(tx, tx_trits);
84-
if (tx_trits == NULL) {
83+
size_t offset = transaction_serialize_on_flex_trits(tx, tx_trits);
84+
if (offset != NUM_TRITS_SERIALIZED_TRANSACTION) {
8585
ret = SC_CCLIENT_INVALID_FLEX_TRITS;
8686
ta_log_error("%s\n", "SC_CCLIENT_INVALID_FLEX_TRITS");
8787
goto done;

0 commit comments

Comments
 (0)