Move varint handling from tx.c and generalize it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>