core-lightning/lightningd
trueptolemy e75d8e061b Plugin: New notification type, forward_event
`forward_event`

A notification for topic `forward_event` is sent every time the status
of a forward payment is set. The json format is same as the API
`listforwards`.

```json
{
  "forward_event": {
  "payment_hash": "f5a6a059a25d1e329d9b094aeeec8c2191ca037d3f5b0662e21ae850debe8ea2",
  "in_channel": "103x2x1",
  "out_channel": "103x1x1",
  "in_msatoshi": 100001001,
  "in_msat": "100001001msat",
  "out_msatoshi": 100000000,
  "out_msat": "100000000msat",
  "fee": 1001,
  "fee_msat": "1001msat",
  "status": "settled",
  "received_time": 1560696342.368,
  "resolved_time": 1560696342.556
  }
}
```
or

```json
{
  "forward_event": {
  "payment_hash": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
  "in_channel": "103x2x1",
  "out_channel": "110x1x0",
  "in_msatoshi": 100001001,
  "in_msat": "100001001msat",
  "out_msatoshi": 100000000,
  "out_msat": "100000000msat",
  "fee": 1001,
  "fee_msat": "1001msat",
  "status": "local_failed",
  "failcode": 16392,
  "failreason": "WIRE_PERMANENT_CHANNEL_FAILURE",
  "received_time": 1560696343.052
  }
}

```
 - The status includes `offered`, `settled`, `failed` and `local_failed`,
   and they are all string type in json.
   - When the forward payment is valid for us, we'll set `offered`
     and send the forward payment to next hop to resolve;
   - When the payment forwarded by us gets paid eventually, the forward
     payment will change the status from `offered` to `settled`;
   - If payment fails locally(like failing to resolve locally) or the
     corresponding htlc with next hop fails(like htlc timeout), we will
     set the status as `local_failed`. `local_failed` may be set before
     setting `offered` or after setting `offered`. In fact, from the
     time we receive the htlc of the previous hop, all we can know the
     cause of the failure is treated as `local_failed`. `local_failed`
     only occuors locally or happens in the htlc between us and next hop;
     - If `local_failed` is set before `offered`, this
       means we just received htlc from the previous hop and haven't
       generate htlc for next hop. In this case, the json of `forward_event`
       sets the fields of `out_msatoshi`, `out_msat`,`fee` and `out_channel`
       as 0;
       - Note: In fact, for this case we may be not sure if this incoming
         htlc represents a pay to us or a payment we need to forward.
         We just simply treat all incoming failed to resolve as
         `local_failed`.
     - Only in `local_failed` case, json includes `failcode` and
       `failreason` fields;
   - `failed` means the payment forwarded by us fails in the
     latter hops, and the failure isn't related to us, so we aren't
     accessed to the fail reason. `failed` must be set after
     `offered`.
     - `failed` case doesn't include `failcode` and `failreason`
       fields;
 - `received_time` means when we received the htlc of this payment from
   the previous peer. It will be contained into all status case;
 - `resolved_time` means when the htlc of this payment between us and the
   next peer was resolved. The resolved result may success or fail, so
   only `settled` and `failed` case contain `resolved_time`;
 - The `failcode` and `failreason` are defined in [BOLT 4][bolt4-failure-codes].
