Skip to content

Commit

Permalink
Add silentpayments_test_outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
jlest01 committed Aug 2, 2024
1 parent 9c72e7a commit f83b3af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion examples/silentpayments.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ int main(void) {
enum { N_TX_INPUTS = 2, N_TX_OUTPUTS = 3 };

secp256k1_xonly_pubkey out_pubkeys[N_TX_OUTPUTS];
secp256k1_xonly_pubkey *out_pubkeys_ptrs[N_TX_OUTPUTS];

unsigned char randomize[32];
unsigned char xonly_print[32];
Expand Down Expand Up @@ -222,11 +223,15 @@ int main(void) {
generated_output_ptrs[i] = &generated_outputs[i];
}

for (i = 0; i < N_TX_OUTPUTS; i++) {
out_pubkeys_ptrs[i] = &out_pubkeys[i];
}

ret = secp256k1_silentpayments_test_outputs(
ctx,
recipients,
N_TX_OUTPUTS,
out_pubkeys
out_pubkeys_ptrs
);
assert(ret);

Expand Down
2 changes: 1 addition & 1 deletion include/secp256k1_silentpayments.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_test_out
const secp256k1_context *ctx,
const secp256k1_silentpayments_recipient *recipients,
size_t n_recipients,
secp256k1_xonly_pubkey *generated_outputs
secp256k1_xonly_pubkey **generated_outputs
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2);

/** Create Silent Payment label tweak and label.
Expand Down
5 changes: 3 additions & 2 deletions src/modules/silentpayments/main_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ int secp256k1_silentpayments_test_outputs(
const secp256k1_context *ctx,
const secp256k1_silentpayments_recipient *recipients,
size_t n_recipients,
secp256k1_xonly_pubkey *generated_outputs
secp256k1_xonly_pubkey **generated_outputs
) {
size_t i;
int ret = 1;
Expand All @@ -167,7 +167,8 @@ int secp256k1_silentpayments_test_outputs(
if (!ret) {
return 0;
}
generated_outputs[i] = new_xonly_pubkey;
/* generated_outputs[i] = new_xonly_pubkey; */
(*generated_outputs)[i] = new_xonly_pubkey;
}

return ret;
Expand Down

0 comments on commit f83b3af

Please sign in to comment.