aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/developer-notes.md52
-rw-r--r--doc/tor.md4
2 files changed, 39 insertions, 17 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 0de1892200..c9fe3a7ab4 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -71,6 +71,8 @@ code.
- Constant names are all uppercase, and use `_` to separate words.
- Class names, function names and method names are UpperCamelCase
(PascalCase). Do not prefix class names with `C`.
+ - Test suite naming convention: The Boost test suite in file
+ `src/test/foo_tests.cpp` should be named `foo_tests`.
- **Miscellaneous**
- `++i` is preferred over `i++`.
@@ -448,12 +450,21 @@ C++ data structures
- Vector bounds checking is only enabled in debug mode. Do not rely on it
-- Make sure that constructors initialize all fields. If this is skipped for a
- good reason (i.e., optimization on the critical path), add an explicit
- comment about this
+- Initialize all non-static class members where they are defined.
+ If this is skipped for a good reason (i.e., optimization on the critical
+ path), add an explicit comment about this
- *Rationale*: Ensure determinism by avoiding accidental use of uninitialized
values. Also, static analyzers balk about this.
+ Initializing the members in the declaration makes it easy to
+ spot uninitialized ones.
+
+```cpp
+class A
+{
+ uint32_t m_count{0};
+}
+```
- By default, declare single-argument constructors `explicit`.
@@ -472,18 +483,6 @@ C++ data structures
- *Rationale*: Easier to understand what is happening, thus easier to spot mistakes, even for those
that are not language lawyers
-- Initialize all non-static class members where they are defined
-
- - *Rationale*: Initializing the members in the declaration makes it easy to spot uninitialized ones,
- and avoids accidentally reading uninitialized memory
-
-```cpp
-class A
-{
- uint32_t m_count{0};
-}
-```
-
Strings and formatting
------------------------
@@ -604,6 +603,16 @@ namespace {
source file into account. This allows quoted includes to stand out more when
the location of the source file actually is relevant.
+- Use include guards to avoid the problem of double inclusion. The header file
+ `foo/bar.h` should use the include guard identifier `BITCOIN_FOO_BAR_H`, e.g.
+
+```c++
+#ifndef BITCOIN_FOO_BAR_H
+#define BITCOIN_FOO_BAR_H
+...
+#endif // BITCOIN_FOO_BAR_H
+```
+
GUI
-----
@@ -613,6 +622,19 @@ GUI
should not interact with the user. That's where View classes come in. The converse also
holds: try to not directly access core data structures from Views.
+- Avoid adding slow or blocking code in the GUI thread. In particular do not
+ add new `interface::Node` and `interface::Wallet` method calls, even if they
+ may be fast now, in case they are changed to lock or communicate across
+ processes in the future.
+
+ Prefer to offload work from the GUI thread to worker threads (see
+ `RPCExecutor` in console code as an example) or take other steps (see
+ https://doc.qt.io/archives/qq/qq27-responsive-guis.html) to keep the GUI
+ responsive.
+
+ - *Rationale*: Blocking the GUI thread can increase latency, and lead to
+ hangs and deadlocks.
+
Subtrees
----------
diff --git a/doc/tor.md b/doc/tor.md
index a05979fca8..931c83abdd 100644
--- a/doc/tor.md
+++ b/doc/tor.md
@@ -31,7 +31,7 @@ outgoing connections be anonymized, but more is possible.
In a typical situation, this suffices to run behind a Tor proxy:
- ./bitcoin -proxy=127.0.0.1:9050
+ ./bitcoind -proxy=127.0.0.1:9050
2. Run a bitcoin hidden server
@@ -86,7 +86,7 @@ and open port 8333 on your firewall (or use -upnp).
If you only want to use Tor to reach onion addresses, but not use it as a proxy
for normal IPv4/IPv6 communication, use:
- ./bitcoin -onion=127.0.0.1:9050 -externalip=57qr3yd1nyntf5k.onion -discover
+ ./bitcoind -onion=127.0.0.1:9050 -externalip=57qr3yd1nyntf5k.onion -discover
3. Automatically listen on Tor
--------------------------------