mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
signature: expose check_signed_hash()
This is wanted for crypto communications to check signature. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
|
||||
cstate->b.pay_msat / 1000);
|
||||
|
||||
/* Sign it for them. */
|
||||
sign_tx_input(ctx, close_tx, 0, redeemscript, tal_count(redeemscript),
|
||||
sign_tx_input(close_tx, 0, redeemscript, tal_count(redeemscript),
|
||||
&privkey, &pubkey1, &sig);
|
||||
|
||||
if (close_file)
|
||||
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
|
||||
/* Now, sign each input. */
|
||||
for (i = 0; i < tal_count(in); i++) {
|
||||
in[i].sig.stype = SIGHASH_ALL;
|
||||
if (!sign_tx_input(ctx, anchor, i, in[i].in.script,
|
||||
if (!sign_tx_input(anchor, i, in[i].in.script,
|
||||
in[i].in.script_length,
|
||||
&in[i].privkey, &in[i].pubkey,
|
||||
&in[i].sig.sig))
|
||||
|
||||
@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
|
||||
tx->output[0].script_length = tal_count(tx->output[0].script);
|
||||
|
||||
/* Now get signature, to set up input script. */
|
||||
if (!sign_tx_input(tx, tx, 0, redeemscript, tal_count(redeemscript),
|
||||
if (!sign_tx_input(tx, 0, redeemscript, tal_count(redeemscript),
|
||||
&privkey, &pubkey1, &sig.sig))
|
||||
errx(1, "Could not sign tx");
|
||||
sig.stype = SIGHASH_ALL;
|
||||
|
||||
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* We generate our signature. */
|
||||
sig1.stype = SIGHASH_ALL;
|
||||
sign_tx_input(ctx, commit, 0, redeemscript, tal_count(redeemscript),
|
||||
sign_tx_input(commit, 0, redeemscript, tal_count(redeemscript),
|
||||
&privkey, &pubkey1, &sig1.sig);
|
||||
|
||||
/* Check it works with theirs... */
|
||||
|
||||
@@ -185,7 +185,7 @@ int main(int argc, char *argv[])
|
||||
tx->output[0].script_length = tal_count(tx->output[0].script);
|
||||
|
||||
/* Now get signature, to set up input script. */
|
||||
if (!sign_tx_input(tx, tx, 0, redeemscript, tal_count(redeemscript),
|
||||
if (!sign_tx_input(tx, 0, redeemscript, tal_count(redeemscript),
|
||||
&privkey, &key, &sig.sig))
|
||||
errx(1, "Could not sign tx");
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
|
||||
tx->output[0].script_length = tal_count(tx->output[0].script);
|
||||
|
||||
/* Now get signature, to set up input script. */
|
||||
if (!sign_tx_input(tx, tx, 0, redeemscript, tal_count(redeemscript),
|
||||
if (!sign_tx_input(tx, 0, redeemscript, tal_count(redeemscript),
|
||||
&privkey, &pubkey1, &sig.sig))
|
||||
errx(1, "Could not sign tx");
|
||||
sig.stype = SIGHASH_ALL;
|
||||
|
||||
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
invert_cstate(cstate);
|
||||
commit = create_commit_tx(ctx, o2, o1, &oa, &rhash, cstate);
|
||||
|
||||
sign_tx_input(ctx, commit, 0, redeemscript, tal_count(redeemscript),
|
||||
sign_tx_input(commit, 0, redeemscript, tal_count(redeemscript),
|
||||
&privkey, &pubkey1, &sig);
|
||||
|
||||
oa.commit_sig = signature_to_proto(ctx, &sig);
|
||||
|
||||
@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Sign it for them. */
|
||||
subscript = bitcoin_redeem_2of2(ctx, &pubkey1, &pubkey2);
|
||||
sign_tx_input(ctx, commit, 0, subscript, tal_count(subscript),
|
||||
sign_tx_input(commit, 0, subscript, tal_count(subscript),
|
||||
&privkey, &pubkey1, &sig);
|
||||
|
||||
pkt = open_commit_sig_pkt(ctx, &sig);
|
||||
|
||||
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
||||
errx(1, "Delta too large");
|
||||
|
||||
/* Sign it for them. */
|
||||
sign_tx_input(ctx, commit, 0, redeemscript, tal_count(redeemscript),
|
||||
sign_tx_input(commit, 0, redeemscript, tal_count(redeemscript),
|
||||
&privkey, &pubkey1, &sig.sig);
|
||||
|
||||
pkt = update_accept_pkt(ctx, &sig.sig, &revocation_hash);
|
||||
|
||||
@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
|
||||
errx(1, "Invalid public open-channel-file2");
|
||||
|
||||
/* Sign it for them. */
|
||||
sign_tx_input(ctx, commit, 0, redeemscript, tal_count(redeemscript),
|
||||
sign_tx_input(commit, 0, redeemscript, tal_count(redeemscript),
|
||||
&privkey, &pubkey1, &sig.sig);
|
||||
|
||||
pkt = update_signature_pkt(ctx, &sig.sig, &preimage);
|
||||
|
||||
Reference in New Issue
Block a user