Skip to content

Commit

Permalink
tests: Don't recreate global context in scratch space test
Browse files Browse the repository at this point in the history
  • Loading branch information
real-or-random committed Jan 4, 2023
1 parent b198061 commit 18e0db3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,10 @@ void run_scratch_tests(void) {
secp256k1_scratch_space *scratch;
secp256k1_scratch_space local_scratch;

ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);

/* Test public API */
secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount);
secp256k1_context_set_error_callback(ctx, counting_illegal_callback_fn, &ecount);

/* Test public API */
scratch = secp256k1_scratch_space_create(ctx, 1000);
CHECK(scratch != NULL);
CHECK(ecount == 0);
Expand Down Expand Up @@ -397,7 +395,9 @@ void run_scratch_tests(void) {

/* cleanup */
secp256k1_scratch_space_destroy(ctx, NULL); /* no-op */
secp256k1_context_destroy(ctx);

secp256k1_context_set_illegal_callback(ctx, NULL, NULL);
secp256k1_context_set_error_callback(ctx, NULL, NULL);
}


Expand Down

0 comments on commit 18e0db3

Please sign in to comment.