Commit Graph

28 Commits

Author SHA1 Message Date
practicalswift 0ac5e93065 Remove unused parameters a_sent and b_sent in draw_restart(.., struct sent **a_sent, struct sent **b_sent, ...) 2018-02-22 10:46:30 +01:00
practicalswift 2e7791f798 Remove unused parameter ci in db_send_local_revoke(..., const struct commit_info *ci) 2018-02-22 10:46:30 +01:00
practicalswift 31fed45d10 Remove unused parameters peer and sig in db_send_remote_commit(struct peer *peer, ..., struct signature sig) 2018-02-22 10:46:30 +01:00
practicalswift 91a9c2923f Mark intentionally unused parameters as such (with "UNUSED") 2018-02-22 01:09:12 +00:00
practicalswift 4f4756bd20 Fix a-vs-an typos 2018-02-08 22:49:34 +01:00
practicalswift e8c94c2e29 Check return value of read_all(...) call
All other users of read_all(...) check the return value:

```
hsmd/hsm.c:    if (!read_all(fd, &secretstuff.hsm_secret, sizeof(secretstuff.hsm_secret)))
test/test_protocol.c:    if (!read_all(fd, p, len))
wire/wire_sync.c:    if (!read_all(fd, &len, sizeof(len)))
wire/wire_sync.c:    if (!read_all(fd, msg, wirelen_to_cpu(len)))
```
2018-01-10 04:03:58 +00:00
Rusty Russell 85ff95e829 common: new directory for any shared objects.
To avoid everything pulling in HTLCs stuff to the opening daemon, we
split the channel and commit_tx routines into initial_channel and
initial_commit_tx (no HTLC support) and move full HTLC supporting versions
into channeld.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-29 17:54:14 +02:00
Rusty Russell c2cc164d6d daemon: disable old BOLT checks.
This is useful for the next patch.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:09:20 +10:30
Rusty Russell a44e4fb631 daemon/json, test/test_protocol: avoid gcc -O warnings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-15 11:49:51 +10:30
Rusty Russell f5c00deec7 Remove trailing whitespace from source.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-11 09:32:04 +10:30
Rusty Russell a4ee683b3e tal_tmpctx: clear marker for temporary contexts.
This makes them stand out in memory dumps.  Also plug two existing
memory leaks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:34:27 +10:30
Rusty Russell 8a3c9908ce protocol: no signature in update_commit if receiver has no outputs.
So if there are no HTLCs, and the receiver can't spend anyway, don't
sign.  This has the added benefit that no two signed commitment
transactions will ever be identical (the revocation preimage changes).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-18 14:25:13 +09:30
Rusty Russell de7fb4a83f test_protocol: restart support.
We keep a "database" for each side's persistent state.  Upon restart,
each side tells the other where it was up to, in terms of the number
of commit and revocation messages it receives.

Because only one update can be in flight at a time, we can tell w

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-18 14:23:45 +09:30
Rusty Russell 25d9962e81 test_protocol: add --verbose flag.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-18 14:23:45 +09:30
Rusty Russell 3e34d50339 test_protocol: fix --svg
Had bitrotted, and was completely broken with recent changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-18 14:23:45 +09:30
Rusty Russell 73df39e0c9 test_protocol: attach states to each HTLC, rather than using queues.
This is simpler for database representation, and also allows simple
bit-tests for what is happening to a HTLC (eg. am I committed to it?
Are you?  etc.)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-18 14:23:44 +09:30
Rusty Russell d54a59f010 test_protocol: remove support for multiple commits in flight.
Laolu pointed out that we can't have multiple in flight, since we can't
sign without knowing the next revocation preimage.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-18 14:23:44 +09:30
Rusty Russell 836eee048b test_protocol: rename struct funding to struct commit_tx.
This is really what it is.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-18 14:23:44 +09:30
Rusty Russell e46a2ed49a test/test_protocol: rename internally to match updated 02-wire-protocol.md
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 15:06:12 +09:30
Rusty Russell 06d2c19c41 test/test_protocol: make pretty(-ish) SVG diagrams.
Could make them much prettier, but they're functional.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 15:02:08 +09:30
Rusty Russell 126c91e1b1 test/test_protocol: don't allow multiple commits in flight by default.
Add "nocommitwait" for the two cases we test that, otherwise add
assertions that we never end up dealing with anything other than
the previous commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 15:01:10 +09:30
Rusty Russell a77466aa21 test/test_protocol: Keep pointer to previous state.
Since our pre-change state is always the same as the previous step's
post-change state, we can simply keep a pointer, with a dummy empty
state for the initial one.

We could function-wrap it, but this change is even simpler.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 13:58:06 +09:30
Rusty Russell 4c1b50baab test/test_protocol: don't bother keeping acked (outgoing) queue.
We can simply set a boolean to indicate there are changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 13:56:08 +09:30
Rusty Russell bc8cd0dce7 test/test_protocol: don't manually reapply changes.
This finished the previous patch by simply copying funding_next to funding
when we want to apply changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 13:55:58 +09:30
Rusty Russell 52db7ae0c4 test/test_protocol: keep cache of state with all changes applied.
This makes it easier to test for validity, though we still double-check
that a change doesn't overlap previous changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 13:51:25 +09:30
Rusty Russell 388dfc355e test/test_protocol: add fee support.
We simply record how many fee changes there are, rather than supporting
a particular level.

Fees are tricky: it's a noop to apply them when incoming, but we apply them
when they've been acked.  Unlike HTLC modifications, which are symmetric,
fee updates only apply when returning to the originating node.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 13:49:32 +09:30
Rusty Russell 056c219bc1 test/test_protocol: add checksync command to assert nodes are in sync.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 13:48:11 +09:30
Rusty Russell 7f90d183da test/test_protocol: simulator for the updated wire-protocol BOLT.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-17 13:47:44 +09:30