Skip to content

Commit acc37cf

Browse files
committed
f readme - add note on future gotchas
1 parent 863c2c6 commit acc37cf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lightning-c-bindings/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ C++, all functions return the C type. Thus, you must bind returned values to the
123123
(replacing LDKX with LDK::X) to ensure the destructor is properly run. A demonstration of such usage
124124
is available at [demo.cpp](demo.cpp).
125125

126+
Gotchas
127+
=======
128+
129+
There are a few gotchas around future changes to Rust-Lightning which the bindings may not support.
130+
These include:
131+
* Any trait method which returns a reference to a struct or inner variable cannot be called in
132+
parallel. This is due to the fact that such functions are mapped into a function which is called
133+
to get the return value, but then the return value is stored locally in the trait and a
134+
reference to that copy is returned. Such functions have comments describing the potential race
135+
conditions.
136+
126137
**It is highly recommended that you test any code which relies on the C (or C++) bindings in
127138
valgrind, MemorySanitizer, or other similar tools to ensure correctness.**
128-

0 commit comments

Comments
 (0)