| 97 | } |
| 98 | |
| 99 | static void towire_compact_size(u8 **pptr, u64 v) |
| 100 | { |
| 101 | if (v < 0xfd) { |
| 102 | towire_u8(pptr, v); |
| 103 | } else if (v <= 0xffff) { |
| 104 | le16 v16 = cpu_to_le16(v); |
| 105 | towire_u8(pptr, 0xfd); |
| 106 | towire(pptr, &v16, sizeof(v16)); |
| 107 | } else if (v <= 0xffffffff) { |
| 108 | le32 v32 = cpu_to_le32(v); |
| 109 | towire_u8(pptr, 0xfe); |
| 110 | towire(pptr, &v32, sizeof(v32)); |
| 111 | } else { |
| 112 | le64 v64 = cpu_to_le64(v); |
| 113 | towire_u8(pptr, 0xff); |
| 114 | towire(pptr, &v64, sizeof(v64)); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | static void towire_keypair(u8 **pptr, const struct keypair *kp) |
| 119 | { |
no test coverage detected