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

[WIP] [RFC] offer: be able to create an offer with description #729

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=fr.acinq.lightning
version=1.8.5-SNAPSHOT
version=1.8.6-SNAPSHOT
# gradle
org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,18 @@ data class NodeParams(
// If we add a new feature that we would like to use by default, we will need to explicitly create a new offer.
return OfferTypes.Offer.createBlindedOffer(amount = null, description = null, this, trampolineNodeId, Features.empty, sessionKey)
}

/**
* FIXME(vincenzopalazzo): Add docs
*/
fun offer(amount: MilliSatoshi?, description: String?, trampolineNodeId: PublicKey): Pair<OfferTypes.Offer, PrivateKey> {
// We generate a deterministic blindingSecret based on:
// - a custom tag indicating that this is used in the Bolt 12 context
// - our trampoline node, which is used as an introduction node for the offer's blinded path
// - our private key, which ensures that nobody else can generate the same blindingSecret
// FIXME: there is some problem if I change the string prefix? yes I tried and the LSP was rejecting my code
val blindingSecret = PrivateKey(Crypto.sha256("bolt 12 default offer".toByteArray(Charsets.UTF_8).byteVector() + trampolineNodeId.value + nodePrivateKey.value).byteVector32())
// FIXME: it should be included some additional feature
return OfferTypes.Offer.createBlindedOffer(amount = amount, description = description, this, trampolineNodeId, Features.empty, blindingSecret)
}
}
Loading