daemon: fix BIP68 support.

We got the -> second translation wrong by a factor of 512, and also we
need to move the median time in our tests otherwise bitcoind won't let
us spend the tx.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-04-11 16:34:29 +09:30
parent e44a7dc2d5
commit 40b14981fd
2 changed files with 5 additions and 2 deletions

View file

@ -66,7 +66,7 @@ u32 rel_locktime_to_seconds(const struct rel_locktime *rel)
{
assert(rel_locktime_is_seconds(rel));
#if HAS_BIP68
return rel->locktime & BIP68_LOCKTIME_MASK;
return (rel->locktime & BIP68_LOCKTIME_MASK) << BIP68_SECONDS_SHIFT;
#else
return rel->locktime - SECONDS_POINT;
#endif

View file

@ -224,8 +224,11 @@ if [ -n "$TIMEOUT_ANCHOR" ]; then
TIME=$(($TIME + 24 * 60 * 60))
lcli1 dev-mocktime $TIME
# Move bitcoind median time as well, so CSV moves.
$CLI setmocktime $TIME
$CLI generate 6
# Due to laziness, we trigger by block generation.
$CLI generate 1
TIME=$(($TIME + 1))
lcli1 dev-mocktime $TIME
sleep 2