interledgerjs / rafiki

An ILP component framework based on Koa
14 stars 9 forks source link

issues trying to peer with reference js connector #13

Open treisto opened 5 years ago

treisto commented 5 years ago

Hi, I am trying to peer with https://github.com/interledgerjs/ilp-connector in a private network. Below is the start.js file:

#!/usr/bin/env node
"use strict";
...............................................
const ILP_ADDRESS = process.env.ILP_ADDRESS || 'g.rafiki';
const HTTP2_SERVER_PORT = Number(process.env.HTTP2_SERVER_PORT) || 8443;
const SETTLEMENT_BALANCE_STREAM_KEY = process.env.SETTLEMENT_BALANCE_STREAM_KEY || 'balance';
const SETTLEMENT_REDIS_HOST = process.env.SETTLEMENT_REDIS_HOST || '0.0.0.0';
const SETTLEMENT_REDIS_PORT = Number(process.env.SETTLEMENT_REDIS_PORT) || 6379;
const ADMIN_API_HOST = process.env.ADMIN_API_HOST || '0.0.0.0';
const ADMIN_API_PORT = Number(process.env.ADMIN_API_PORT) || 7780;
...........................................
const peerInfo = {
                "relation": "peer",
                "id": "conn1",
                "assetCode": "XRP",
                "assetScale": 9,
                "rules": [],
                "protocols": [{
                        name: 'ccp',
                        sendRoutes: true,
                        receiveRoutes: true
                    }]
            };
const endpointInfo = {
                "type": "plugin",
                "pluginOpts": {
                    "name": "ilp-plugin-xrp-paychan",
                    "opts": {
                        //"port": "6666",
                        "server": "btp+ws://:@192.168.1.146:6666",
                        "address": "rbBRFnAdcG9L2eiNxbmqjzEZKRJKiy2J8",
                        "secret": "ss9t8iHgg2R7aG2AsWwKjoLBDGfSE",
                        "xrpServer": "ws://192.168.1.98:51233",
                        "maxBalance": "100000",
                        "settleThreshold": "-500000",
                        "settleTo": "0"
                        //"maxPacketAmount": "1000"
                    }
                }
            };
////////////////////////
const start = async () => {
    let shuttingDown = false;
  .......................
        catch (err) {
            const errInfo = (err && typeof err === 'object' && err.stack) ? err.stack : err;
            winston.error('error while shutting down. error=%s', errInfo);
            process.exit(1);
        }
    });
    const app = new app_1.App({
        ilpAddress: ILP_ADDRESS,
        http2Port: HTTP2_SERVER_PORT,
        backend: 'one-to-one',
        store: 'memdown',
        env: 'production'
    });
    const settlementEngine = new settlement_engine_1.SettlementEngine({ streamKey: SETTLEMENT_BALANCE_STREAM_KEY, redisClient: new ioredis_1.default({ host: SETTLEMENT_REDIS_HOST, port: SETTLEMENT_REDIS_PORT }) });
    const adminApi = new admin_api_1.AdminApi({ host: ADMIN_API_HOST, port: ADMIN_API_PORT }, { app, settlementEngine });
    console.log('***START.js***: ILP_ADDRESS: ', ILP_ADDRESS);
    await app.start();
    await app.addPeer(peerInfo, endpointInfo);
    adminApi.listen();
};
if (!module.parent) {
    start().catch(e => {
        const errInfo = (e && typeof e === 'object' && e.stack) ? e.stack : e;
        winston.error(errInfo);
    });
}
//# sourceMappingURL=start.js.map

The connectors establish a paychan and in the js connector's moneyd GUI things look almost normal, but ping doesn't work "F02: failed to send: can't route the request due to no route found for the given prefix'.

Also, in the Rafiki log I am getting:

 ilp-plugin-xrp-paychan:trace sending btp packet. type=TYPE_MESSAGE requestId=1514439279 info=ilp-prepare +2s
  ilp-plugin-xrp-paychan:trace received btp packet. type=TYPE_RESPONSE requestId=1514439279 info=ilp-fulfill +14ms
2019-04-19T14:55:47.666Z [connector-ccp-sender] silly:  scheduling next route update
2019-04-19T14:55:50.057Z [connector-ccp-sender] silly:  broadcasting routes to peer
  ilp-plugin-xrp-paychan:trace sending btp packet. type=TYPE_MESSAGE requestId=2997892276 info=ilp-prepare +2s
  ilp-plugin-xrp-paychan:trace received btp packet. type=TYPE_RESPONSE requestId=2997892276 info=ilp-fulfill +9ms
2019-04-19T14:55:50.069Z [connector-ccp-sender] silly:  scheduling next route update
  ilp-plugin-xrp-paychan:trace sending btp packet. type=TYPE_MESSAGE requestId=2517968898 info=ilp-prepare +1s
  ilp-plugin-xrp-paychan:trace received btp packet. type=TYPE_RESPONSE requestId=2517968898 info=ilp-fulfill +12ms
2019-04-19T14:55:51.109Z [connector-ccp-receiver] debug:    unknown response packet type
2019-04-19T14:55:51.110Z [connector-ccp-receiver] debug:    failed to set route control information on peer
  ilp-plugin-xrp-paychan:trace received btp packet. type=TYPE_MESSAGE requestId=3652808839 info=ilp-prepare +157ms
2019-04-19T14:55:51.265Z [connector-ccp-protocol] silly:    received peer.route.update
2019-04-19T14:55:51.268Z [connector-ccp-receiver] silly:    saw new routing table.
2019-04-19T14:55:51.269Z [connector-ccp-receiver] silly:    received withdrawn routes
  ilp-plugin-xrp-paychan:debug Error processing BTP packet of type 6:  TypeError: this.getPeer is not a function
    at Connector.removeRoute (/home/lucian/rafiki/node_modules/ilp-routing/build/ilp-route-manager/index.js:41:27)
    at CcpReceiver.handleRouteUpdate (/home/lucian/rafiki/build/src/protocols/ccp/ccp-receiver.js:80:22)
    at CcpProtocol.handleCcpRouteUpdateMessage (/home/lucian/rafiki/build/src/protocols/ccp/index.js:62:26)
    at CcpProtocol._processIncoming (/home/lucian/rafiki/build/src/protocols/ccp/index.js:22:33)
    at Object.write (/home/lucian/rafiki/build/src/types/rule.js:26:29)
    at Object.write (/home/lucian/rafiki/build/src/types/request-stream/index.js:15:58)
    at /home/lucian/rafiki/build/src/types/rule.js:77:66
    at endpoint.setIncomingRequestHandler (/home/lucian/rafiki/build/src/connector.js:43:20)
    at PluginXrpPaychan._plugin.registerDataHandler [as _dataHandler] (/home/lucian/rafiki/build/src/legacy/plugin-endpoint.js:44:57)
    at PluginXrpPaychan._handleData (/home/lucian/rafiki/node_modules/ilp-plugin-xrp-paychan/index.js:204:33) +35s
  ilp-plugin-xrp-paychan:trace sending btp packet. type=TYPE_ERROR requestId=3652808839 info= +5ms
2019-04-19T14:55:52.459Z [connector-ccp-sender] silly:  broadcasting routes to peer
  ilp-plugin-xrp-paychan:trace sending btp packet. type=TYPE_MESSAGE requestId=3813844339 info=ilp-prepare +1s

can this be related to this pull not being integrated yet? https://github.com/interledgerjs/ilp-protocol-ccp/pull/3

matdehaast commented 5 years ago

@treisto Thanks for the detailed issue. I am going to try spend some time later this week debugging the issue you had.