Skip to content

Commit

Permalink
Remove another unused function.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jul 29, 2014
1 parent 0f95d9a commit 5dcc1b3
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions sync.c
Expand Up @@ -33,46 +33,6 @@ static u32 num_children(const struct block *block,
return num;
}

/*
* We step back more than one if we are better than target. This
* allows effective compression while being as difficult to generate
* as the full chain (not my idea: from Gregory Maxwell, I just
* adapted it for here).
*/
static u32 num_steps(const struct block *b, BN_CTX *bn_ctx)
{
BIGNUM target, ratio, *val;
unsigned long steps = 1;

if (!decode_difficulty(le32_to_cpu(b->tailer->difficulty), &target))
goto out;

val = BN_bin2bn(b->sha.sha, sizeof(b->sha.sha), NULL);
if (!val)
goto free_target;

BN_init(&ratio);
if (!BN_div(&ratio, NULL, &target, val, bn_ctx))
goto free_ratio;

/* Returns 0xffffffffL if ratio is too big, which is fine. */
steps = BN_get_word(&ratio);
/* Block value must be <= target. */
assert(steps > 0);

/* This is possible on 64 bit systems */
if (steps > (u32)steps)
steps = 0xFFFFFFFF;

free_ratio:
BN_free(&ratio);
BN_free(val);
free_target:
BN_free(&target);
out:
return steps;
}

static struct protocol_pkt_sync *sync_pkt(struct peer *peer,
const struct block *horizon,
const struct block *mutual)
Expand Down

0 comments on commit 5dcc1b3

Please sign in to comment.