| 103 | } |
| 104 | |
| 105 | int main(int argc, char *argv[]) |
| 106 | { |
| 107 | struct tlv_invoice *inv; |
| 108 | struct preimage preimage; |
| 109 | struct tlv_payer_proof *proof; |
| 110 | const char *invstr, *fail; |
| 111 | secp256k1_keypair kp; |
| 112 | |
| 113 | common_setup(argv[0]); |
| 114 | |
| 115 | memset(&preimage, 0x1, sizeof(preimage)); |
| 116 | |
| 117 | /* Minimal invoice */ |
| 118 | inv = tlv_invoice_new(tmpctx); |
| 119 | inv->invreq_metadata = tal_arrz(inv, u8, 16); |
| 120 | inv->offer_issuer_id = pubkey_for_letter(inv, 'A'); |
| 121 | |
| 122 | inv->invreq_amount = tal(inv, u64); |
| 123 | *inv->invreq_amount = 1; |
| 124 | inv->invreq_payer_id = pubkey_for_letter(inv, 'B'); |
| 125 | |
| 126 | inv->invoice_paths = tal_arr(inv, struct blinded_path *, 1); |
| 127 | inv->invoice_paths[0] = tal(inv->invoice_paths, struct blinded_path); |
| 128 | sciddir_or_pubkey_from_pubkey(&inv->invoice_paths[0]->first_node_id, |
| 129 | pubkey_for_letter(tmpctx, 'C')); |
| 130 | inv->invoice_paths[0]->first_path_key = *pubkey_for_letter(tmpctx, 'D'); |
| 131 | inv->invoice_paths[0]->path = tal_arr(inv->invoice_paths[0], struct blinded_path_hop *, 1); |
| 132 | inv->invoice_paths[0]->path[0] = tal(inv->invoice_paths[0]->path, |
| 133 | struct blinded_path_hop); |
| 134 | inv->invoice_paths[0]->path[0]->blinded_node_id = *pubkey_for_letter(tmpctx, 'E'); |
| 135 | inv->invoice_paths[0]->path[0]->encrypted_recipient_data = tal_arrz(inv->invoice_paths[0]->path[0], u8, 16); |
| 136 | inv->invoice_blindedpay = tal_arr(inv, struct blinded_payinfo *, 1); |
| 137 | inv->invoice_blindedpay[0] = tal(inv->invoice_blindedpay, struct blinded_payinfo); |
| 138 | inv->invoice_blindedpay[0]->fee_base_msat = 1; |
| 139 | inv->invoice_blindedpay[0]->fee_proportional_millionths = 2; |
| 140 | inv->invoice_blindedpay[0]->cltv_expiry_delta = 3; |
| 141 | inv->invoice_blindedpay[0]->htlc_minimum_msat = AMOUNT_MSAT(4); |
| 142 | inv->invoice_blindedpay[0]->htlc_maximum_msat = AMOUNT_MSAT(5); |
| 143 | inv->invoice_blindedpay[0]->features = NULL; |
| 144 | |
| 145 | inv->invoice_created_at = tal(inv, u64); |
| 146 | *inv->invoice_created_at = 1733458312; |
| 147 | inv->invoice_payment_hash = tal(inv, struct sha256); |
| 148 | sha256(inv->invoice_payment_hash, &preimage, sizeof(preimage)); |
| 149 | inv->invoice_amount = tal(inv, u64); |
| 150 | *inv->invoice_amount = 1; |
| 151 | inv->invoice_node_id = pubkey_for_letter(inv, 'F'); |
| 152 | |
| 153 | inv->signature = invoice_signature(inv, inv, 'F'); |
| 154 | |
| 155 | /* We did OK, right? Also, canonicalizes. */ |
| 156 | invstr = invoice_encode(tmpctx, inv); |
| 157 | inv = invoice_decode(tmpctx, invstr, strlen(invstr), NULL, NULL, &fail); |
| 158 | assert(inv); |
| 159 | |
| 160 | /* OK, make a proof (include everything) */ |
| 161 | proof = make_unsigned_proof(tmpctx, inv, &preimage, "test", |
| 162 | exclude_this, int2ptr(0)); |
nothing calls this directly
no test coverage detected