forked from interledger/interledger-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix #60
どら edited this page May 25, 2019
·
26 revisions
- Make a module of
echo.rs
ininterledger-service-util
crate - Insert the service into node.rs
-
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
- a sender sends an ILP prepare packet (packet
- 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)
- 17 bytes =
- throws error when the data does not start with
ECHOECHOECHOECHO
- these errors should be handled as ILP reject packets
F01_INVALID_PACKET
- responds with a
- How to pass prepare-packet from
IncomingService
? - Structure of routing and outgoing services(account)?
- What happens if a sender sends echo packets to a terminal receiver that does not implement echo server (not a connector)?
-
index.ts
- creates App and listen
-
app.ts
-
createApp
loads accounts from env or config, and adds it toAccounts
-
listen
adminApi.listen()
backend.connect()
middlewareManager.setup()
accounts.loadIlpAddress()
accounts.connect()
middlewareManager.startup()
-
-
middleware-manager.ts
-
constructor
addsBUILTIN_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 upPipelines
-
startup
calls startup handlers of each account
-
-
PrepareBuilder
accepts&[u8; 32]
whilePrepare::execution_condition()
returns&[u8]