mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-25 22:18:07 +00:00
Add Toggle for BIP 37 and 157
This commit is contained in:
parent
f486651813
commit
16d78404d2
|
@ -61,6 +61,13 @@ else
|
|||
cat /usr/share/mynode/bitcoin_testnet.conf >> /mnt/hdd/mynode/bitcoin/bitcoin.conf
|
||||
fi
|
||||
|
||||
# Append BIP setting toggles
|
||||
if [ -f /mnt/hdd/mynode/settings/.bip37_enabled ]; then
|
||||
cat /usr/share/mynode/bitcoin_bip37.conf >> /mnt/hdd/mynode/bitcoin/bitcoin.conf
|
||||
fi
|
||||
if [ -f /mnt/hdd/mynode/settings/.bip157_enabled ]; then
|
||||
cat /usr/share/mynode/bitcoin_bip157.conf >> /mnt/hdd/mynode/bitcoin/bitcoin.conf
|
||||
fi
|
||||
if [ -f /mnt/hdd/mynode/settings/.bip158_enabled ]; then
|
||||
cat /usr/share/mynode/bitcoin_bip158.conf >> /mnt/hdd/mynode/bitcoin/bitcoin.conf
|
||||
fi
|
||||
|
|
|
@ -37,7 +37,7 @@ whitelist=download@10.0.0.0/8
|
|||
whitelist=download@172.16.0.0/12
|
||||
whitelist=download@192.168.0.0/16
|
||||
|
||||
# Enable Bloom filters
|
||||
# Enable Bloom filters (local network)
|
||||
whitelist=bloomfilter@127.0.0.1
|
||||
whitelist=bloomfilter@10.0.0.0/8
|
||||
whitelist=bloomfilter@172.16.0.0/12
|
||||
|
|
3
rootfs/standard/usr/share/mynode/bitcoin_bip157.conf
Normal file
3
rootfs/standard/usr/share/mynode/bitcoin_bip157.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
# Enable serving blockfilters (BIP 157)
|
||||
peerblockfilters=1
|
3
rootfs/standard/usr/share/mynode/bitcoin_bip37.conf
Normal file
3
rootfs/standard/usr/share/mynode/bitcoin_bip37.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
# Enable serving bloom filters (BIP 37)
|
||||
peerbloomfilters=1
|
|
@ -117,6 +117,8 @@ def bitcoin_status_page():
|
|||
"wallets": walletdata,
|
||||
"bitcoin_whitepaper_exists": bitcoin_whitepaper_exists,
|
||||
"version": version,
|
||||
"bip37_enabled": is_bip37_enabled(),
|
||||
"bip157_enabled": is_bip157_enabled(),
|
||||
"bip158_enabled": is_bip158_enabled(),
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
|
@ -221,6 +223,46 @@ def runcmd_page():
|
|||
response = runcmd(request.form['cmd'])
|
||||
return response
|
||||
|
||||
@mynode_bitcoin.route("/bitcoin/toggle_bip37")
|
||||
def bitcoin_toggle_bip37():
|
||||
if request.args.get("enabled") and request.args.get("enabled") == "1":
|
||||
enable_bip37()
|
||||
else:
|
||||
disable_bip37()
|
||||
|
||||
# Trigger reboot
|
||||
t = Timer(1.0, reboot_device)
|
||||
t.start()
|
||||
|
||||
# Wait until device is restarted
|
||||
templateData = {
|
||||
"title": "myNode Reboot",
|
||||
"header_text": "Restarting",
|
||||
"subheader_text": "This will take several minutes...",
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
|
||||
@mynode_bitcoin.route("/bitcoin/toggle_bip157")
|
||||
def bitcoin_toggle_bip157():
|
||||
if request.args.get("enabled") and request.args.get("enabled") == "1":
|
||||
enable_bip157()
|
||||
else:
|
||||
disable_bip157()
|
||||
|
||||
# Trigger reboot
|
||||
t = Timer(1.0, reboot_device)
|
||||
t.start()
|
||||
|
||||
# Wait until device is restarted
|
||||
templateData = {
|
||||
"title": "myNode Reboot",
|
||||
"header_text": "Restarting",
|
||||
"subheader_text": "This will take several minutes...",
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
|
||||
@mynode_bitcoin.route("/bitcoin/toggle_bip158")
|
||||
def bitcoin_toggle_bip158():
|
||||
check_logged_in()
|
||||
|
|
|
@ -248,13 +248,29 @@ def restart_bitcoin():
|
|||
t = Timer(1.0, restart_bitcoin_actual)
|
||||
t.start()
|
||||
|
||||
def is_bip37_enabled():
|
||||
if os.path.isfile("/mnt/hdd/mynode/settings/.bip37_enabled"):
|
||||
return True
|
||||
return False
|
||||
def enable_bip37():
|
||||
touch("/mnt/hdd/mynode/settings/.bip37_enabled")
|
||||
def disable_bip37():
|
||||
delete_file("/mnt/hdd/mynode/settings/.bip37_enabled")
|
||||
|
||||
def is_bip157_enabled():
|
||||
if os.path.isfile("/mnt/hdd/mynode/settings/.bip157_enabled"):
|
||||
return True
|
||||
return False
|
||||
def enable_bip157():
|
||||
touch("/mnt/hdd/mynode/settings/.bip157_enabled")
|
||||
def disable_bip157():
|
||||
delete_file("/mnt/hdd/mynode/settings/.bip157_enabled")
|
||||
|
||||
def is_bip158_enabled():
|
||||
if os.path.isfile("/mnt/hdd/mynode/settings/.bip158_enabled"):
|
||||
return True
|
||||
return False
|
||||
|
||||
def enable_bip158():
|
||||
touch("/mnt/hdd/mynode/settings/.bip158_enabled")
|
||||
|
||||
def disable_bip158():
|
||||
delete_file("/mnt/hdd/mynode/settings/.bip158_enabled")
|
|
@ -24,6 +24,49 @@
|
|||
$("#copy_rpc_password").show();
|
||||
}
|
||||
|
||||
$('#bip37_checkbox').change(function () {
|
||||
$("#bip37_save").show();
|
||||
});
|
||||
$("#bip37_save").on("click", function() {
|
||||
enabled=$('#bip37_checkbox').is(":checked");
|
||||
if (enabled)
|
||||
{
|
||||
openConfirmDialog("confirm-dialog",
|
||||
"Enable Peer Bloom Filters (BIP 37)",
|
||||
"Are you sure you want to enable bloom filters?<br/><br/>\
|
||||
Enabling peer bloom filters may have negative consequences. See https://github.com/bitcoin/bitcoin/issues/9540.",
|
||||
function(){
|
||||
$( this ).dialog( "close" );
|
||||
window.location.href='/bitcoin/toggle_bip37?enabled=1';
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href='/bitcoin/toggle_bip37?enabled=0';
|
||||
}
|
||||
});
|
||||
|
||||
$('#bip157_checkbox').change(function () {
|
||||
$("#bip157_save").show();
|
||||
});
|
||||
$("#bip157_save").on("click", function() {
|
||||
enabled=$('#bip157_checkbox').is(":checked");
|
||||
if (enabled)
|
||||
{
|
||||
openConfirmDialog("confirm-dialog",
|
||||
"Enable Peer Block Filters (BIP 157)",
|
||||
"Are you sure you want to enable peer block filters?",
|
||||
function(){
|
||||
$( this ).dialog( "close" );
|
||||
window.location.href='/bitcoin/toggle_bip157?enabled=1';
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href='/bitcoin/toggle_bip157?enabled=0';
|
||||
}
|
||||
});
|
||||
|
||||
$('#bip158_checkbox').change(function () {
|
||||
$("#bip158_save").show();
|
||||
});
|
||||
|
@ -32,12 +75,11 @@
|
|||
if (enabled)
|
||||
{
|
||||
openConfirmDialog("confirm-dialog",
|
||||
"Enable block filters (BIP 158)",
|
||||
"Enable Block Filters (BIP 158)",
|
||||
"Are you sure you want to enable block filters?\
|
||||
This will take some time to download and occupy about 5GB of storage.",
|
||||
function(){
|
||||
$( this ).dialog( "close" );
|
||||
console.log("Inside callback of enabling BIP 158!!")
|
||||
window.location.href='/bitcoin/toggle_bip158?enabled=1';
|
||||
});
|
||||
}
|
||||
|
@ -140,6 +182,26 @@
|
|||
<th>Whitepaper</th>
|
||||
<td><a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="/bitcoin/bitcoin_whitepaper.pdf">download</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Peer Bloom Filters (BIP 37)</th>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="bip37_checkbox" {% if bip37_enabled %}checked{% endif %}>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<button id="bip37_save" style="display: none; float: right;" class="ui-button ui-widget ui-corner-all settings_button_small">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Peer Block Filters (BIP 157)</th>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="bip157_checkbox" {% if bip157_enabled %}checked{% endif %}>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<button id="bip157_save" style="display: none; float: right;" class="ui-button ui-widget ui-corner-all settings_button_small">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Block Filters (BIP 158)</th>
|
||||
<td>
|
||||
|
|
Loading…
Reference in New Issue
Block a user