Browse Source

lightning.proto: Rename 'to_me' to 'final', use for commit_tx.

This is where the commit tx outputs should pay to.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 10 years ago
parent
commit
4dd6b8e385
  1. 7
      commit_tx.c
  2. 6
      lightning.pb-c.c
  3. 2
      lightning.pb-c.h
  4. 2
      lightning.proto
  5. 2
      pkt.c

7
commit_tx.c

@ -24,9 +24,10 @@ struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
tx->input[0].txid = *anchor_txid;
tx->input[0].index = anchor_output;
if (!proto_to_pubkey(ours->anchor->pubkey, &ourkey))
/* Output goes to our final pubkeys */
if (!proto_to_pubkey(ours->final, &ourkey))
return tal_free(tx);
if (!proto_to_pubkey(theirs->anchor->pubkey, &theirkey))
if (!proto_to_pubkey(theirs->final, &theirkey))
return tal_free(tx);
proto_to_sha256(ours->revocation_hash, &redeem);
@ -43,7 +44,7 @@ struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
tx->output[0].amount = ours->anchor->total - ours->commitment_fee;
/* Second output is a P2SH payment to them. */
if (!proto_to_pubkey(theirs->to_me, &to_me))
if (!proto_to_pubkey(theirs->final, &to_me))
return tal_free(tx);
tx->output[1].script = scriptpubkey_p2sh(ctx,
bitcoin_redeem_single(ctx,

6
lightning.pb-c.c

@ -1513,12 +1513,12 @@ static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"to_me",
"final",
5,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(OpenChannel, to_me),
offsetof(OpenChannel, final),
&bitcoin_pubkey__descriptor,
NULL,
0, /* flags */
@ -1564,10 +1564,10 @@ static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
static const unsigned open_channel__field_indices_by_name[] = {
5, /* field[5] = anchor */
4, /* field[4] = commitment_fee */
3, /* field[3] = final */
1, /* field[1] = locktime_seconds */
2, /* field[2] = revocation_hash */
0, /* field[0] = seed */
3, /* field[3] = to_me */
6, /* field[6] = tx_version */
};
static const ProtobufCIntRange open_channel__number_ranges[2 + 1] =

2
lightning.pb-c.h

@ -194,7 +194,7 @@ struct _OpenChannel
/*
* How to pay money to us from commit_tx.
*/
BitcoinPubkey *to_me;
BitcoinPubkey *final;
/*
* How much transaction fee we'll pay for commitment txs.
*/

2
lightning.proto

@ -77,7 +77,7 @@ message open_channel {
// Hash seed for revoking commitment transactions.
required sha256_hash revocation_hash = 4;
// How to pay money to us from commit_tx.
required bitcoin_pubkey to_me = 5;
required bitcoin_pubkey final = 5;
// How much transaction fee we'll pay for commitment txs.
required uint64 commitment_fee = 6;
// The anchor transaction details.

2
pkt.c

@ -64,7 +64,7 @@ struct pkt *openchannel_pkt(const tal_t *ctx,
o.seed = seed;
o.revocation_hash = sha256_to_proto(ctx, revocation_hash);
o.to_me = pubkey_to_proto(ctx, to_me);
o.final = pubkey_to_proto(ctx, to_me);
o.commitment_fee = commitment_fee;
o.anchor = anchor;
o.locktime_seconds = rel_locktime_seconds;

Loading…
Cancel
Save