Skip to content

Commit

Permalink
Clear memory before running sighash unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
coderofstuff committed May 15, 2023
1 parent f2ac660 commit 11ecf85
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions unit-tests/test_sighash.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ static void test_sighash(void **state) {
transaction_output_t txout;
transaction_t tx;

memset(&txin, 0, sizeof(txin));
memset(&txout, 0, sizeof(txout));
memset(&tx, 0, sizeof(tx));

memcpy(txin.tx_id, input_prev_tx_id, sizeof(input_prev_tx_id));
txin.index = 1;
txin.value = 2;
Expand Down Expand Up @@ -106,6 +110,10 @@ static void test_sighash_zeros(void **state) {
transaction_output_t txout;
transaction_t tx;

memset(&txin, 0, sizeof(txin));
memset(&txout, 0, sizeof(txout));
memset(&tx, 0, sizeof(tx));

memcpy(txin.tx_id, input_prev_tx_id, sizeof(input_prev_tx_id));
txin.index = 0;
txin.value = 0;
Expand Down

0 comments on commit 11ecf85

Please sign in to comment.