Skip to content
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

Refactor channel opens and payment sends into separate methods. #126

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

arik-so
Copy link
Contributor

@arik-so arik-so commented Nov 21, 2023

No description provided.

Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -631,38 +640,193 @@ public class HumanObjectPeerTestInstance {
var usableChannelsA = [ChannelDetails]()
var usableChannelsB = [ChannelDetails]()
print("Awaiting usable channels to populate…")
while (usableChannelsA.isEmpty || usableChannelsB.isEmpty) {
while (usableChannelsA.count == initialChannelsA.count || usableChannelsB.count == initialChannelsB.count) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused: why would usableChannelsA not be empty here, we just intitialized it with an empty list, no?


// STEP 1: CREATE INVOICE FROM RECIPIENT
let amtMsat = useZeroValueInvoice ? nil : milliSatoshiAmount
let invoiceResult = Bindings.createInvoiceFromChannelmanager(channelmanager: recipientPeer.channelManager, nodeSigner: recipientPeer.explicitKeysManager.asNodeSigner(), logger: logger, network: .Bitcoin, amtMsat: amtMsat, description: "Invoice description", invoiceExpiryDeltaSecs: 60, minFinalCltvExpiryDelta: 24)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's wrap this line. Generally this probably should be swift-formated?

let routeParameters = RouteParameters(paymentParamsArg: paymentParameters, finalValueMsatArg: amount, maxTotalRoutingFeeMsatArg: nil)
let randomSeedBytes: [UInt8] = [UInt8](repeating: 0, count: 32)
let scoringParams = ProbabilisticScoringDecayParameters.initWithDefault()
// let networkGraph = senderPeer.constructor!.netGraph!
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Commented-out lines can be removed.

do {
// process payment
let peer2Event = try! await recipientPeer.getManagerEvents(expectedCount: 1)[0]
guard case .PaymentClaimable = peer2Event.getValueType() else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any chance we can start DRYing some things up while we're here, e.g., making these 'expect event X' checks a util method or macro?

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.

2 participants