interledger-deprecated / ilp-plugin-payment-channel-framework

Framework for creating payment-channel based ILP ledger plugins
Other
2 stars 3 forks source link

separate ledger from LPI-BTP codec #31

Open michielbdejong opened 6 years ago

michielbdejong commented 6 years ago

PluginVirtual basically has two functions: the ledger and the codec.

While working on https://github.com/interledgerjs/amundsen/pull/2/files#diff-034b86edf6fcd40d95d1588b485d6d9e it occurred to me that it would probably make sense to make the virtual ledger inside src/lib/plugin.js more explicit.

If we define an in-memory ledger, whose interface is the LPI, it can:

A separate part of the code can then act as a codec, deal with translating between LPI and BTP and back (see https://github.com/interledgerjs/btp-toolbox/pull/2 for an example).

Separating the peer-ledger, which exposes two LPI interfaces (ledger.myPlugin and ledger.peerPlugin) makes LPI more important and confines the impact of BTP to inside the codec. A nice separation of concerns, maybe?

michielbdejong commented 6 years ago

implemented here: https://github.com/interledgerjs/amundsen/blob/mj-plugin-architecture/src/peerLedger.js