Bitcoin pruning will be disabled/not asked for during config, when lightning is enabled

This commit is contained in:
SKP
2019-02-08 23:08:03 +01:00
committed by kexkey
parent 5a18be3d8e
commit dd717ef4af
3 changed files with 19 additions and 4 deletions

View File

@@ -213,8 +213,10 @@ module.exports = class extends Generator {
delete this.props.lightning_version;
delete this.props.grafana_version;
}
this._assignConfigDefaults();
this._resolveConfigConflicts();
for( let c of this.featureChoices ) {
c.checked = this._isChecked( 'features', c.value );
}
@@ -324,6 +326,8 @@ module.exports = class extends Generator {
}
async writing() {
this._resolveConfigConflicts()
const configJsonString = JSON.stringify(this.props, null, 4);
const archive = new Archive( this.destinationPath('config.7z'), this.configurationPassword );
@@ -383,6 +387,13 @@ module.exports = class extends Generator {
/* some utils */
_resolveConfigConflicts() {
if( this.props.features.indexOf('lightning') !== -1 ) {
this.props.bitcoin_prune = false;
delete this.props.bitcoin_prune_size;
}
}
_assignConfigDefaults() {
this.props = Object.assign( {
features: [],

View File

@@ -23,7 +23,7 @@ const bitcoinInternalAndPrune = function(props) {
};
module.exports = {
name: function() {
name: function() {
return name;
},
prompts: function( utils ) {
@@ -68,14 +68,18 @@ module.exports = {
filter: utils._trimFilter,
},
{
when: bitcoinInternal,
when: function(props) {
return bitcoinInternal( props ) && props.features.indexOf('lightning') === -1;
},
type: 'confirm',
name: 'bitcoin_prune',
default: utils._getDefault( 'bitcoin_prune' ),
message: prefix()+'Run bitcoin node in prune mode?'+utils._getHelp('bitcoin_prune'),
},
{
when: bitcoinInternalAndPrune,
when: function(props) {
return bitcoinInternalAndPrune( props ) && props.features.indexOf('lightning') === -1;
},
type: 'input',
name: 'bitcoin_prune_size',
default: utils._getDefault( 'bitcoin_prune_size' ),