MCPcopy Create free account
hub / github.com/ElementsProject/lightning / sort_outputs

Function sort_outputs

common/psbt_open.c:187–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187static void sort_outputs(struct wally_psbt *psbt)
188{
189 /* Build an output map */
190 struct output_set *set = tal_arr(NULL,
191 struct output_set,
192 psbt->num_outputs);
193 for (size_t i = 0; i < tal_count(set); i++) {
194 set[i].tx_output = psbt->tx->outputs[i];
195 set[i].output = psbt->outputs[i];
196 }
197
198 asort(set, tal_count(set),
199 compare_outputs_at, NULL);
200
201 /* Put PSBT parts into place */
202 for (size_t i = 0; i < tal_count(set); i++) {
203 psbt->outputs[i] = set[i].output;
204 psbt->tx->outputs[i] = set[i].tx_output;
205 }
206
207 tal_free(set);
208}
209
210void psbt_sort_by_serial_id(struct wally_psbt *psbt)
211{

Callers 1

psbt_sort_by_serial_idFunction · 0.85

Calls 1

tal_freeFunction · 0.85

Tested by

no test coverage detected