Skip to content

Commit

Permalink
add contructor overload to PaymentRequest
Browse files Browse the repository at this point in the history
* for convenience.
* If an user does not use separate device for signing.
  They will probably just want to pass a `Key` instead
  of learning about `IMessageSigner`
  • Loading branch information
joemphilips committed May 27, 2020
1 parent 6398f8a commit 23e9fa2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/DotNetLightning.Core/Payment/PaymentRequest.fs
Expand Up @@ -661,6 +661,11 @@ type PaymentRequest = private {
Signature = (sigCompact, recv) |> Some
}
}
static member TryCreate(prefix: string, amount: LNMoney option, timestamp, nodeId, tags: TaggedFields, nodeSecret: Key) =
let msgSigner = { new IMessageSigner
with
member this.SignMessage(data) = nodeSecret.SignCompact(data, false) }
PaymentRequest.TryCreate(prefix, amount, timestamp, nodeId, tags, msgSigner)

/// signer must sign by node_secret which corresponds to node_id
static member TryCreate (prefix: string, amount: LNMoney option, timestamp, nodeId, tags: TaggedFields, signer: IMessageSigner) =
Expand Down

0 comments on commit 23e9fa2

Please sign in to comment.