tools: fix update-ccan.sh

We need to ignore ccan/Makefile.

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

In particular, I saw an assert() in ccan/io.

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

We we only need it within welcome_received().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
protocol: remove block_find().

An old relic, unused.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
test/easygenesis.c: generate automatically.

We can generate it, so we should.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
protocol: clean up header comments.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
cleanup: make an explicit protocol_block_id and protocol_tx_id types.

They're just normal double SHAs, but it's a bit more typesafe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
json, logging, packet: add helpers for protocol_block_id/protocol_tx_id

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
protocol: use the protocol_block_id type.

No changes on the wire.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
check_block: make sure difficulty value is valid.

This becomes more important as we start keeping blocks where we don't
know all the ancestors, hence don't immediately validate difficulty.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
peer: don't log connection until after we've checked for dups.

This happens a lot during testing, and it's confusing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
log: don't call strlen on LOG_IO buffers.

As found by valgrind.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
pettycoin-generate: quit as soon as stdin closes.

I noticed that I was getting:

	pettycoin-generate: ''I'm not trying to cause a b-big s-s-sensation'': Broken pipe

Which can happen if pettycoin-generate is supposed to close *just* as
it is writing the solution, but should be extremely rare.

In practice, it was ignoring the zero reads from stdin, which it shouldn't;
it should ignore EWOULDBLOCK.  I renamed the function and didn't use it
where unnecessary, for increased clarity.

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