@@ -43,9 +43,10 @@ status_t ta_pow(const bundle_transactions_t* bundle,
43
43
iota_transaction_t * tx ;
44
44
flex_trit_t * ctrunk =
45
45
(flex_trit_t * )calloc (FLEX_TRIT_SIZE_243 , sizeof (flex_trit_t ));
46
+ flex_trit_t tx_trits [FLEX_TRIT_SIZE_8019 ];
46
47
size_t cur_idx = 0 ;
47
48
48
- tx = (iota_transaction_t * )utarray_front (bundle );
49
+ tx = (iota_transaction_t * )utarray_back (bundle );
49
50
if (tx == NULL ) {
50
51
ret = SC_TA_NULL ;
51
52
goto done ;
@@ -55,15 +56,14 @@ status_t ta_pow(const bundle_transactions_t* bundle,
55
56
56
57
do {
57
58
cur_idx -- ;
58
-
59
59
// set trunk, branch, and attachment timestamp
60
60
transaction_set_trunk (tx , ctrunk );
61
61
transaction_set_branch (tx , branch );
62
62
transaction_set_attachment_timestamp (tx , current_timestamp_ms ());
63
63
transaction_set_attachment_timestamp_upper (tx , 3812798742493LL );
64
64
transaction_set_attachment_timestamp_lower (tx , 0 );
65
65
66
- flex_trit_t * tx_trits = transaction_serialize (tx );
66
+ transaction_serialize_on_flex_trits (tx , tx_trits );
67
67
if (tx_trits == NULL ) {
68
68
ret = SC_CCLIENT_INVALID_FLEX_TRITS ;
69
69
goto done ;
@@ -78,9 +78,10 @@ status_t ta_pow(const bundle_transactions_t* bundle,
78
78
transaction_set_nonce (tx , nonce );
79
79
80
80
free (ctrunk );
81
+ transaction_serialize_on_flex_trits (tx , tx_trits );
81
82
ctrunk = iota_flex_digest (tx_trits , NUM_TRITS_SERIALIZED_TRANSACTION );
83
+ tx = (iota_transaction_t * )utarray_prev (bundle , tx );
82
84
free (nonce );
83
- free (tx_trits );
84
85
} while (cur_idx != 0 );
85
86
86
87
done :
0 commit comments