Closed satindergrewal closed 3 years ago
I wasn't sure what to do with this function, so I copied similar matching existing function from the same file, and just renamed it's function name to confirm if there's anything wrong with my code modifications etc. It compiled fine, and excuted without segfault.
Next I tried adding one by one the variables and functions code lines from the existing code and saw if any of that crashes or give segfault after compile. When it did not, I removed the copied functions code and only left it with the one which was supposed to be there. In all of that I found there was one part of the code which was required, something related to label... now that code is there, the function is there with existing code lines picked which should be there and with return statement of the response taken from it. And the lightningd doesn't segfault on executing it :slight_smile: This looked like I was missing some important changes required to add the new RPC APIs to the list of JSON RPC list, and because of that I was getting segfault.... at least that's what I understand from so far troubleshooting tries
function returning struct will return the entire struct - jl777
yes, I see the consistency of that params label set of code lines in the file.
Params is part of the struct, and as you pointed it takes entire struct, and I was not handling the const jsmntok_t *params
from that struct in my code.
Now that it is there, lightningd
starts fine :)
that params was having options to use required param, or optional params. The example code from other function that I used to test was using p_req
, means a required parameter, and I looked at other options in the params.h
header file for more info, and found there's p_opt
, means optional, so now I made it optional param too.
It is fixed in these 2 git commits: https://github.com/satindergrewal/lightning/commit/83cd24a71346ac9e789d1d260fb9e3acccc8ebd8, https://github.com/satindergrewal/lightning/commit/91ba75331c192a75f7cb848b70061ce0597a1e02
Just starting
lightningd
it dumps the backtrace data and givesSegmentation fault
error:Tried few things to debug, but the code seems to just go crash at these commands: https://github.com/satindergrewal/lightning/blob/tor/lightningd/invoice.c#L1653