Browse Source
We no longer need it anywhere. This simplifies things to the point where we might as well just not include dust outputs as we go, rather than explicitly removing them, which gets rid of remove_dust.c as well. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>ppa-0.6.1
Rusty Russell
8 years ago
10 changed files with 44 additions and 135 deletions
@ -1,28 +0,0 @@ |
|||
#include "remove_dust.h" |
|||
#include <assert.h> |
|||
#include <stdbool.h> |
|||
#include <string.h> |
|||
|
|||
void remove_dust(struct bitcoin_tx *tx, int *map) |
|||
{ |
|||
size_t i, j, num = tx->output_count; |
|||
|
|||
assert(tal_count(map) == num); |
|||
/* Do it in map order so we can remove from map, too */ |
|||
for (i = 0; i < num; i++) { |
|||
assert(map[i] < tx->output_count); |
|||
if (tx->output[map[i]].amount >= DUST_THRESHOLD) |
|||
continue; |
|||
|
|||
/* Eliminate that output from tx */ |
|||
tx->output_count--; |
|||
memmove(tx->output + map[i], tx->output + map[i] + 1, |
|||
(tx->output_count-map[i]) * sizeof(*tx->output)); |
|||
|
|||
/* Fixup map. */ |
|||
for (j = 0; j < num; j++) |
|||
if (map[j] > map[i]) |
|||
map[j]--; |
|||
map[i] = -1; |
|||
} |
|||
} |
Loading…
Reference in new issue