-
Notifications
You must be signed in to change notification settings - Fork 950
Channel: Fix channel state max and add regression test #8420
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
base: master
Are you sure you want to change the base?
Conversation
We could add a sentinel as the explicit last state so we wouldn't have to update the CHANNEL_STATE_MAX expr every time ...
|
Nit: I tested this.
Once all of those compiler errors are resolved the test |
common/test/run-channel_type.c
Outdated
bool known_state; | ||
switch(state) { | ||
case DUALOPEND_OPEN_INIT: | ||
case CHANNELD_AWAITING_LOCKIN: | ||
case CHANNELD_NORMAL: | ||
case CHANNELD_SHUTTING_DOWN: | ||
case CLOSINGD_SIGEXCHANGE: | ||
case CLOSINGD_COMPLETE: | ||
case AWAITING_UNILATERAL: | ||
case FUNDING_SPEND_SEEN: | ||
case ONCHAIN: | ||
case CLOSED: | ||
case DUALOPEND_OPEN_COMMITTED: | ||
case DUALOPEND_AWAITING_LOCKIN: | ||
case CHANNELD_AWAITING_SPLICE: | ||
case DUALOPEND_OPEN_COMMIT_READY: | ||
largest_state = state; | ||
known_state = true; | ||
break; | ||
default: | ||
known_state = false; | ||
break; |
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.
bool known_state; | |
switch(state) { | |
case DUALOPEND_OPEN_INIT: | |
case CHANNELD_AWAITING_LOCKIN: | |
case CHANNELD_NORMAL: | |
case CHANNELD_SHUTTING_DOWN: | |
case CLOSINGD_SIGEXCHANGE: | |
case CLOSINGD_COMPLETE: | |
case AWAITING_UNILATERAL: | |
case FUNDING_SPEND_SEEN: | |
case ONCHAIN: | |
case CLOSED: | |
case DUALOPEND_OPEN_COMMITTED: | |
case DUALOPEND_AWAITING_LOCKIN: | |
case CHANNELD_AWAITING_SPLICE: | |
case DUALOPEND_OPEN_COMMIT_READY: | |
largest_state = state; | |
known_state = true; | |
break; | |
default: | |
known_state = false; | |
break; | |
bool known_state = false; | |
switch(state) { | |
case DUALOPEND_OPEN_INIT: | |
case CHANNELD_AWAITING_LOCKIN: | |
case CHANNELD_NORMAL: | |
case CHANNELD_SHUTTING_DOWN: | |
case CLOSINGD_SIGEXCHANGE: | |
case CLOSINGD_COMPLETE: | |
case AWAITING_UNILATERAL: | |
case FUNDING_SPEND_SEEN: | |
case ONCHAIN: | |
case CLOSED: | |
case DUALOPEND_OPEN_COMMITTED: | |
case DUALOPEND_AWAITING_LOCKIN: | |
case CHANNELD_AWAITING_SPLICE: | |
case DUALOPEND_OPEN_COMMIT_READY: | |
largest_state = state; | |
known_state = true; | |
break; |
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.
Ah yes you are absolutely correct! Nice find.
190411f
to
9380369
Compare
Adds a test so CI will fail if CHANNEL_STATE_MAX isn’t updated when new channel states are added. Changelog-None
9380369
to
9fd9371
Compare
Twice now that I've been aware of the channel state max wasn't updated and it slipped through without being noticed.
This PR adds an explicit test so CI will fail if the max value isn't updated.