ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.83k stars 899 forks source link

'pay' plugin is killed and ceases to exist when called with wrong parameters #2612

Closed fiatjaf closed 5 years ago

fiatjaf commented 5 years ago

i don't know if this is the expected behavior. If it is, please close this issue.

I called the pay command with msatoshi = null, got the response { "code" : -32601, "message" : "Unknown command 'pay'" }. Tried again, got the same response.

Checked the logs: lightningd[24617]: 2019-05-01T12:42:52.214Z plugin-pay Killing plugin: Failed to parse JSON response '??{ "jsonrpc": "2.0", "id": 24, "error" : { "code" : -32602, "message" : ""msatoshi" should be a millisatoshi amount, not "null"" } }??'

Then I tried to call it again with correct parameters, but now it was too late, pay was gone.

listconfigs before showed a "plugin": "/home/fiatjaf/lightning/lightningd/../plugins/pay", now it doesn't have that key.

rustyrussell commented 5 years ago

Thanks for the great bug report!

Yep, it's producing bad JSON. The real answer is to have it share the JSON-producing stuff we use in lightningd, which means a bit of a refactor. I've marked this for 0.7.1, so I don't forget.