-
Notifications
You must be signed in to change notification settings - Fork 942
Make chainparams available in channeld #1913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
utACK cca47fd
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 1295066
Why don't we use the genesis block hash elsewhere, rather than having the arbitrary id? |
common/initial_channel.c
Outdated
@@ -58,6 +60,8 @@ struct channel *new_initial_channel(const tal_t *ctx, | |||
channel->commitment_number_obscurer | |||
= commit_number_obscurer(&channel->basepoints[funder].payment, | |||
&channel->basepoints[!funder].payment); | |||
channel->chainparams = chainparams_by_chainhash(chain_hash); | |||
assert(channel->chainparams != NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per Bolt #2 the receiver must reject the channel if the chain hash is unknown. Do we really just want to assert here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent point, I'm making this an if (!channel->chainparams) return tal_free(channel);
👍
370310b
to
9a590d0
Compare
channeld/full_channel.h
Outdated
@@ -81,6 +82,7 @@ u32 actual_feerate(const struct channel *channel, | |||
/** | |||
* channel_add_htlc: append an HTLC to channel if it can afford it | |||
* @channel: The channel | |||
* @chain_hash: genesis hash of the target blockchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment can be removed, leftover from #1842
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack eacfe4e
But we should wait until after rcs complete?
a88a505
to
65e9fb7
Compare
We no longer use it to reference chainparams, so we can remove it completely.
65e9fb7
to
7365165
Compare
Rebased and squashed one fixup that fixed a doc comment. |
Re-applying @rustyrussell's ACK after rebase ACK 7365165 |
This is a replacement of #1842, which passes a reference to the
chainparams
to thechannel
so that we can check various constraints during runtime, instead of having global constants and magic values in the code.The fact that these become configurable is really just a side-effect.