| 121 | } |
| 122 | |
| 123 | static void print_update(const struct bitcoin_blkid *chainhash, |
| 124 | const struct short_channel_id *scid, |
| 125 | const struct update_opts *opts, |
| 126 | bool is_lesser_key, |
| 127 | const struct privkey *privkey) |
| 128 | { |
| 129 | /* 2 bytes msg type + 64 bytes of signature */ |
| 130 | const size_t channel_update_offset = 2 + 64; |
| 131 | struct sha256_double hash; |
| 132 | secp256k1_ecdsa_signature sig; |
| 133 | u8 *cupdate; |
| 134 | |
| 135 | memset(&sig, 0, sizeof(sig)); |
| 136 | cupdate = towire_channel_update |
| 137 | (NULL, &sig, chainhash, scid, opts->timestamp, |
| 138 | ROUTING_OPT_HTLC_MAX_MSAT, |
| 139 | is_lesser_key ? 0 : ROUTING_FLAGS_DIRECTION, |
| 140 | opts->cltv_expiry_delta, |
| 141 | opts->min, |
| 142 | opts->feebase.millisatoshis, /* Raw: devtools code */ |
| 143 | opts->fee_proportional_millionths, |
| 144 | opts->max); |
| 145 | sha256_double(&hash, cupdate + channel_update_offset, |
| 146 | tal_count(cupdate) - channel_update_offset); |
| 147 | sign_hash(privkey, &hash, &sig); |
| 148 | |
| 149 | printf("type=channel_update\n"); |
| 150 | printf(" signature=%s\n", sig_notation(privkey, &hash, &sig)); |
| 151 | printf(" chain_hash=%s\n", tal_hexstr(NULL, chainhash, sizeof(*chainhash))); |
| 152 | printf(" short_channel_id=%s\n", short_channel_id_to_str(NULL, scid)); |
| 153 | printf(" timestamp=%u\n", opts->timestamp); |
| 154 | printf(" message_flags=%u\n", |
| 155 | ROUTING_OPT_HTLC_MAX_MSAT); |
| 156 | printf(" channel_flags=%u\n", |
| 157 | is_lesser_key ? 0 : ROUTING_FLAGS_DIRECTION); |
| 158 | printf(" cltv_expiry_delta=%u\n", |
| 159 | opts->cltv_expiry_delta); |
| 160 | printf(" htlc_minimum_msat=%"PRIu64"\n", |
| 161 | opts->min.millisatoshis); /* Raw: devtools code */ |
| 162 | printf(" fee_base_msat=%"PRIu64"\n", |
| 163 | opts->feebase.millisatoshis); /* Raw: devtools code */ |
| 164 | printf(" fee_proportional_millionths=%u\n", |
| 165 | opts->fee_proportional_millionths); |
| 166 | printf(" htlc_maximum_msat=%"PRIu64"\n", |
| 167 | opts->max.millisatoshis); /* Raw: devtools code */ |
| 168 | printf("# crc32c checksum: %08x\n", crc32_of_update(cupdate)); |
| 169 | } |
| 170 | |
| 171 | static void print_nannounce(const struct node_id *nodeid, |
| 172 | const struct update_opts *opts, |
no test coverage detected