-
Notifications
You must be signed in to change notification settings - Fork 264
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
PaymentRequest are generated in LocalPaymentHandler #63
Conversation
@@ -93,6 +94,8 @@ trait Service extends Logging { | |||
(router ? 'nodes).mapTo[Iterable[NodeAnnouncement]].map(_.map(_.nodeId)) | |||
case JsonRPCBody(_, _, "genh", _) => | |||
(paymentHandler ? 'genh).mapTo[BinaryData] | |||
case JsonRPCBody(_,_, "genPaymentRequest", JInt(amountMsat) :: Nil) => |
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'd prefer receive
instead of genPaymentRequest
def getPaymentRequest(amountMsat: Long, textarea: TextArea) = { | ||
(paymentHandler ? 'genh).mapTo[BinaryData].map { h => | ||
Platform.runLater(new Runnable() { | ||
def getPaymentRequest(amountMsat: MilliSatoshi, textarea: TextArea) = { |
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.
getPaymentRequest
-> receive
would be more consistent with the send
counterpart
case NewPaymentRequest(amount) if amount.amount > 0 && amount.amount < 4294967295L => | ||
val r = generateR | ||
val h: BinaryData = Crypto.sha256(r) | ||
val pr = s"${nodeParams.privateKey.publicKey}:${amount.amount}:${h.toString}" |
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.
Please isolate this in a static method of object LocalPaymentHandler
for better testability.
|
||
object LocalPaymentHandler { | ||
def props(nodeParams: NodeParams) = Props(new LocalPaymentHandler(nodeParams)) | ||
case class NewPaymentRequest(amountMsat: MilliSatoshi) |
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.
For more consistency:
NewPaymentRequest
->ReceivePayment
CreatePayment
->SendPayment
PR Updated with proposed changes. |
* LocalPaymentHandler needs NodeParams when created to access the node pubkey * Added a NewPaymentRequest message in LocalPaymentHandler. Amount is checked and if the amount is not valid a failure is sent * Added a genPaymentRequest service * PaymentRequest in the GUI are now generated by the payment handler
* filling the payment request field in the modal is now handled by the controller
ce521df
to
7cf22d4
Compare
checked and if the amount is not valid a failure is sent