interledger-deprecated / ilp-core

Core ILP module — handles ledger abstraction and quoting
Other
8 stars 5 forks source link

manual transfers appear as the connector #19

Open diminator opened 8 years ago

diminator commented 8 years ago
const bob = new Client({
    type: 'bells',
    auth: {
        account: 'https://blue.ilpdemo.org/ledger/accounts/bob',
        password: 'bobbob'
    }
})

bob.on('receive', (transfer) => {
    console.log(transfer)
    bob.fulfillCondition(transfer.id, 'cf:0:')
})

const diminator = new Client({
    type: 'bells',
    auth: {
        account: 'https://red.ilpdemo.org/ledger/accounts/diminator',
        password: 'interledger'
    }
})

diminator.waitForConnection().then(() => {
    diminator.quote({ ... });
})

Most of the times it just rejects the transfers:

2:06:52 PM.900 [ilp-plugin-bells:plugin] <DEBUG> subscribing to wss://blue.ilpdemo.org/ledger/accounts/bob/transfers
2:06:52 PM.922 [ilp-plugin-bells:plugin] <DEBUG> subscribing to wss://red.ilpdemo.org/ledger/accounts/diminator/transfers
2:06:53 PM.589 [ilp-plugin-bells:plugin] <INFO> ws connected to wss://red.ilpdemo.org/ledger/accounts/diminator/transfers
2:06:53 PM.644 [ilp-plugin-bells:plugin] <INFO> ws connected to wss://blue.ilpdemo.org/ledger/accounts/bob/transfers
2:06:54 PM.122 [ilp-plugin-bells:plugin] <DEBUG> submitting transfer https://red.ilpdemo.org/ledger/transfers/c8a91bdb-3182-441e-9a0f-322a8022b82e
2:06:54 PM.687 [ilp-plugin-bells:plugin] <DEBUG> notify transfer prepared https://red.ilpdemo.org/ledger/transfers/c8a91bdb-3182-441e-9a0f-322a8022b82e
payment sent
2:06:54 PM.752 [ilp-plugin-bells:plugin] <DEBUG> notify transfer prepared https://blue.ilpdemo.org/ledger/transfers/d38be2b8-fdd4-4591-8b61-c35a8aeb77e1
{ id: 'd38be2b8-fdd4-4591-8b61-c35a8aeb77e1',
  direction: 'incoming',
  account: 'https://blue.ilpdemo.org/ledger/accounts/connie',
  amount: '1.2345',
  data: { myKey: 'myValue' },
  executionCondition: 'cc:0:3:47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU:0',
  expiresAt: '2016-07-07T12:06:54.974Z' }
2:06:55 PM.94 [ilp-plugin-bells:plugin] <DEBUG> notify transfer rejected https://blue.ilpdemo.org/ledger/transfers/d38be2b8-fdd4-4591-8b61-c35a8aeb77e1
2:06:56 PM.140 [ilp-plugin-bells:plugin] <DEBUG> notify transfer rejected https://red.ilpdemo.org/ledger/transfers/c8a91bdb-3182-441e-9a0f-322a8022b82e
2:07:54 PM.149 [ilp-plugin-bells:plugin] <INFO> ws disconnected from wss://blue.ilpdemo.org/ledger/accounts/bob/transfers

One time it came through, but then it listed connie as the sender (see bob @ https://blue.ilpdemo.org/)

image

diminator commented 8 years ago

Ok, it seems the transfer immediately expires:

{"id":"https://blue.ilpdemo.org/ledger/transfers/8234ff53-a827-4cbf-8ff4-989584953c0c","ledger":"https://blue.ilpdemo.org/ledger","debits":[{"account":"https://blue.ilpdemo.org/ledger/accounts/connie","amount":"1.2345","authorized":true,"memo":{"source_transfer_ledger":"https://red.ilpdemo.org/ledger","source_transfer_id":"175d0984-23f9-4dec-951d-5fccdc137063"}}],"credits":[{"account":"https://blue.ilpdemo.org/ledger/accounts/bob","amount":"1.2345","memo":{"myKey":"myValue"}}],"state":"rejected","rejection_reason":"expired","execution_condition":"cc:0:3:47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU:0","expires_at":"2016-07-07T12:27:49.000Z","timeline":{"proposed_at":"2016-07-07T12:27:49.000Z","prepared_at":"2016-07-07T12:27:49.000Z","rejected_at":"2016-07-07T12:27:49.000Z"}}

increasing the expiresAt, resolves this

emschwartz commented 8 years ago

Note that the reason manual transfers appear to come from the connector is that there is no sourceAddress in ILP. Figuring out the sending account details happens in SPSP at the moment. If you look at the destination transfer's credit memo in a payment sent by the wallet or wallet client you'll see the following information, which is added and used by the wallet:

image

emschwartz commented 8 years ago

@diminator Did you figure out the issue with expiries? Is that something that should change on ilp-core?

diminator commented 8 years ago

If you look at the destination transfer's credit memo in a payment sent by the wallet or wallet client you'll see the following information, which is added and used by the wallet:

Ah, ok. I was only using the node examples from the ilp-core library and went inspecting on the blue and red wallet GUI.

I assume that there are some specific ilpHeader fields that facilitate the interpretation of an ILP package. Is this already fleshed out/documented somewhere?

diminator commented 8 years ago

Did you figure out the issue with expiries? Is that something that should change on ilp-core?

Well, I was on a slow connection and the expiry of 4 seconds was too tight. And then I got a log info that the transfer was refused, without telling me why. That was a bit cryptic. Enlarging the expiry to e.g. 10 seconds and/or adding more details in the error would be useful indeed

emschwartz commented 8 years ago

I assume that there are some specific ilpHeader fields that facilitate the interpretation of an ILP package. Is this already fleshed out/documented somewhere?

No, because they're used by the wallet but they're not part of an "official" protocol on top of ILP (yet)

adding more details in the error would be useful indeed

We have an outstanding TODO to improve the error handling