permute: use BIP69 order.

It's a canonical ordering, rather than a random shuffle.  Far simpler.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2015-07-20 09:56:15 +09:30
parent d93eee22f5
commit 8a4246cb36
11 changed files with 37 additions and 139 deletions

View File

@@ -59,12 +59,6 @@ static BitcoinInput *parse_anchor_input(const tal_t *ctx, const char *spec)
return in;
}
/* FIXME: This is too weak, even for us! */
static u64 weak_random64(void)
{
return time(NULL);
}
/* Simple helper to open a channel. */
int main(int argc, char *argv[])
{
@@ -166,7 +160,7 @@ int main(int argc, char *argv[])
sha256(&revocation_hash,
revocation_hash.u.u8, sizeof(revocation_hash.u.u8));
pkt = openchannel_pkt(ctx, weak_random64(), &revocation_hash, &outkey,
pkt = openchannel_pkt(ctx, &revocation_hash, &outkey,
commit_tx_fee, locktime_seconds, &anchor);
if (!write_all(STDOUT_FILENO, pkt, pkt_totlen(pkt)))