2019-08-01 18:49:25 +08:00
..
test wire: use common/bigsize routines 2019-07-31 23:25:59 +00:00
.gitignore
bitcoind.c bitcoin: Add chainparams to transactions from blocks 2019-07-31 23:22:54 +00:00
bitcoind.h lightningd: check bitcoind version when setup_topology 2019-07-30 17:38:54 +08:00
chaintopology.c tx: Add chainparams when deserializing transactions from wire msgs 2019-07-31 23:22:54 +00:00
chaintopology.h openingd/json_fund_channel: 2019-01-29 04:50:01 +00:00
channel_control.c lightningd: add slow_reconnect flag for transient failure. 2019-07-26 03:53:03 +00:00
channel_control.h common/per_per_state: generalize lightningd/peer_comm Part 1 2019-06-04 01:29:39 +00:00
channel_state.h wallet: Add a final CLOSED state to channels 2019-06-30 16:41:30 +09:30
channel.c tx: Add chainparams when deserializing transactions from wire msgs 2019-07-31 23:22:54 +00:00
channel.h lightningd: add slow_reconnect flag for transient failure. 2019-07-26 03:53:03 +00:00
closing_control.c tx: Add chainparams when deserializing transactions from wire msgs 2019-07-31 23:22:54 +00:00
closing_control.h common/per_per_state: generalize lightningd/peer_comm Part 1 2019-06-04 01:29:39 +00:00
connect_control.c lightningd: add slow_reconnect flag for transient failure. 2019-07-26 03:53:03 +00:00
connect_control.h Use node_id everywhere for nodes. 2019-04-09 12:37:16 -07:00
gossip_control.c lightningd: have json_stream_success start the "result" object. 2019-06-12 02:00:15 +00:00
gossip_control.h connectd: wean off gossip_wire message types, use our own. 2018-07-25 02:13:52 +00:00
gossip_msg.c listchannels: add htlc_minimum_msat and htlc_maximum_msat fields. 2019-06-11 23:19:11 +00:00
gossip_msg.h listchannels: add htlc_minimum_msat and htlc_maximum_msat fields. 2019-06-11 23:19:11 +00:00
hsm_control.c hsmd: Tell hsmd which chain we are working on 2019-07-31 23:22:54 +00:00
hsm_control.h Use node_id everywhere for nodes. 2019-04-09 12:37:16 -07:00
htlc_end.c wallet: Add received_time to htlc_in for forwarding times 2019-04-10 23:48:39 +00:00
htlc_end.h wallet: Add received_time to htlc_in for forwarding times 2019-04-10 23:48:39 +00:00
invoice.c doc: invoice manpage: add some details about route hint selection 2019-07-31 23:25:37 +00:00
invoice.h lightningd: move local invoice resolution into invoice.c function. 2019-04-12 03:32:48 +00:00
io_loop_with_timers.c plugins: don't crash if getmanifest times out. 2019-07-24 16:16:53 +02:00
io_loop_with_timers.h lightningd/io_loop_with_timers.c: Move mainloop to its own source file, have chaintopology use it. 2019-05-31 17:57:10 +02:00
json_stream.c lightningd: restore ' ' before '}' for older pylightning. 2019-06-17 21:46:25 +02:00
json_stream.h lightningd: restore ' ' before '}' for older pylightning. 2019-06-17 21:46:25 +02:00
json.c json: correct error message for param parser 2019-06-12 02:22:43 +00:00
json.h ccan: import ccan/json_out and ccan/json_escape. 2019-06-12 02:00:15 +00:00
jsonrpc.c lightning-cli: change default printing in response to "format-hint": "simple". 2019-07-28 06:09:56 +00:00
jsonrpc.h lightningd: tighten interal json_stream API. 2019-06-12 02:00:15 +00:00
lightningd.c lightningd/plugin: Add a 'configured' member to the plugin struct, split 'plugins_init' 2019-07-28 07:24:04 +00:00
lightningd.h developer: add --dev-force-channel-secrets. 2019-07-17 12:55:37 -05:00
log_status.c log: add 'warning' notification when log 2019-06-07 01:23:51 +00:00
log_status.h
log.c lightningd/log: prefix log messages with level. 2019-07-02 03:26:10 +00:00
log.h log: add 'warning' notification when log 2019-06-07 01:23:51 +00:00
Makefile bigsize: make it a proper first-class type. 2019-07-31 23:25:59 +00:00
memdump.c lightningd: free timers on shutdown. 2019-06-30 16:41:30 +09:30
memdump.h lightningd: add code to search strmaps for memleak detection. 2019-02-07 20:33:50 +00:00
notification.c Plugin: New notification type, forward_event 2019-08-01 18:49:25 +08:00
notification.h Plugin: New notification type, forward_event 2019-08-01 18:49:25 +08:00
onchain_control.c tx: Add chainparams when deserializing transactions from wire msgs 2019-07-31 23:22:54 +00:00
onchain_control.h onchaind: Replay stored channeltxs to restore onchaind state 2018-04-25 14:33:38 +02:00
opening_control.c tx: Add chainparams when deserializing transactions from wire msgs 2019-07-31 23:22:54 +00:00
opening_control.h common/per_per_state: generalize lightningd/peer_comm Part 1 2019-06-04 01:29:39 +00:00
options.c options: make option registration a single function. 2019-07-27 05:16:22 +00:00
options.h opt: make sure early cmdline options override config file. 2019-07-27 05:16:22 +00:00
pay.c sphinx: Clean up after migrating to the sphinx_path struct 2019-07-30 02:14:49 +00:00
pay.h lightningd: move pay internals back into pay.c 2019-01-23 22:08:08 +01:00
peer_control.c lightningd: avoid thundering herd on restart. 2019-08-01 01:10:11 +00:00
peer_control.h common: add peer_error flag to treat this error as "soft". 2019-07-26 03:53:03 +00:00
peer_htlcs.c JSON: Warp the process of forward payment json object 2019-08-01 18:49:25 +08:00
peer_htlcs.h JSON: Warp the process of forward payment json object 2019-08-01 18:49:25 +08:00
ping.c bolt: update to BOLT spec changes (extract format + type specifications) 2019-07-16 06:10:58 +00:00
ping.h ping: complete JSON RPC ping commands even if one ping gets no response. 2018-09-14 22:11:23 +02:00
plugin_control.c plugin: notice when plugin has *started* configuring. 2019-07-30 08:44:01 +08:00
plugin_control.h lightningd/plugin_control: add a 'plugin' command 2019-07-28 07:24:04 +00:00
plugin_hook.c lightningd/plugin_hook: make it possible to unregister a hook 2019-07-28 07:24:04 +00:00
plugin_hook.h lightningd/plugin_hook: make it possible to unregister a hook 2019-07-28 07:24:04 +00:00
plugin.c plugin: notice when plugin has *started* configuring. 2019-07-30 08:44:01 +08:00
plugin.h plugin: notice when plugin has *started* configuring. 2019-07-30 08:44:01 +08:00
subd.c common: add peer_error flag to treat this error as "soft". 2019-07-26 03:53:03 +00:00
subd.h common: add peer_error flag to treat this error as "soft". 2019-07-26 03:53:03 +00:00
watch.c lightningd: fix occasional missing txid detection. 2019-06-28 03:31:43 +00:00
watch.h lightningd: fix occasional missing txid detection. 2019-06-28 03:31:43 +00:00