mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-05 22:24:25 +01:00
pubkey: pubkey_eq helper.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -79,8 +79,7 @@ int main(int argc, char *argv[])
|
||||
/* Get pubkeys */
|
||||
if (!proto_to_pubkey(o1->commit_key, &pubkey2))
|
||||
errx(1, "Invalid o1 commit pubkey");
|
||||
if (pubkey_len(&pubkey1) != pubkey_len(&pubkey2)
|
||||
|| memcmp(pubkey1.key, pubkey2.key, pubkey_len(&pubkey2)) != 0)
|
||||
if (!pubkey_eq(&pubkey1, &pubkey2))
|
||||
errx(1, "o1 pubkey != this privkey");
|
||||
if (!proto_to_pubkey(o2->commit_key, &pubkey2))
|
||||
errx(1, "Invalid o2 commit pubkey");
|
||||
|
||||
@@ -77,8 +77,7 @@ int main(int argc, char *argv[])
|
||||
/* Get pubkeys */
|
||||
if (!proto_to_pubkey(o1->final_key, &pubkey2))
|
||||
errx(1, "Invalid o1 final pubkey");
|
||||
if (pubkey_len(&pubkey1) != pubkey_len(&pubkey2)
|
||||
|| memcmp(pubkey1.key, pubkey2.key, pubkey_len(&pubkey2)) != 0)
|
||||
if (!pubkey_eq(&pubkey1, &pubkey2))
|
||||
errx(1, "o1 pubkey != this privkey");
|
||||
if (!proto_to_pubkey(o2->final_key, &pubkey2))
|
||||
errx(1, "Invalid o2 final pubkey");
|
||||
|
||||
@@ -60,8 +60,7 @@ int main(int argc, char *argv[])
|
||||
/* Get pubkeys */
|
||||
if (!proto_to_pubkey(o1->commit_key, &pubkey2))
|
||||
errx(1, "Invalid o1 commit pubkey");
|
||||
if (pubkey_len(&pubkey1) != pubkey_len(&pubkey2)
|
||||
|| memcmp(pubkey1.key, pubkey2.key, pubkey_len(&pubkey2)) != 0)
|
||||
if (!pubkey_eq(&pubkey1, &pubkey2))
|
||||
errx(1, "o1 pubkey != this privkey");
|
||||
if (!proto_to_pubkey(o2->commit_key, &pubkey2))
|
||||
errx(1, "Invalid o2 commit pubkey");
|
||||
|
||||
@@ -99,11 +99,9 @@ int main(int argc, char *argv[])
|
||||
if (!proto_to_pubkey(o2->final_key, &pubkey2))
|
||||
errx(1, "Invalid o2 final pubkey");
|
||||
|
||||
if (pubkey_len(&key) == pubkey_len(&pubkey1)
|
||||
&& memcmp(key.key, pubkey1.key, pubkey_len(&pubkey1)) == 0) {
|
||||
if (pubkey_eq(&key, &pubkey1)) {
|
||||
own_commit_tx = true;
|
||||
} else if (pubkey_len(&key) == pubkey_len(&pubkey2)
|
||||
&& memcmp(key.key, pubkey2.key, pubkey_len(&pubkey2)) == 0) {
|
||||
} else if (pubkey_eq(&key, &pubkey2)) {
|
||||
own_commit_tx = false;
|
||||
} else
|
||||
errx(1, "Privkey doesn't match either key");
|
||||
|
||||
@@ -77,8 +77,7 @@ int main(int argc, char *argv[])
|
||||
/* Get pubkeys */
|
||||
if (!proto_to_pubkey(o1->final_key, &pubkey2))
|
||||
errx(1, "Invalid o1 final pubkey");
|
||||
if (pubkey_len(&pubkey1) != pubkey_len(&pubkey2)
|
||||
|| memcmp(pubkey1.key, pubkey2.key, pubkey_len(&pubkey2)) != 0)
|
||||
if (!pubkey_eq(&pubkey1, &pubkey2))
|
||||
errx(1, "o1 pubkey != this privkey");
|
||||
if (!proto_to_pubkey(o2->final_key, &pubkey2))
|
||||
errx(1, "Invalid o2 final pubkey");
|
||||
|
||||
@@ -74,8 +74,7 @@ int main(int argc, char *argv[])
|
||||
/* Get pubkeys */
|
||||
if (!proto_to_pubkey(o1->commit_key, &pubkey2))
|
||||
errx(1, "Invalid o1 commit pubkey");
|
||||
if (pubkey_len(&pubkey1) != pubkey_len(&pubkey2)
|
||||
|| memcmp(pubkey1.key, pubkey2.key, pubkey_len(&pubkey2)) != 0)
|
||||
if (!pubkey_eq(&pubkey1, &pubkey2))
|
||||
errx(1, "o1 pubkey != this privkey");
|
||||
if (!proto_to_pubkey(o2->commit_key, &pubkey2))
|
||||
errx(1, "Invalid o2 commit pubkey");
|
||||
|
||||
@@ -77,8 +77,7 @@ int main(int argc, char *argv[])
|
||||
/* Get pubkeys */
|
||||
if (!proto_to_pubkey(o1->commit_key, &pubkey2))
|
||||
errx(1, "Invalid o1 commit pubkey");
|
||||
if (pubkey_len(&pubkey1) != pubkey_len(&pubkey2)
|
||||
|| memcmp(pubkey1.key, pubkey2.key, pubkey_len(&pubkey2)) != 0)
|
||||
if (!pubkey_eq(&pubkey1, &pubkey2))
|
||||
errx(1, "o1 pubkey != this privkey");
|
||||
if (!proto_to_pubkey(o2->commit_key, &pubkey2))
|
||||
errx(1, "Invalid o2 commit pubkey");
|
||||
|
||||
Reference in New Issue
Block a user