| 147 | } |
| 148 | |
| 149 | int main(int argc, char *argv[]) |
| 150 | { |
| 151 | struct tlv_offer *offer; |
| 152 | struct secret alice, bob; |
| 153 | struct blinded_path **paths; |
| 154 | |
| 155 | common_setup(argv[0]); |
| 156 | |
| 157 | memset(&alice, 'A', sizeof(alice)); |
| 158 | memset(&bob, 'B', sizeof(bob)); |
| 159 | |
| 160 | offer = tlv_offer_new(tmpctx); |
| 161 | offer->offer_issuer_id = tal(offer, struct pubkey); |
| 162 | assert(pubkey_from_secret(&alice, offer->offer_issuer_id)); |
| 163 | |
| 164 | printf("[\n"); |
| 165 | print_valid_offer(offer, "Minimal bolt12 offer", NULL, NULL); |
| 166 | offer->offer_description = tal_utf8(tmpctx, "Test vectors"); |
| 167 | print_valid_offer(offer, "with description (but no amount)", |
| 168 | "description is 'Test vectors'", NULL); |
| 169 | |
| 170 | offer->offer_chains = tal_arr(offer, struct bitcoin_blkid, 1); |
| 171 | offer->offer_chains[0] = chainparams_for_network("testnet")->genesis_blockhash; |
| 172 | print_valid_offer(offer, "for testnet", |
| 173 | "chains[0] is testnet", NULL); |
| 174 | offer->offer_chains[0] = chainparams_for_network("bitcoin")->genesis_blockhash; |
| 175 | print_valid_offer(offer, "for bitcoin (redundant)", |
| 176 | "chains[0] is bitcoin", NULL); |
| 177 | offer->offer_chains = tal_arr(offer, struct bitcoin_blkid, 2); |
| 178 | offer->offer_chains[0] = chainparams_for_network("liquid")->genesis_blockhash; |
| 179 | offer->offer_chains[1] = chainparams_for_network("bitcoin")->genesis_blockhash; |
| 180 | print_valid_offer(offer, "for bitcoin or liquidv1", |
| 181 | "chains[0] is liquidv1, chains[1] is bitcoin", NULL); |
| 182 | offer->offer_chains = NULL; |
| 183 | |
| 184 | offer->offer_metadata = tal_arrz(offer, u8, 16); |
| 185 | print_valid_offer(offer, "with metadata", |
| 186 | "metadata is 16 zero bytes", NULL); |
| 187 | offer->offer_metadata = NULL; |
| 188 | |
| 189 | offer->offer_amount = tal(offer, u64); |
| 190 | *offer->offer_amount = 10000; |
| 191 | print_valid_offer(offer, "with amount", |
| 192 | "amount is 10000msat", NULL); |
| 193 | |
| 194 | offer->offer_currency = tal_utf8(offer, "USD"); |
| 195 | print_valid_offer(offer, "with currency", |
| 196 | "amount is USD $100.00", NULL); |
| 197 | offer->offer_currency = NULL; |
| 198 | offer->offer_amount = NULL; |
| 199 | |
| 200 | offer->offer_absolute_expiry = tal(offer, u64); |
| 201 | *offer->offer_absolute_expiry = 2051184600; |
| 202 | print_valid_offer(offer, "with expiry", |
| 203 | "expiry is 2035-01-01", NULL); |
| 204 | offer->offer_absolute_expiry = NULL; |
| 205 | |
| 206 | offer->offer_issuer = tal_utf8(offer, "https://bolt12.org BOLT12 industries"); |
nothing calls this directly
no test coverage detected