Skip to content
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
35 changes: 33 additions & 2 deletions apps/backend/routes/v1/lnd/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const DEFAULT_CONFIG = require("utils/defaultConfig");

router.get('/lnd-config', safeHandler(async(req, res) => {
const settings = await diskService.readJsonFile(constants.JSON_SETTINGS_FILE);
return res.json(settings.lnd);
const mergedConfig = mergeWithDefaults(settings.lnd, DEFAULT_CONFIG);
return res.json(mergedConfig);
}));

// POSTing an empty object {} for lndConfig triggers a reset to DEFAULT_CONFIG
Expand Down Expand Up @@ -267,6 +268,18 @@ function validateSettings(settings) {
errors.push(booleanError("Larger Channels"));
}

// protocol.custom-message (custom message handling number)
const customMessageError = validateNullableNumber(settings["protocol.custom-message"], 0, 65535, "Custom Message");
if (customMessageError) errors.push(customMessageError);

// protocol.custom-init (custom feature bit to advertise in the init message)
const customInitError = validateNullableNumber(settings["protocol.custom-init"], 0, 256, "Custom Init");
if (customInitError) errors.push(customInitError);

// protocol.custom-nodeann (custom feature bit to advertise in the node_announcement message)
const customNodeAnnouncementError = validateNullableNumber(settings["protocol.custom-nodeann"], 0, 256, "Custom Node Announcement");
if (customNodeAnnouncementError) errors.push(customNodeAnnouncementError);

// BOLT

// db.bolt.auto-compact (automatic database compaction)
Expand Down Expand Up @@ -303,4 +316,22 @@ function numberError(settingName, min, max) {
return `${settingName} must be ${max ? `between ${min} and ${max}` : `at least ${min}`}.`;
}

module.exports = router;
function validateNullableNumber(value, min, max, settingName) {
if (value === null) return null;
if (typeof value !== "number" || value < min || value > max) {
return numberError(settingName, min, max);
}
return null;
}

function mergeWithDefaults(currentConfig, defaultConfig) {
const merged = { ...defaultConfig, ...currentConfig };
Object.keys(defaultConfig).forEach(key => {
if (defaultConfig[key] === null && !(key in currentConfig)) {
merged[key] = null;
}
});
return merged;
}

