-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Refactor channel opens and payment sends into separate methods. #126
Conversation
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.
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) { |
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.
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) |
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.
Let's wrap this line. Generally this probably should be swift-format
ed?
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! |
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: Commented-out lines can be removed.
do { | ||
// process payment | ||
let peer2Event = try! await recipientPeer.getManagerEvents(expectedCount: 1)[0] | ||
guard case .PaymentClaimable = peer2Event.getValueType() else { |
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.
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?
No description provided.