Fix thinko: open-commit-sig needs to sign *their* commit tx.

And check-commit-sig needs to check it against ours.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2015-06-03 13:58:23 +09:30
parent fe4972fda1
commit cf333e45e1
2 changed files with 30 additions and 20 deletions

View File

@@ -63,8 +63,8 @@ int main(int argc, char *argv[])
/* Get the transaction ID of the anchor. */
anchor_txid(anchor, argv[4], argv[5], inmap, &txid);
/* Now create commitment tx to spend 2/2 output of anchor. */
commit = create_commit_tx(ctx, o1, o2, &txid, outmap[0]);
/* Now create THEIR commitment tx to spend 2/2 output of anchor. */
commit = create_commit_tx(ctx, o2, o1, &txid, outmap[0]);
/* If contributions don't exceed fees, this fails. */
if (!commit)
@@ -74,6 +74,7 @@ int main(int argc, char *argv[])
(long long)o1->commitment_fee,
(long long)o2->commitment_fee);
/* Sign it for them. */
sig = sign_tx_input(ctx, commit, 0, anchor->output[outmap[0]].script,
anchor->output[outmap[0]].script_length, privkey);