Fix FIXME about complain_doublespend in hash.

This was changed in 75901fe65e0286c310153af23b86e7021edc4be9, so
we need to exit loop when we make complaint (shouldn't be many blocks,
so it's OK).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fix erroneous log generation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
genesis: make it static.

The genesis block itself doesn't need to meet any difficulty requirements,
so make it deterministic.

When we launch pettycoin, we'll use the bitcoin network to seed the genesis
block: this usage is shown in the mkgenesis.c source.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fix bug when reference is too large.

Instead of dereferencing NULL.

When debugging next patch:

    at chain.h:32
    ref=0x64a760) at input_refs.c:12
    refs=0x64a758, num_refs=1) at input_refs.c:40
    at recv_tx.c:94
    at recv_tx.c:152
    at blockfile.c:56

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fix obvious typo in check_refs().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Proper support for saving in block file.

It doesn't respect horizon, but it saves blocks and proven txs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>