bitcoin: hand in a secp256k1_context to all routines.

We don't want to re-create them internally, ever.

The test-cli tools are patched to generate them all the time, but
they're not performance critical.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-01-22 06:41:47 +10:30
parent cc1b1d7de7
commit 9aa0eac814
26 changed files with 215 additions and 150 deletions

View File

@@ -69,10 +69,12 @@ int main(int argc, char *argv[])
if (!hex_decode(argv[1], strlen(argv[1]), &seed, sizeof(seed)))
errx(1, "Invalid seed '%s' - need 256 hex bits", argv[1]);
if (!pubkey_from_hexstr(argv[2], strlen(argv[2]), &commitkey))
if (!pubkey_from_hexstr(secp256k1_context_create(0),
argv[2], strlen(argv[2]), &commitkey))
errx(1, "Invalid commit key '%s'", argv[2]);
if (!pubkey_from_hexstr(argv[3], strlen(argv[3]), &finalkey))
if (!pubkey_from_hexstr(secp256k1_context_create(0),
argv[3], strlen(argv[3]), &finalkey))
errx(1, "Invalid final key '%s'", argv[3]);
if (offer_anchor && min_confirms == 0)