Skip to content

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

Merged
merged 7 commits into from
Sep 14, 2018

Conversation

cdecker
Copy link
Member

@cdecker cdecker commented Sep 6, 2018

This is a replacement of #1842, which passes a reference to the chainparams to the channel 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.

@jb55
Copy link
Collaborator

jb55 commented Sep 6, 2018 via email

Copy link
Contributor

@ZmnSCPxj ZmnSCPxj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1295066

@rustyrussell
Copy link
Contributor

Why don't we use the genesis block hash elsewhere, rather than having the arbitrary id?

@@ -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);
Copy link
Contributor

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?

Copy link
Member Author

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); 👍

@cdecker cdecker force-pushed the chainparams branch 2 times, most recently from 370310b to 9a590d0 Compare September 8, 2018 11:41
@@ -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
Copy link
Contributor

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

Copy link
Contributor

@rustyrussell rustyrussell left a 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?

@cdecker cdecker force-pushed the chainparams branch 2 times, most recently from a88a505 to 65e9fb7 Compare September 9, 2018 21:08
@cdecker
Copy link
Member Author

cdecker commented Sep 12, 2018

Rebased and squashed one fixup that fixed a doc comment.

@cdecker
Copy link
Member Author

cdecker commented Sep 14, 2018

Re-applying @rustyrussell's ACK after rebase

ACK 7365165

@cdecker cdecker merged commit dc88c35 into ElementsProject:master Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants