Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

brings back @jonls #2412.
Rebased and overhauled:

  • togglenetwork RPC command renamed to "setnetworkactive true|false"
  • GUI toggling is now by pressing the connections icon in the status bar (it's a hidden feature now!)

jonls and others added 4 commits November 18, 2014 14:24
Added the function SetNetworkActive() which when called with argument set to false disconnects all nodes and sets the flag fNetworkActive to false. As long as this flag is false no new connections are attempted and no incoming connections are accepted. Network activity is reenabled by calling the function with argument true.
RPC command "togglenetwork" toggles network and returns new state after command.
RPC command "getinfo" returns "networkactive" field in output.
Add getNetworkActive()/setNetworkActive() method to client model.
Send network active status through NotifyNetworkActiveChanged.
Indicate in tool tip of gui status bar network indicator whether network activity is disabled.
Indicate in debug window whether network activity is disabled and add button to allow user to toggle network activity state.
- rename rpc command "togglenetwork" to "setnetworkactive (true|false)"
- add simple testcase
- GUI toggle added to connections icon in statusbar
@gmaxwell
Copy link
Contributor

Can you write up a proposed testing procedure?

@jonasschnelli
Copy link
Contributor Author

I started a very simple unit-test case in this pull (here).

In general
The network toggle should react as you would block your local traffic (iptables, soft-firewall, etc.) or as you would unplug yourself off the inet.
IMO, there should not be a special answer to sendtoaddress, etc. when your toggled your network off.
If we start treating the network-toggled-off state anyhow special, we might slide into a new, probably heavy to maintain state.

@jonasschnelli
Copy link
Contributor Author

Any opinion on that?
I would love to see this in 0.11.

@Diapolo
Copy link

Diapolo commented Nov 26, 2014

I always liked that, didn't look at the pull lately...

@laanwj
Copy link
Member

laanwj commented Nov 26, 2014

I'm still too focused on the 0.10 release to even think about what should make it into 0.11, which is half a year away.

I'd prefer traffic throttling or "quotas per time unit" a la Tor (see https://www.torproject.org/docs/faq.html.en#LimitTotalBandwidth) to a manual, complete shutoff. But this may be better than nothing in that regard, and much easier to test.

@jonasschnelli
Copy link
Contributor Author

@laanwj no worries. You should/can focus on 0.10.

IMO: Throttling is another thing and can address other user scenarios. Disabling != throttling.
I could imagine having both features side a side.

@gmaxwell
Copy link
Contributor

I'd like to see a host network friendlyness features in upcoming versions. This should be one them.

There are some corner cases to contemplate here. Say a transaction has one confirmation and you network off a host and the chain reorgs and drops the transaction. The wallet will be giving incorret information until the network is turned back on. So, should such a patch be disabling confirmation counts on newly confirmed transactions?

@jonasschnelli
Copy link
Contributor Author

Disabling the confirmation count during disabled network state would be possible.
But the reorg-drop-transaction thing could also happen when you disconnect on a hardware basis (weak wifi, 3g connection, etc.).
Should we also check for hardware-like-network-disconnections? Probably not.

Adding code to handle the toggled off state in case of UI, etc. could bring in more effort when it comes to maintainability.

IMO, let's just allow users cut themselves off the nodes, brutal and with all known sudden-disconnect issues.

Or an option would be:
Warn user on Qt level before they disconnect.

@laanwj laanwj added the P2P label Nov 28, 2014
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we find an icon that doesn't require a new license?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, NACK merging with this license. Section 4(c) seems to give the author special privileges that are non-free and could conceivably be problematic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonasschnelli Can you make a new one that fits better with #5219 ? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The icon should not be the problem.
Will do a new one soon.

@gmaxwell
Copy link
Contributor

The "toggle" rpc is a bad interface. It depends on the caller knowing the current state, and even if the caller checks it could race with another caller.

Can we make the api/interface so that it can have more than two states? A useful middle ground is "make outbound connections every X hours, fetch blocks, go back offline". This ensures you won't be waiting a long time when you go to actually use it.

So, e.g. off/scheduled/on I think it's likely that when we add support for bandwidth rate limiting we'll add code to parse cron style schedules.

IMO, let's just allow users cut themselves off the nodes,

Our responsiblity to the user is to help them not footgun themselvels. If they understood the software and risks as well as we do, they've be writing it, not us. :)

That doesn't mean it's reasonable to pack every potential protection we can think of into every pull. But if we have something that increases risk to the user we ought to give some thought as to how we can mitigate that risk.

could bring in more effort when it comes to maintainability

I think overall we should have more affordances for risky situations. E.g. making it clear that confirmations are uncertian when we know the network has forked. Presumably all these modes of cautionary handling can be covered by a single piece of interface infrastrcture. Some hurestic of "if you're off line N minutes, then blocks N*2 minutes prior to when you went off now have a displayed confirm count of '?'" would be simple to add if there was already code that hid confirmation counts under other dangerous condtions.

@ghost
Copy link

ghost commented Dec 30, 2014

one thing i see is that this is a good first step for the issue with the in-wallet paper wallet generator

@jonasschnelli
Copy link
Contributor Author

There is no consensus about this. Closing for now.

@jonasschnelli
Copy link
Contributor Author

@gmaxwell: I still think a pause/resume feature could be useful.

  • What about pausing the validation process (during initial sync)?
  • What if a user could disable block relaying? Do you expect that this causes a harm to the network?
    I think diving into network throttling is a job outside of bitcoind (router/net level).

@ghost
Copy link

ghost commented Jul 1, 2015

I agree with @jonasschnelli in supporting this PR. For example, some have data plans that have limited day useage with unlimited night use, in such cases (very common around here) one would appreciate the option to pause access in the morning and resume after hours. Closing the app and restarting is always a scary thing because if it gets corrupted, you have to start from scratch. Also this ties in well with the pull request to add an internal paper wallet printer, another PR that i think would make a great addition to the wallet.

@luke-jr luke-jr mentioned this pull request Oct 23, 2016
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants