update-channel-accept: accept the channel update.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2015-06-09 05:59:06 +09:30
parent d51f6372aa
commit 3957f1e1c1
9 changed files with 157 additions and 7 deletions

View File

@@ -9,6 +9,7 @@
struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
OpenChannel *ours,
OpenChannel *theirs,
const struct sha256 *rhash,
int64_t delta,
const struct sha256_double *anchor_txid,
unsigned int anchor_output)
@@ -16,7 +17,6 @@ struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
struct bitcoin_tx *tx;
const u8 *redeemscript;
struct pubkey ourkey, theirkey, to_me;
struct sha256 redeem;
/* Now create commitment tx: one input, two outputs. */
tx = bitcoin_tx(ctx, 1, 2);
@@ -30,13 +30,12 @@ struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
return tal_free(tx);
if (!proto_to_pubkey(theirs->final, &theirkey))
return tal_free(tx);
proto_to_sha256(ours->revocation_hash, &redeem);
/* First output is a P2SH to a complex redeem script (usu. for me) */
redeemscript = bitcoin_redeem_revocable(tx, &ourkey,
ours->locktime_seconds,
&theirkey,
&redeem);
rhash);
tx->output[0].script = scriptpubkey_p2sh(tx, redeemscript);
tx->output[0].script_length = tal_count(tx->output[0].script);