ledgerloops / snap-checker

Network Ledger, based on ledgerloops-0.8 messages over Hubbie.
https://ledgerloops.com
4 stars 0 forks source link

move messaging into ledgers #15

Closed michielbdejong closed 5 years ago

michielbdejong commented 5 years ago

It's easiest if a agent's ledger for a neighbor deals sits in front of the messaging for that neighbor. That's also the architecture InterledgerJS uses, and the one I started with https://github.com/ledgerloops/ledgerloops-peer.

michielbdejong commented 5 years ago

So then the ledger would keep the following interactions inside:

The Agent then still needs to:

michielbdejong commented 5 years ago

Ledger(chan, relayCbForCond, relayCbForProbe) Ledger.pay(amount) => Promise Ledger.getReport() (returns balance, commited, pending)

it would be nice if the ledgers talk directly to each other, without the Agent seeing what they are telling each other. But the Agent should keep the routing table. So maybe this routing table should be an object to which all ledgers have a reference. They need to be able to tell the routing table when they receive a probe, and query the routing table for current routes above/below a certain balance.

or maybe each ledger keeps track of its own peer's routes, and the central hub only give access to hooking up with higher/lower ledgers. So maybe it's just the array of ledgers, and the ledgers call each other's getBalance function directly to see if they want to hook up or not. To make this more efficient, maybe keep the array of ledgers sorted by balance. When you get a Probe, forward fwd/rev probes to all highers/lowers. When you get a Cond, forward it to the highest ledger that has that route.

michielbdejong commented 5 years ago

done