added proper pruning

This commit is contained in:
jash
2018-11-03 19:09:29 +01:00
committed by kexkey
parent 7f936436f4
commit 6cbb12aa3a
3 changed files with 26 additions and 0 deletions

View File

@@ -333,6 +333,7 @@ module.exports = class extends Generator {
bitcoin_rpcpassword: 'CHANGEME',
bitcoin_uacomment: '',
bitcoin_prune: false,
bitcoin_prune_size: 550,
bitcoin_datapath: '',
bitcoin_node_ip: '',
bitcoin_mode: 'internal',

View File

@@ -18,6 +18,10 @@ const bitcoinInternal = function(props) {
return props.bitcoin_mode === 'internal'
};
const bitcoinInternalAndPrune = function(props) {
return bitcoinInternal(props) && props.bitcoin_prune;
};
module.exports = {
name: function() {
return name;
@@ -69,6 +73,22 @@ module.exports = {
name: 'bitcoin_prune',
default: utils._getDefault( 'bitcoin_prune' ),
message: prefix()+'Run bitcoin node in prune mode?'+utils._getHelp('bitcoin_prune'),
},
{
when: bitcoinInternalAndPrune,
type: 'input',
name: 'bitcoin_prune_size',
default: utils._getDefault( 'bitcoin_prune_size' ),
message: prefix()+'What is the maximum size of your blockchain data in megabytes?'+utils._getHelp('bitcoin_prune_size'),
validate: function( input ) {
if( ! /^\d+$/.test(input) ) {
throw new Error( "Not a number");
}
if( input < 550 ) {
throw new Error( "At least 550 is required");
}
return true;
}
}, // TODO: ask for size of prune
{
when: bitcoinInternal,

View File

@@ -3,7 +3,12 @@
testnet=1
<% } %>
<% if (bitcoin_prune) { %>
prune=<%= bitcoin_prune_size || 550 %>
<% } else { %>
txindex=1
<% } %>
zmqpubrawblock=tcp://0.0.0.0:18501
zmqpubrawtx=tcp://0.0.0.0:18502