Repository navigation
smite-scenarios: use helpers for second funded channel #286
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,10 @@ | |
| //! `raw_program` is an exception and doesn't use [`ProgramBuilder`] since its | ||
| //! purpose is to create malformed program. | ||
|
|
||
| use super::harness::{PointSource, SampleOpenChannel, acceptor_funding_sk, opener_funding_sk}; | ||
| use super::harness::{ | ||
| PointSource, SampleOpenChannel, acceptor_funding_sk, opener_funding_sk, | ||
| second_funding_negotiation, | ||
| }; | ||
| use crate::executor::*; | ||
| use smite_ir::Instruction; | ||
| use smite_ir::builder::ProgramBuilder; | ||
|
|
@@ -317,6 +320,28 @@ pub fn recv_channel_ready_program(confirmations: u8) -> Program { | |
| b.build() | ||
| } | ||
|
|
||
| /// A program that sends `funding_created` for both negotiations of | ||
| /// `two_funding_negotiations_fixture` without awaiting `funding_signed`, mines | ||
| /// to their `minimum_depth`, and receives a `channel_ready` for each. | ||
| pub fn recv_two_channel_ready_program() -> Program { | ||
| let second = second_funding_negotiation().open_channel; | ||
|
|
||
| let mut b = ProgramBuilder::new(); | ||
| send_funding_created(&mut b); | ||
| let tx = create_funding_tx_with(&mut b, second.funding_satoshis, FUNDING_FEERATE_PER_KW); | ||
| let temporary_channel_id = | ||
| b.append(Operation::LoadChannelId(second.temporary_channel_id.0), &[]); | ||
| b.append( | ||
| Operation::SendFundingCreated, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| &[tx.tx, tx.opener_privkey, temporary_channel_id], | ||
| ); | ||
| b.append(Operation::MineBlocks(6), &[]); | ||
| b.append(Operation::RecvChannelReady, &[]); | ||
| b.append(Operation::RecvChannelReady, &[]); | ||
|
|
||
| b.build() | ||
| } | ||
|
|
||
| // -- Gossip -- | ||
|
|
||
| /// Emits a `channel_announcement` carrying the `ShortChannelId` variable | ||
|
|
||
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.
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: hereopen_channel.funding_satoshis> 16777215 oraccept_channelreuses the PCP from the first negotiation.It doesn't really matter much here, since
sample_funding_negotiationitself also violates some oracles, so I'm fine with grouping the fix with that in the future if you preferThere 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 is addressed later in #291 and #294.