Imported from commit b96218b06b68cf349457b282f05d48ebd89c7273 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>