You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
transaction: avoid quadratic scaling when growing arrays
wally_tx_witness_stack_set(), wally_tx_add_input_at(), and
wally_tx_add_output_at() all exhibited quadratic scaling behavior when
iteratively appending elements to their respective arrays because they
were calling array_realloc() to expand their arrays by one element at a
time.
Change them to use array_grow(), and change the contract of array_grow()
so that it accepts a minimum element count and ensures that the array is
at least large enough to accommodate that many elements, enlarging it to
the next greater power of two if necessary.
See: ElementsProject/lightning#8924
Signed-off-by: Matt Whitlock <c-lightning@mattwhitlock.name>
0 commit comments