module.exports = router;
8 changes: 6 additions & 2 deletions apps/backend/utils/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,9 @@ module.exports = {
// Lightning Terminal (litd) now requires this flag to be set or it will not start up
'rpcmiddleware.enable': true,
// routing
'routing.strictgraphpruning': false
}
'routing.strictgraphpruning': false,
// protocol
'protocol.custom-message': null,
'protocol.custom-init': null,
'protocol.custom-nodeann': null
}
6 changes: 5 additions & 1 deletion apps/backend/utils/lnd-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const generate = (configObject) => {
let lndConfigString = `# This file is automatically generated by Umbrel, any changes will be overwritten.\n# Generated at: ${new Date().toISOString()}`;

for (const [key, value] of Object.entries(configObject)) {
if (value == null) continue;

// handles LND 0.16.0-beta breaking change for routerrpc apriori config options
const formattedKey = KEY_TRANSLATIONS[key] || key;
Expand Down Expand Up @@ -86,7 +87,10 @@ const MULTILINE_KEYS = [
'bitcoin.dnsseed',
'watchtower.listen',
'rpcmiddleware.addmandatory',
'gossip.pinned-syncers'
'gossip.pinned-syncers',
'protocol.custom-message',
'protocol.custom-init',
'protocol.custom-nodeann'
];

const KEY_TRANSLATIONS = {
Expand Down
3 changes: 3 additions & 0 deletions apps/backend/utils/lndConfMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ module.exports = {
cachesChannelCacheSize: 'caches.channel-cache-size',
// protocol
protocolWumboChannels: 'protocol.wumbo-channels',
protocolCustomMessage: 'protocol.custom-message',
protocolCustomInit: 'protocol.custom-init',
protocolCustomNodeann: 'protocol.custom-nodeann',
// bolt
dbBoltAutoCompact: 'db.bolt.auto-compact',
dbBoltAutoCompactMinAge: 'db.bolt.auto-compact-min-age',
Expand Down
128 changes: 128 additions & 0 deletions apps/frontend/src/views/Home/AdvancedSettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,120 @@
</b-collapse>
</b-card>

<!-- PROTOCOL SETTINGS -->
<b-card no-body class="setting-group-container mb-2">
<b-card-header v-b-toggle.protocol-settings header-tag="header" class="setting-group-header px-2 px-sm-3 d-flex justify-content-between align-items-center" role="tab">
<div :class="{'fade-in-out': !hasLoadedSettings}">
<p class="setting-group-title mb-1 font-weight-bold">Protocol</p>
<small class="d-block text-muted">
Set custom protocol messages to be handled by other applications (e.g. LNDK).
</small>
</div>
<b-icon class="when-closed ml-2 text-muted" icon="plus" variant="secondary"></b-icon><b-icon class="when-open ml-2 text-muted" icon="dash" variant="secondary"></b-icon>
</b-card-header>
<b-collapse v-if="hasLoadedSettings" class="setting-group-body bg-light" id="protocol-settings" accordion="protocol-settings" role="tabpanel">

<!-- CUSTOM MESSAGE -->
<b-card-body class="subsetting-body px-2 px-sm-3">
<div>
<div class="d-flex justify-content-between align-items-center">
<div class="flex-sm-grow-1">
<label class="mb-0" for="base-fee">
<p class="subsetting-title font-weight-bold mb-0 mr-1">
Custom message
<span class="subsetting-setting-lnd-name text-monospace font-weight-normal d-block">
protocol.custom-message
</span>
</p>
</label>
</div>
<div class="input-container ml-1">
<b-input-group append="">
<b-form-input
class="advanced-settings-input"
id="custom-message"
type="number"
v-model="settings['protocol.custom-message']"
number
></b-form-input>
</b-input-group>
</div>
</div>
<small class="w-lg-75 d-block text-muted mt-1">
Set to handle message of a particular type that fails outside of the custom message number range.
i.e. 513 is onion messages.
</small>
</div>
</b-card-body>

<!-- CUSTOM INIT FEATURE BIT -->
<b-card-body class="subsetting-body px-2 px-sm-3">
<div>
<div class="d-flex justify-content-between align-items-center">
<div class="flex-sm-grow-1">
<label class="mb-0" for="base-fee">
<p class="subsetting-title font-weight-bold mb-0 mr-1">
Custom Init Feature Bit
<span class="subsetting-setting-lnd-name text-monospace font-weight-normal d-block">
protocol.custom-init
</span>
</p>
</label>
</div>
<div class="input-container ml-1">
<b-input-group append="">
<b-form-input
class="advanced-settings-input"
id="custom-init"
type="number"
v-model="settings['protocol.custom-init']"
number
></b-form-input>
</b-input-group>
</div>
</div>
<small class="w-lg-75 d-block text-muted mt-1">
Specifies feature bits to advertise in the node's init message.
i.e. 39 is support of onion messages.
</small>
</div>
</b-card-body>

<!-- CUSTOM NODE ANNOUNCEMENT FEATURE BIT -->
<b-card-body class="subsetting-body px-2 px-sm-3">
<div>
<div class="d-flex justify-content-between align-items-center">
<div class="flex-sm-grow-1">
<label class="mb-0" for="base-fee">
<p class="subsetting-title font-weight-bold mb-0 mr-1">
Custom Node Announcement Feature Bit
<span class="subsetting-setting-lnd-name text-monospace font-weight-normal d-block">
protocol.custom-nodeann
</span>
</p>
</label>
</div>
<div class="input-container ml-1">
<b-input-group append="">
<b-form-input
class="advanced-settings-input"
id="custom-nodeann"
type="number"
v-model="settings['protocol.custom-nodeann']"
number
></b-form-input>
</b-input-group>
</div>
</div>
<small class="w-lg-75 d-block text-muted mt-1">
Specifies feature bits to advertise in the node's announcement message.
i.e. 39 is support of onion messages.
</small>
</div>
</b-card-body>
</b-collapse>
</b-card>

<!-- WATCHTOWER SETTINGS -->
<b-card no-body class="setting-group-container mb-2">
<b-card-header v-b-toggle.watchtower-settings header-tag="header" class="setting-group-header px-2 px-sm-3 d-flex justify-content-between align-items-center" role="tab">
Expand Down Expand Up @@ -1606,6 +1720,20 @@ export default {
isTorStreamIsolationDisabled(value) {
if (!value) return;
this.settings['tor.streamisolation'] = false;
},
settings: {
handler(newSettings) {
if (newSettings['protocol.custom-message'] === '' || newSettings['protocol.custom-message'] === 0) {
this.settings['protocol.custom-message'] = null;
}
if (newSettings['protocol.custom-init'] === '' || newSettings['protocol.custom-init'] === 0) {
this.settings['protocol.custom-init'] = null;
}
if (newSettings['protocol.custom-nodeann'] === '' || newSettings['protocol.custom-nodeann'] === 0) {
this.settings['protocol.custom-nodeann'] = null;
}
},
deep: true
}
},
async created() {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
- "3006:3006"

lnd:
image: lightninglabs/lnd:v0.16.2-beta@sha256:795d29d94f845bd070832b097ff75cf0f46cf6daf5e55bf62dc1e4e406e0027d
image: lightninglabs/lnd:v0.19.2-beta@sha256:dd113dff920c309bf5c4af6a37d912f379dc24c51f266a2c878c12d20501798b
user: 1000:1000
hostname: lnd
command: --listen=0.0.0.0:9735 --rpclisten=0.0.0.0:10009 --restlisten=0.0.0.0:8080 --bitcoin.active --bitcoin.regtest --bitcoin.node=bitcoind --bitcoind.rpchost=bitcoind --bitcoind.rpcuser=umbrel --bitcoind.rpcpass=moneyprintergobrrr --bitcoind.zmqpubrawblock=tcp://bitcoind:28332 --bitcoind.zmqpubrawtx=tcp://bitcoind:28333 --configfile=/data/.lnd/umbrel-lnd.conf
Expand Down