Browse Source

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>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
40b14981fd
  1. 2
      bitcoin/locktime.c
  2. 5
      daemon/test/test.sh

2
bitcoin/locktime.c

@ -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

5
daemon/test/test.sh

@ -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

Loading…
Cancel
Save