| 504 | } |
| 505 | |
| 506 | static void succeed(struct info *info, |
| 507 | struct fake_htlc *htlc STEALS, |
| 508 | const struct onion_payload *payload, |
| 509 | const struct preimage *preimage) |
| 510 | { |
| 511 | struct changed_htlc *changed; |
| 512 | struct fulfilled_htlc *fulfilled; |
| 513 | u8 *msg; |
| 514 | enum channel_remove_err err; |
| 515 | |
| 516 | err = channel_fulfill_htlc(info->channel, |
| 517 | LOCAL, |
| 518 | htlc->htlc_id, |
| 519 | preimage, |
| 520 | NULL); |
| 521 | status_debug("channel_fulfill_htlc = %i", err); |
| 522 | assert(err == CHANNEL_ERR_REMOVE_OK); |
| 523 | |
| 524 | fulfilled = tal_arr(tmpctx, struct fulfilled_htlc, 1); |
| 525 | fulfilled->id = htlc->htlc_id; |
| 526 | fulfilled->payment_preimage = *preimage; |
| 527 | |
| 528 | msg = towire_channeld_got_commitsig(NULL, |
| 529 | info->commit_num, |
| 530 | info->fee_states, |
| 531 | info->blockheight_states, |
| 532 | &info->fakesig, |
| 533 | NULL, |
| 534 | NULL, |
| 535 | fulfilled, |
| 536 | NULL, |
| 537 | NULL, |
| 538 | info->commit_tx, |
| 539 | NULL); |
| 540 | daemon_conn_send(info->dc, take(msg)); |
| 541 | |
| 542 | changed = tal_arr(tmpctx, struct changed_htlc, 1); |
| 543 | changed->id = htlc->htlc_id; |
| 544 | changed->newstate = SENT_REMOVE_ACK_COMMIT; |
| 545 | |
| 546 | /* Tell it we committed, too */ |
| 547 | msg = towire_channeld_sending_commitsig(NULL, |
| 548 | info->commit_num, |
| 549 | NULL, |
| 550 | info->fee_states, |
| 551 | info->blockheight_states, |
| 552 | changed); |
| 553 | daemon_conn_send(info->dc, take(msg)); |
| 554 | |
| 555 | /* Tell it we got revoke & ack from them. */ |
| 556 | pretend_got_revoke(info, htlc->htlc_id, RCVD_REMOVE_ACK_REVOCATION); |
| 557 | |
| 558 | info->commit_num++; |
| 559 | tal_free(htlc); |
| 560 | } |
| 561 | |
| 562 | static void add_mpp(struct info *info, |
| 563 | struct fake_htlc *htlc STEALS, |
no test coverage detected