Skip to content

Commit

Permalink
generator: speed up parsing
Browse files Browse the repository at this point in the history
Similar to speeding up serialization; in our parsing logic we did a
bunch of expensive stuff then expensively inverted it. Drop everything
except the essential checks and then memcpy.
  • Loading branch information
apoelstra committed May 20, 2024
1 parent 5e7c2c1 commit 2fb01fe
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/modules/generator/main_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,8 @@ int secp256k1_pedersen_commitment_parse(const secp256k1_context* ctx, secp256k1_
!secp256k1_ge_set_xquad(&ge, &x)) {
return 0;
}
if (input[0] & 1) {
secp256k1_ge_neg(&ge, &ge);
}
secp256k1_pedersen_commitment_save(commit, &ge);

memcpy(commit->data, input, 33);
return 1;
}

Expand Down

0 comments on commit 2fb01fe

Please sign in to comment.