@@ -112,12 +112,32 @@ void clean_tmpctx(void);
112112/* Call this before any libwally function which allocates. */
113113void tal_wally_start (void );
114114
115- /* Then call this to reparent everything onto this parent */
115+ /* Then call this to reparent everything onto this parent.
116+ *
117+ * This method should *not* be used for creation of psbt objects,
118+ * tal_wally_end_onto should be used instead!
119+ *
120+ * Typical usage is to end on the PSBT being modified.
121+ */
116122void tal_wally_end (const tal_t * parent );
117123
118124/* ... or this if you want to reparent onto something which is
119125 * allocated by libwally here. Fixes up this from_wally obj to have a
120- * proper tal_name, too! */
126+ * proper tal_name, too!
127+ *
128+ * This results in a tal hierarchy like so:
129+ * parent -> from_wally -> [everything wally allocated]
130+ *
131+ * This is typically used when allocating a new psbt and ensuring all the psbt's
132+ * member objects are children of the PSBT itself.
133+ *
134+ * For example:
135+ * struct wally_psbt *clone;
136+ * tal_wally_start();
137+ * if (wally_psbt_clone_alloc(psbt, 0, &clone) != WALLY_OK)
138+ * abort();
139+ * tal_wally_end_onto(ctx, clone, struct wally_psbt);
140+ */
121141#define tal_wally_end_onto (parent , from_wally , type ) \
122142 tal_wally_end_onto_( \
123143 (parent), (from_wally), \
0 commit comments