diff --git a/doc/HACKING.md b/doc/HACKING.md index 28ab6ce6f..d4e24c173 100644 --- a/doc/HACKING.md +++ b/doc/HACKING.md @@ -155,7 +155,7 @@ valgrind installed, and build with DEVELOPER=1 (currently the default). header order, and checks formatted quotes from BOLTs if BOLTDIR exists (currently disabled, since BOLTs are being re-edited). -* unit tests - run by `make check`, these are run-*.c files in test/ +* unit tests - run by `make check`, these are `run-*.c` files in test/ subdirectories which can test routines inside C source files. You should insert `/* AUTOGENERATED MOCKS START */` and `/* AUTOGENERATED MOCKS END */` lines, and `make update-mocks` will automatically generate stub functions @@ -169,6 +169,25 @@ valgrind installed, and build with DEVELOPER=1 (currently the default). Our Travis CI instance (see `.travis.yml`) runs all these for each pull request. +Subtleties +---------- + +There are a few subtleties you should be aware of as you modify deeper parts +of the code: + +* `structeq` will not work on some structures. + For example, it will not work with `struct short_channel_id` --- use + `short_channel_id_eq` for comparing those. +* `command_success`, `command_fail`, and `command_fail_detailed` will free the + `cmd` you pass in. + This also means that if you `tal`-allocated anything from the `cmd`, they + will also get freed at those points and will no longer be accessible + afterwards. +* When making a structure part of a list, you will instance a + `struct list_node`. + This has to be the *first* field of the structure, or else `dev-memleak` + command will think your structure has leaked. + Further Information -------------------