Skip to content

Fix #60

どら edited this page May 24, 2019 · 26 revisions

Basic policy

  • Make a module of echo.rs in interledger-service-util crate
  • Insert the service into node.rs

Must-learn Specs

Brief Spec

  • echo service responds to the address of the node
    • a sender sends an ILP prepare packet (packet A)
    • a receiver responds with a new ILP prepare packet (packet B) to the sender
    • These packets should be handled before any other actual core services that make funds on-hold
  • the packet data of the prepare ILP packets is like below:
    • A type
      • amount arbitrary
      • executionCondition arbitrary
      • expiresAt arbitrary
      • destination the address of the node
      • data
        • ECHOECHOECHOECHO(16 bytes) + 0 + VarOctetString(source address)
    • B type
      • amount the same as the received packet
      • executionCondition the same as the received packet
      • expiresAt arbitrary (tipically the expires of the packet - 1000 (minMessageWindow))
      • destination source address that extracted from the received packet
      • data
        • ECHOECHOECHOECHO(16 bytes) + 1
  • the receiver (who receives packet A)
    • responds with a B type packet
    • throws error when the data size of ILP packet is less than 17 bytes
      • 17 bytes = ECHOECHOECHOECHO + type(0)
    • throws error when the data does not start with ECHOECHOECHOECHO
    • these errors should be handled as ILP reject packets
      • F01_INVALID_PACKET

Question

  • What happens if a sender sends echo packets to a terminal receiver that does not implement echo server (not a connector)?

ILP Packet handling in ilp-connector

  • index.ts
    • creates App and listen
  • app.ts
    • createApp loads accounts from env or config, and adds it to Accounts
    • listen
      • adminApi.listen()
      • backend.connect()
      • middlewareManager.setup()
      • accounts.loadIlpAddress()
      • accounts.connect()
      • middlewareManager.startup()
  • middleware-manager.ts
    • constructor adds BUILTIN_MIDDLEWARES
      • error-handler, throughput, etc...
      • error-handler is inserted first, and called first covering all the exceptions
    • setup adds plug-ins for each account, and sets up Pipelines
    • startup calls startup handlers of each account

memo

  • warning
Clone this wiki locally