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

add some policy options in ui #17

Merged
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
19 changes: 19 additions & 0 deletions logic/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const DEFAULT_ADVANCED_SETTINGS = {
maxmempool: 300,
mempoolexpiry: 336,
persistmempool: true,
datacarrier: true,
datacarriersize: 83,
permitbaremultisig: true,
maxorphantx: 100,
reindex: false,
// RPC/REST
Expand Down Expand Up @@ -156,6 +159,22 @@ function settingsToMultilineConfString(settings) {
umbrelBitcoinConfig.push('persistmempool=1');
}

// datacarrier
if (!settings.datacarrier) {
umbrelBitcoinConfig.push("# Relay and mine data carrier transactions.");
umbrelBitcoinConfig.push('datacarrier=0');
}

// datacarriersize
umbrelBitcoinConfig.push("# Maximum size of arbitrary data to relay and mine.");
umbrelBitcoinConfig.push(`datacarriersize=${settings.datacarriersize}`);

// permitbaremultisig
if (!settings.permitbaremultisig) {
umbrelBitcoinConfig.push("# Relay non-P2SH multisig.");
umbrelBitcoinConfig.push('permitbaremultisig=0');
}

// maxorphantx
umbrelBitcoinConfig.push("# Maximum number of orphan transactions to be kept in memory.");
umbrelBitcoinConfig.push(`maxorphantx=${settings.maxorphantx}`);
Expand Down
91 changes: 91 additions & 0 deletions ui/src/components/AdvancedSettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,97 @@
</div>
</b-card-body>

<!-- DATACARRIER -->
<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="mempool">
<p class="subsetting-title font-weight-bold mb-0 mr-1">
Relay transaction with embedded data
<span class="subsetting-config-name text-monospace font-weight-normal d-block">
datacarrier
</span>
</p>
</label>
</div>
<div>
<toggle-switch
id="datacarrier"
class="align-self-center"
:on="settings.datacarrier"
@toggle="status => (settings.datacarrier = status)"
></toggle-switch>
</div>
</div>
<small class="w-lg-75 d-block text-muted mt-1">
Relay and mine data carrier transactions.
</small>
</div>
</b-card-body>

<!-- DATACARRIERSIZE -->
<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="mempoolexpiry">
<p class="subsetting-title font-weight-bold mb-0 mr-1">
Maximum size of relayed transactions with embedded data
<span class="subsetting-config-name text-monospace font-weight-normal d-block">
datacarriersize
</span>
</p>
</label>
</div>
<div class="input-container ml-1">
<b-input-group append="bytes">
<b-form-input
class="advanced-settings-input"
id="datacarriersize"
type="number"
v-model="settings.datacarriersize"
number
></b-form-input>
</b-input-group>
</div>
</div>
<small class="w-lg-75 d-block text-muted mt-1">
Adjust the maximum size of relayed transactions containing arbitrary data.
Note: datacarrier takes precedence over datacarriersize.
</small>
</div>
</b-card-body>

<!-- PERMITBAREMULTISIG -->
<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="mempool">
<p class="subsetting-title font-weight-bold mb-0 mr-1">
Relay old type of multisig transaction
<span class="subsetting-config-name text-monospace font-weight-normal d-block">
permitbaremultisig
</span>
</p>
</label>
</div>
<div>
<toggle-switch
id="permitbaremultisig"
class="align-self-center"
:on="settings.permitbaremultisig"
@toggle="status => (settings.permitbaremultisig = status)"
></toggle-switch>
</div>
</div>
<small class="w-lg-75 d-block text-muted mt-1">
Relay non-P2SH multisig.
</small>
</div>
</b-card-body>

<!-- PRUNE -->
<b-card-body class="subsetting-body px-2 px-sm-3">
<div>
Expand Down
9 changes: 9 additions & 0 deletions utils/validateSettingsRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ function validateSettingsRequest(settings) {
// Persist Mempool
checkBooleanSetting({ setting: settings.persistmempool, settingName: "Persist Mempool" });

// Datacarrier
checkBooleanSetting({ setting: settings.datacarrier, settingName: "datacarrier" });

// Datacarriersize
checkNumberSetting({ setting: settings.datacarriersize, settingName: "datacarriersize", min: 0 });

// Datacarriersize
checkBooleanSetting({ setting: settings.permitbaremultisig, settingName: "permitbaremultisig" });

// Max Orphan Transactions
// No min or max specified.
checkNumberSetting({ setting: settings.maxorphantx, settingName: "Max Orphan Transactions", min: 0 });
Expand Down