Commit Graph

11 Commits

Author SHA1 Message Date
Rusty Russell 08e95d59b5 permute_tx: generic pointer map.
Turns out we want to permute transactions for the wallet too, so we
use void ** rather than assume we're shuffling htlc ** (and do inputs,
too!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell 0fe53cc8e7 permute_tx: reintroduce permute map.
We used to have a permutation map; this reintroduces a variant which
uses the htlc pointers directly.

We need this because we have to send the htlc-tx signatures in output
order as part of the protocol: without two-stage HTLCs we only needed
to wire them up in the unilateral spend case so we simply brute-forced
the ordering.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:22 +10:30
Rusty Russell 8522a5ea64 struct bitcoin_tx: remove explicit lengths, use tal_len()/tal_count()
They're always tal objects, so we can simply ask tal for the length,
simplifying the API.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-25 11:03:55 +10:30
Rusty Russell 23f9c7c209 permute_tx: don't save permutation map.
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>
2016-08-18 14:23:46 +09:30
Rusty Russell 7614e513bd commit_tx: keep permutation map.
This lets us map the HTLCs back to outputs when txs occur onchain.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-03 11:27:56 +09:30
Rusty Russell 7bfbee136e permute_tx: fix map logic (again!)
8a4246cb36 (permute: use BIP69 order) removed the invert_map change
from a25ba452f3 (permute_tx: fix horrible thinko.) but it's still
needed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-03 11:27:56 +09:30
Rusty Russell 9ebbe16b1e source cleanup: sort include lines into alpha order
This makes merging easier in future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:38:08 +10:30
Rusty Russell 8a4246cb36 permute: use BIP69 order.
It's a canonical ordering, rather than a random shuffle.  Far simpler.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-20 14:07:44 +09:30
Rusty Russell ef9463f6b1 Sort include lines (ignoring hacky cli test utils).
Put ccan first, openssl next, then standard headers, then locals.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-12 12:41:28 +09:30
Rusty Russell a25ba452f3 permute_tx: fix horrible thinko.
Map needs to be inverted, otherwise non-trivial shuffles get confused.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-08 08:29:53 +09:30
Rusty Russell 63986e5b2d Rename perturb to permute.
Perturb is a bit stretched for this, permute is better.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-30 20:12:14 +09:30