Skip to content

smite-scenarios: use helpers for second funded channel - #286

Merged
morehouse merged 1 commit into
masterfrom
second_channel_helpers
Oct 16, 2026
Merged

morehouse merged 1 commit into
masterfrom
second_channel_helpers

Conversation

@morehouse

Copy link
Copy Markdown
Collaborator

Create helpers for tests that need two different negotiated channels and use them to simplify the relevant tests.

Addresses #260 (comment).

Create helpers for tests that need two different negotiated channels and
use them to simplify the relevant tests.

/// A [`sample_funding_negotiation`] with a different `temporary_channel_id` and
/// funding amount, so that it funds a different channel.
pub fn second_funding_negotiation() -> PendingChannel {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: If we directly port this to run via instructions in the future instead of injecting the negotiation, this will start to fail AcceptChannelOracle, e.g: here open_channel.funding_satoshis > 16777215 or accept_channel reuses the PCP from the first negotiation.

It doesn't really matter much here, since sample_funding_negotiation itself also violates some oracles, so I'm fine with grouping the fix with that in the future if you prefer

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is addressed later in #291 and #294.

let temporary_channel_id =
b.append(Operation::LoadChannelId(second.temporary_channel_id.0), &[]);
b.append(
Operation::SendFundingCreated,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know this is just a refactor of the existing instructions, but this will start to fail once we add an oracle to channel_ready that checks whether funding_signed was sent

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we will need to change this for the new oracle check. I didn't want to change it during the refactor though.

@NishantBansal2003 NishantBansal2003 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@erickcestari erickcestari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@morehouse
morehouse merged commit b88f345 into master Oct 16, 2026
5 checks passed
@morehouse
morehouse deleted the second_channel_helpers branch October 16, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants