Skip to content

Commit

Permalink
test_protocol: remove support for multiple commits in flight.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rustyrussell committed Aug 18, 2016
1 parent 836eee0 commit d54a59f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 146 deletions.
20 changes: 0 additions & 20 deletions test/commits/05-two-commits-in-flight.script

This file was deleted.

22 changes: 0 additions & 22 deletions test/commits/05-two-commits-in-flight.script.expected

This file was deleted.

26 changes: 0 additions & 26 deletions test/commits/15-fee-twice-back-to-back.script

This file was deleted.

69 changes: 0 additions & 69 deletions test/commits/15-fee-twice-back-to-back.script.expected

This file was deleted.

11 changes: 2 additions & 9 deletions test/test_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ struct peer {

struct commit_tx initial_commit_tx;

/* Are we allowed to send another commit before receiving revoke? */
bool commitwait;

/* For drawing svg */
char *text;
char *io;
Expand Down Expand Up @@ -431,8 +428,7 @@ static void send_commit(struct peer *peer)
* until it receives the `update_revocation` response to the
* previous `update_commit`, so there is only ever one
* unrevoked local commitment. */
if (peer->commitwait
&& peer->remote->prev && !peer->remote->prev->revoked)
if (peer->remote->prev && !peer->remote->prev->revoked)
errx(1, "commit: must wait for previous commit");

tal_append_fmt(&peer->io, "update_commit");
Expand Down Expand Up @@ -464,7 +460,7 @@ static void receive_revoke(struct peer *peer, u32 number)
number, ci->number);

/* This shouldn't happen if we don't allow multiple commits. */
if (peer->commitwait && ci != peer->remote->prev)
if (ci != peer->remote->prev)
errx(1, "receive_revoke: always revoke previous?");

tal_append_fmt(&peer->io, "<");
Expand Down Expand Up @@ -636,8 +632,6 @@ static void do_cmd(struct peer *peer)
read_peer(peer, "C", cmd);
read_in(peer->infd, &sig, sizeof(sig));
receive_commit(peer, &sig);
} else if (streq(cmd, "nocommitwait")) {
peer->commitwait = false;
} else if (streq(cmd, "checksync")) {
write_all(peer->cmddonefd, peer->local->commit_tx,
sizeof(*peer->local->commit_tx));
Expand Down Expand Up @@ -688,7 +682,6 @@ static void new_peer(int infdpair[2], int outfdpair[2], int cmdfdpair[2],

peer = tal(NULL, struct peer);
memset(&peer->initial_commit_tx, 0, sizeof(peer->initial_commit_tx));
peer->commitwait = true;

/* Create first, signed commit info. */
peer->local = new_commit_info(peer, NULL);
Expand Down

0 comments on commit d54a59f

Please sign in to comment.