Not everybody likes debugging printfs as much as I

This commit is contained in:
Nick Mathewson 2009-11-18 11:26:44 -05:00
parent 55cd2fa310
commit 9be682942c

View File

@ -1417,26 +1417,22 @@ networkstatus_add_detached_signatures(networkstatus_t *target,
/* Do the times seem right? */ /* Do the times seem right? */
if (target->valid_after != sigs->valid_after) { if (target->valid_after != sigs->valid_after) {
puts("A");
*msg_out = "Valid-After times do not match " *msg_out = "Valid-After times do not match "
"when adding detached signatures to consensus"; "when adding detached signatures to consensus";
return -1; return -1;
} }
if (target->fresh_until != sigs->fresh_until) { if (target->fresh_until != sigs->fresh_until) {
puts("B");
*msg_out = "Fresh-until times do not match " *msg_out = "Fresh-until times do not match "
"when adding detached signatures to consensus"; "when adding detached signatures to consensus";
return -1; return -1;
} }
if (target->valid_until != sigs->valid_until) { if (target->valid_until != sigs->valid_until) {
puts("C");
*msg_out = "Valid-until times do not match " *msg_out = "Valid-until times do not match "
"when adding detached signatures to consensus"; "when adding detached signatures to consensus";
return -1; return -1;
} }
siglist = strmap_get(sigs->signatures, flavor); siglist = strmap_get(sigs->signatures, flavor);
if (!siglist) { if (!siglist) {
puts("D");
*msg_out = "No signatures for given consensus flavor"; *msg_out = "No signatures for given consensus flavor";
return -1; return -1;
} }
@ -1447,7 +1443,6 @@ networkstatus_add_detached_signatures(networkstatus_t *target,
int n_matches = 0; int n_matches = 0;
digest_algorithm_t alg; digest_algorithm_t alg;
if (!digests) { if (!digests) {
puts("D");
*msg_out = "No digests for given consensus flavor"; *msg_out = "No digests for given consensus flavor";
return -1; return -1;
} }
@ -1456,16 +1451,12 @@ networkstatus_add_detached_signatures(networkstatus_t *target,
if (!memcmp(target->digests.d[alg], digests->d[alg], DIGEST256_LEN)) { if (!memcmp(target->digests.d[alg], digests->d[alg], DIGEST256_LEN)) {
++n_matches; ++n_matches;
} else { } else {
printf("F %d\n", alg);
printf("%s\n", hex_str(target->digests.d[alg], DIGEST256_LEN));
printf("%s\n", hex_str(digests->d[alg], DIGEST256_LEN));
*msg_out = "Mismatched digest."; *msg_out = "Mismatched digest.";
return -1; return -1;
} }
} }
} }
if (!n_matches) { if (!n_matches) {
puts("G");
*msg_out = "No regognized digests for given consensus flavor"; *msg_out = "No regognized digests for given consensus flavor";
} }
} }