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

feat: update default cltv_expiry from 9 to 18 #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions payreq.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const SIMNETWORK = {
validWitnessVersions: [0, 1]
}
const DEFAULTEXPIRETIME = 3600
const DEFAULTCLTVEXPIRY = 9
const DEFAULTCLTVEXPIRY = 18
const DEFAULTDESCRIPTION = ''
const DEFAULTFEATUREBITS = {
word_length: 4, // last bit set default is 15
Expand Down Expand Up @@ -84,7 +84,7 @@ const TAGCODES = {
payee_node_key: 19,
purpose_commit_hash: 23, // commit to longer descriptions (like a website)
expire_time: 6, // default: 3600 (1 hour)
min_final_cltv_expiry: 24, // default: 9
min_final_cltv_expiry: 24, // default: 18
fallback_address: 9,
routing_info: 3, // for extra routing info (private etc.)
feature_bits: 5
Expand All @@ -105,7 +105,7 @@ const TAGENCODERS = {
payee_node_key: hexToWord, // 264 bits
purpose_commit_hash: purposeCommitEncoder, // 256 bits
expire_time: intBEToWords, // default: 3600 (1 hour)
min_final_cltv_expiry: intBEToWords, // default: 9
min_final_cltv_expiry: intBEToWords, // default: 18
fallback_address: fallbackAddressEncoder,
routing_info: routingInfoEncoder, // for extra routing info (private etc.)
feature_bits: featureBitsEncoder
Expand All @@ -118,7 +118,7 @@ const TAGPARSERS = {
19: (words) => wordsToBuffer(words, true).toString('hex'), // 264 bits
23: (words) => wordsToBuffer(words, true).toString('hex'), // 256 bits
6: wordsToIntBE, // default: 3600 (1 hour)
24: wordsToIntBE, // default: 9
24: wordsToIntBE, // default: 18
9: fallbackAddressParser,
3: routingInfoParser, // for extra routing info (private etc.)
5: featureBitsParser // keep feature bits as array of 5 bit words
Expand Down Expand Up @@ -645,7 +645,7 @@ function encode (inputData, addDefaults) {
}

// if there's no minimum cltv time, and it is not reconstructing (must have private key)
// default to adding a 9 block minimum cltv time (90 minutes for bitcoin)
// default to adding a 18 block minimum cltv time (180 minutes for bitcoin)
if (!tagsContainItem(data.tags, TAGNAMES['24']) && !canReconstruct && addDefaults) {
data.tags.push({
tagName: TAGNAMES['24'],
Expand Down