Commit Graph

7 Commits

Author SHA1 Message Date
Rusty Russell f24b73124a Remove txid normalization.
Since any transaction with all segregated-witness inputs is non-malleable,
and all our transactions are that, we can remove normalized txids.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 20:01:52 +09:30
Rusty Russell 8bd334380e peer: use tip mediantime for CSV timeout.
Using wallclock is gauche (and I saw it fail once in tests), so fix that
FIXME now it's easy.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:52:35 +09:30
Rusty Russell b5a6ac26c7 watch: don't hand blockhash, have commit_tx_depth() use get_last_mediantime()
There isn't a single blockhash; we may be on multiple forks.  But the one
caller which cares is commit_tx_depth(), which wants to know if the tx is
spendable yet.  So that uses get_last_mediantime().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:50:35 +09:30
Rusty Russell 7b4de8e445 watch: use chaintopology
Rather than polling for interesting bitcoin txs via importaddress, we use
the chain topology to register our interest directly.x 

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:48:35 +09:30
Rusty Russell 6e39b0a642 chaintopology: get_last_mediantime()
This gets the median time of the block the tx is in.  If there is more
than one (different tips), it gets the last median time.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:46:32 +09:30
Rusty Russell e09795d24e chaintopology: get full tx information for each block.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:42:18 +09:30
Rusty Russell 521d3d53ed chaintopology: keep track of the bitcoin block topology.
This allows us to track precise transaction depth ourselves,
particularly in the case of branching.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:37:13 +09:30