Commit Graph

21 Commits

Author SHA1 Message Date
Rusty Russell f710ba7c37 scripts/test.sh: boost CSV time to 512 seconds.
As per BIP68, that's the minimum.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:38:08 +10:30
Rusty Russell 57f0c3b38c test-cli/scripts: use setmocktime.
TIL about setmocktime.

Suggested-by: Gavin <gavinandresen@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-10-16 11:59:45 +10:30
Rusty Russell 0b50a7c9eb Fix test scripts for alpha.
Doesn't support getblockheader, also some occasional weirdness
with sequence enforcement for mempool?  Occasionally I could get
my spend tx into the mempool (doesn't happen with bitcoin).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-10-02 10:40:07 +09:30
Rusty Russell 454a3867e5 BIP68 support (nSequence enforcement)
The latest version of the BIP doesn't use inversion, but does use
bitshifts.

It also uncovered a bug in the test scripts: the block timestamps
creep forward when we generate large numbers of blocks (UpdateTime
insists it be > GetMedianTimePast() so it's valid).  We need to take
this into account when waiting for the median to move (reduced it from
60 to 30 seconds, since that adds about 14 seconds).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-30 10:54:11 +09:30
Rusty Russell 845d09ce68 check: simple Makefile target.
This makes it much easier to run all the test scripts.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-29 17:02:02 +09:30
Rusty Russell 5bc22f0368 protocol: increase HTLC precision to 1/1000 satoshi.
This gets truncated for on-chain transactions (thus, rounding may
contribute to fees).

This also means we currently have an upper bound of 0.04 BTC per HTLC;
this can be increased later if required.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-24 15:00:47 +09:30
Rusty Russell 3311580c62 scripts/test.sh: fix bitcoin case.
Now we use locktime, bitcoin needs delay too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-08-08 15:02:50 +09:30
Rusty Russell 3b214479ae test-cli/scripts/test.sh: basic HTLC spending test.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-08-07 16:20:52 +09:30
Rusty Russell bafc93886f test-cli/scripts/test.sh: basic HTLC creation test.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-08-07 14:15:05 +09:30
Rusty Russell de051f0df9 protocol: add close fee logic.
The closer proposes the fee.  This is simple, at least.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-29 16:17:08 +09:30
Rusty Russell 3260fb2ed1 protocol: add commitment fee logic.
Both sides elect a commitment fee, and the lowest is chosen.  That means
you can't game the other side (but if you offer too low, then can error
out of course).

Fees are split 50-50 if possible: originally the whole fee has to be
paid by the (single) funder.  Neither side can withdraw funds which
would make them unable to pay fees.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-29 16:16:24 +09:30
Rusty Russell eac3af06f1 protocol: switch to single-funder anchor model.
Most complex change was gather_updates(), which handles all the "what
is the current state of the channel" logic for our dumb test utils.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-29 16:14:28 +09:30
Rusty Russell 114161a6a5 test-cli/scripts/test.sh: send_after_delay()
Extract and generalize: we're about to get more.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-24 16:00:10 +09:30
Rusty Russell a663dc322c Remove signature leaking.
Alpha has segregated witnesses, so txid doesn't include the inputs.
That means we can create the first commit transaction before we sign
the anchor tx.

Bitcoin will need to do this differently: presumbly via new sipops
(a OP_CHECKSIG2VERIFY I imagine).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-03 14:00:54 +09:30
Rusty Russell c660629760 test.sh: (alpha) make sure that spending tx fails too soon, succeeds after delay.
This only makes sense when we have CSV support.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-03 10:47:29 +09:30
Rusty Russell 20bb6c65aa protocol fix: use locktime from *other* side.
Which emerged clearly when setting one side's locktime differently than
the other.

Each side specifies the (minimum) time they need to notice a fraud attempt:
this constrains the *other* side.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-03 10:44:49 +09:30
Rusty Russell 90e4160862 test.sh: handle appended amounts in transactions.
cut -d: -f1 gets just the transactions, or passed through if no ":".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-01 16:55:11 +09:30
Rusty Russell 9851436d4d test.sh: restore --steal and --unilateral options
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-01 16:27:52 +09:30
Rusty Russell 783aa35aa6 Make test.sh inputs script arguments.
Hardcoding my defaults isn't useful.  Even for me.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-30 12:54:48 +09:30
Rusty Russell f38382fd3c test.sh: handle variances in bitcoin-cli formatting.
In particular, there may or may not be a space between "pubkey" and :.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-30 12:34:35 +09:30
Rusty Russell 8f4426e09b scripts: move to scripts/ subdir, prepare for alpha.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-06-30 12:08:18 +09:30