Add target, for SPV paths to other than the genesis.

Result of 20 runs of ./test-trees $((1024 * 1024)) $((1024 * 1024 - 150)):

array: proof hashes 135-897(346.4+/-2.1e+02)
optimal: proof hashes 33-119(62.4+/-24)
maaku: proof hashes 65-223(146.2+/-47)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Proper argument handling, and option to remove maaku tree.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Two new tree modes.

Results for 20 runs of 1M:

array: proof hashes 367-2863(1416.4+/-7.8e+02)
optimal: proof hashes 315-2143(1031.7+/-5.6e+02)
breadth-batch: proof hashes 307-2327(1106.4+/-6.1e+02)
array-batch: proof hashes 282-2248(1050.6+/-6e+02)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Hack in shortest-proof calculation.

Instead of calculating shortest path, then deriving the proof, we should
be directly calculating the shortest proof (which is what we really want!)

This gives the following results for 1M entries over 20 runs:

array: proof hashes 367-2863(1416.4+/-7.8e+02)
optimal: proof hashes 315-2143(1031.7+/-5.6e+02)
breadth-batch: proof hashes 307-2327(1106.4+/-6.1e+02)
array-batch: proof hashes 282-2248(1050.6+/-6e+02)
optimal-prooflen: proof hashes 265-1719(818.2+/-4.4e+02)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Generalize proof length optimization a bit.

Flag ones which actually create a tree (far too slow to run).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
array: calculate depth directly rather than creating tree and measuring.

But still check against existing code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Now array is fast, we can generalize the prooflen methods.

Results for 100 runs of 1M blocks:

array: proof hashes 367-2863(1416.4+/-7.8e+02)
optimal: proof hashes 315-2143(1031.7+/-5.6e+02)
breadth-batch: proof hashes 307-2327(1106.4+/-6.1e+02)
array-batch: proof hashes 282-2248(1050.6+/-6e+02)
prooflen-array: proof hashes 311-2034(1037.65+/-5.6e+02)
prooflen-optimal: proof hashes 265-1719(818.2+/-4.4e+02)
prooflen-breadth-batch: proof hashes 263-1865(877.9+/-4.8e+02)
prooflen-array-batch: proof hashes 238-1782(827.35+/-4.7e+02)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Try single backlink.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>