| 41 | REGISTER_PAYMENT_MODIFIER_HEADER(keysend, struct keysend_data); |
| 42 | |
| 43 | static struct keysend_data *keysend_init(struct payment *p) |
| 44 | { |
| 45 | struct keysend_data *d; |
| 46 | struct sha256 payment_hash; |
| 47 | if (p->parent == NULL) { |
| 48 | /* If we are the root payment we generate a random preimage |
| 49 | * and populate the preimage field in the keysend_data and the |
| 50 | * payment_hash in the payment. */ |
| 51 | d = tal(p, struct keysend_data); |
| 52 | randbytes(&d->preimage, sizeof(d->preimage)); |
| 53 | ccan_sha256(&payment_hash, &d->preimage, sizeof(d->preimage)); |
| 54 | p->payment_hash = tal_dup(p, struct sha256, &payment_hash); |
| 55 | d->extra_tlvs = NULL; |
| 56 | return d; |
| 57 | } else { |
| 58 | /* If we are a child payment (retry or split) we copy the |
| 59 | * parent's information, since the payment_hash needs to match |
| 60 | * in order to be collated at the recipient. */ |
| 61 | return payment_mod_keysend_get_data(p->parent); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | static struct command_result *keysend_cb(struct keysend_data *d, struct payment *p) { |
| 66 | struct createonion_hop *last_payload; |
nothing calls this directly
no outgoing calls
no test coverage detected