shesek / spark-wallet

⚡️ A minimalistic wallet GUI for c-lightning, accessible over the web or through mobile and desktop apps.
MIT License
344 stars 76 forks source link

incompatible with plugins #43

Closed renepickhardt closed 5 years ago

renepickhardt commented 5 years ago

When running a c-lightning plugin and creating new command line arguments I cannot access those arguments in expert mode. While I can enter help to the console and see the new commands I receive command unknown error when executing them. In some cases (I guess depending on the plugin the node.js server even crashes)

shesek commented 5 years ago

It should pass them through to c-lightning as-is. Can you start the Spark server with DEBUG=lightning-client and copy the log you get when trying to execute these commands?

And it definitely shouldn't crash, can you show me the crash log?

renepickhardt commented 5 years ago

first call to Funds did not crash spark waellet as the command was unknown.

HTTP server running on http://localhost:9737
POST /rpc 200 17.754 ms - 454
LightningError: Unknown command 'Funds'
    at LightningError (/usr/local/lib/node_modules/spark-wallet/node_modules/error/typed.js:34:22)
    at LightningClient.once.res (/usr/local/lib/node_modules/spark-wallet/node_modules/lightning-client/index.js:107:28)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at LightningClient.emit (events.js:211:7)
    at Parser.LightningClient.parser.onValue (/usr/local/lib/node_modules/spark-wallet/node_modules/lightning-client/index.js:61:17)
    at Parser.proto.emit (/usr/local/lib/node_modules/spark-wallet/node_modules/jsonparse/jsonparse.js:337:8)
    at Parser.proto.pop (/usr/local/lib/node_modules/spark-wallet/node_modules/jsonparse/jsonparse.js:332:8)
    at Parser.proto.onToken (/usr/local/lib/node_modules/spark-wallet/node_modules/jsonparse/jsonparse.js:402:12)
    at Parser.proto.write (/usr/local/lib/node_modules/spark-wallet/node_modules/jsonparse/jsonparse.js:135:34)

second call to funds crashes spark wallet. I am using this plugin: https://github.com/ElementsProject/lightning/pull/2139

POST /rpc 500 4.186 ms - 117
uncaughtException, stopping process
Error: Unexpected NUMBER(4) in state COMMA
    at Parser.proto.parseError (/usr/local/lib/node_modules/spark-wallet/node_modules/jsonparse/jsonparse.js:321:16)   
    at Parser.proto.onToken (/usr/local/lib/node_modules/spark-wallet/node_modules/jsonparse/jsonparse.js:404:19)
    at Parser.proto.write (/usr/local/lib/node_modules/spark-wallet/node_modules/jsonparse/jsonparse.js:274:20)
    at Socket.LightningClient.client.on.data (/usr/local/lib/node_modules/spark-wallet/node_modules/lightning-client/index.js:56:53)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:607:20)
renepickhardt commented 5 years ago

On the command line the call to funds to the plugin is currently broken (as the code base is changing so rapidly) so the response is more than JSON. but Plugins in general donot require to have stdout to be JSON. So I guess this might be part of the problem?

rpickhardt@Ubuntu-1804-bionic-64-minimal:~$ lightning-cli funds
lightning-cli: Malformed response '{"jsonrpc": "2.0", "error": "Error while processing funds", "id": ""lightning-cli-9289""}

'
shesek commented 5 years ago

This appears to be a bug in c-lightning, a fix was merged in https://github.com/ElementsProject/lightning/pull/2159.