Add fee of 3/1024ths of total amount of tx.

You can opt out of the fee, but miners may not accept it (see next patch).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Implement --require-fees and --require-gateway-fees.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Don't assert() if an input is too close to horizon.

When resolving inputs, we don't care about how old the transaction is:
this is done by create_refs().  So it can fail, and we have to handle it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Define reward period, and ban 0-satoshi transactions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Add two missing files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Unify creation of tx_in_block packets.

And fix two bugs:
1) We sent the wrong packet for send_tx_in_block_to_peers.
2) We derefed a NULL pointer calling tal_packet_append_pos() in recv_get_tx_in_block() if we didn't know block.

And rename block_pkt to pkt_block to match naming convention.

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

After several false starts, I settled on the simplest solution: a new
transaction which has a special input to reflect the "randomly" selected
transaction within a block which is the basis for the reward.

The next patch will implement support for complaints when a TX_CLAIM
transaction is invalid.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Complaint handling for TX_CLAIM.

We need to know the location of the reward tx (claim input), not just
its contents, so this is slightly different to the various normal tx
complaints.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Move complaint reception out to separate file.

And simplify packet functions.

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