@@ -784,38 +784,6 @@ Threads
784
784
- [ ThreadI2PAcceptIncoming (` b-i2paccept ` )] ( https://doxygen.bitcoincore.org/class_c_connman.html#a57787b4f9ac847d24065fbb0dd6e70f8 )
785
785
: Listens for and accepts incoming I2P connections through the I2P SAM proxy.
786
786
787
- Ignoring IDE/editor files
788
- --------------------------
789
-
790
- In closed-source environments in which everyone uses the same IDE, it is common
791
- to add temporary files it produces to the project-wide ` .gitignore ` file.
792
-
793
- However, in open source software such as Bitcoin Core, where everyone uses
794
- their own editors/IDE/tools, it is less common. Only you know what files your
795
- editor produces and this may change from version to version. The canonical way
796
- to do this is thus to create your local gitignore. Add this to ` ~/.gitconfig ` :
797
-
798
- ```
799
- [core]
800
- excludesfile = /home/.../.gitignore_global
801
- ```
802
-
803
- (alternatively, type the command ` git config --global core.excludesfile ~/.gitignore_global `
804
- on a terminal)
805
-
806
- Then put your favourite tool's temporary filenames in that file, e.g.
807
- ```
808
- # NetBeans
809
- nbproject/
810
- ```
811
-
812
- Another option is to create a per-repository excludes file ` .git/info/exclude ` .
813
- These are not committed but apply only to one repository.
814
-
815
- If a set of tools is used by the build system or scripts the repository (for
816
- example, lcov) it is perfectly acceptable to add its files to ` .gitignore `
817
- and commit them.
818
-
819
787
Development guidelines
820
788
============================
821
789
@@ -830,15 +798,6 @@ General Bitcoin Core
830
798
- * Rationale* : RPC allows for better automatic testing. The test suite for
831
799
the GUI is very limited.
832
800
833
- - Make sure pull requests pass CI before merging.
834
-
835
- - * Rationale* : Makes sure that they pass thorough testing, and that the tester will keep passing
836
- on the master branch. Otherwise, all new pull requests will start failing the tests, resulting in
837
- confusion and mayhem.
838
-
839
- - * Explanation* : If the test suite is to be updated for a change, this has to
840
- be done first.
841
-
842
801
Logging
843
802
-------
844
803
@@ -878,11 +837,6 @@ Note that the format strings and parameters of `LogDebug` and `LogTrace`
878
837
are only evaluated if the logging category is enabled, so you must be
879
838
careful to avoid side-effects in those expressions.
880
839
881
- Wallet
882
- -------
883
-
884
- - Make sure that no crashes happen with run-time option ` -disablewallet ` .
885
-
886
840
General C++
887
841
-------------
888
842
@@ -1008,7 +962,7 @@ Strings and formatting
1008
962
buffer overflows, and surprises with `\0` characters. Also, some C string manipulations
1009
963
tend to act differently depending on platform, or even the user locale.
1010
964
1011
- - For `strprintf`, `LogInfo`, `LogDebug`, etc formatting characters don't need size specifiers.
965
+ - For `strprintf`, `LogInfo`, `LogDebug`, etc formatting characters don't need size specifiers (hh, h, l, ll, j, z, t, L) for arithmetic types .
1012
966
1013
967
- *Rationale*: Bitcoin Core uses tinyformat, which is type safe. Leave them out to avoid confusion.
1014
968
@@ -1032,7 +986,7 @@ Strings and formatting
1032
986
- In cases where you do call `.c_str()`, you might want to additionally check that the string does not contain embedded '\0' characters, because
1033
987
it will (necessarily) truncate the string. This might be used to hide parts of the string from logging or to circumvent
1034
988
checks. If a use of strings is sensitive to this, take care to check the string for embedded NULL characters first
1035
- and reject it if there are any (see `ParsePrechecks` in `strencodings.cpp` for an example) .
989
+ and reject it if there are any.
1036
990
1037
991
Shadowing
1038
992
--------------
@@ -1159,27 +1113,7 @@ TRY_LOCK(cs_vNodes, lockNodes);
1159
1113
Scripts
1160
1114
--------------------------
1161
1115
1162
- Write scripts in Python rather than bash, when possible.
1163
-
1164
- ### Shebang
1165
-
1166
- - Use `#!/usr/bin/env bash` instead of obsolete `#!/bin/bash`.
1167
-
1168
- - [*Rationale*](https://github.com/dylanaraps/pure-bash-bible#shebang):
1169
-
1170
- `#!/bin/bash` assumes it is always installed to /bin/ which can cause issues;
1171
-
1172
- `#!/usr/bin/env bash` searches the user's PATH to find the bash binary.
1173
-
1174
- OK:
1175
- ```bash
1176
- #!/usr/bin/env bash
1177
- ```
1178
-
1179
- Wrong:
1180
- ``` bash
1181
- #! /bin/bash
1182
- ```
1116
+ Write scripts in Python or Rust rather than bash, when possible.
1183
1117
1184
1118
Source code organization
1185
1119
--------------------------
@@ -1189,12 +1123,6 @@ Source code organization
1189
1123
1190
1124
- *Rationale*: Shorter and simpler header files are easier to read and reduce compile time.
1191
1125
1192
- - Use only the lowercase alphanumerics (` a-z0-9 ` ), underscore (` _ ` ) and hyphen (` - ` ) in source code filenames.
1193
-
1194
- - * Rationale* : ` grep ` : ing and auto-completing filenames is easier when using a consistent
1195
- naming pattern. Potential problems when building on case-insensitive filesystems are
1196
- avoided when using only lowercase characters in source code filenames.
1197
-
1198
1126
- Every `.cpp` and `.h` file should `#include` every header file it directly uses classes, functions or other
1199
1127
definitions from, even if those headers are already included indirectly through other headers.
1200
1128
@@ -1222,24 +1150,6 @@ namespace {
1222
1150
1223
1151
- * Rationale* : Avoids confusion about the namespace context.
1224
1152
1225
- - Use `#include <primitives/transaction.h>` bracket syntax instead of
1226
- `#include "primitives/transactions.h"` quote syntax.
1227
-
1228
- - *Rationale*: Bracket syntax is less ambiguous because the preprocessor
1229
- searches a fixed list of include directories without taking location of the
1230
- source file into account. This allows quoted includes to stand out more when
1231
- the location of the source file actually is relevant.
1232
-
1233
- - Use include guards to avoid the problem of double inclusion. The header file
1234
- `foo/bar.h` should use the include guard identifier `BITCOIN_FOO_BAR_H`, e.g.
1235
-
1236
- ```c++
1237
- #ifndef BITCOIN_FOO_BAR_H
1238
- #define BITCOIN_FOO_BAR_H
1239
- ...
1240
- #endif // BITCOIN_FOO_BAR_H
1241
- ```
1242
-
1243
1153
GUI
1244
1154
-----
1245
1155
@@ -1466,10 +1376,6 @@ A few guidelines for introducing and reviewing new RPC interfaces:
1466
1376
- * Rationale* : Integer verbosity allows for multiple values. Undocumented boolean verbosity is deprecated
1467
1377
and new RPC methods should prevent its use.
1468
1378
1469
- - Don't forget to fill in the argument names correctly in the RPC command table.
1470
-
1471
- - * Rationale* : If not, the call cannot be used with name-based arguments.
1472
-
1473
1379
- Add every non-string RPC argument ` (method, idx, name) ` to the table ` vRPCConvertParams ` in ` rpc/client.cpp ` .
1474
1380
1475
1381
- * Rationale* : ` bitcoin-cli ` and the GUI debug console use this table to determine how to
@@ -1501,17 +1407,6 @@ A few guidelines for introducing and reviewing new RPC interfaces:
1501
1407
until the wallet is caught up to the chainstate as of the RPC call's entry.
1502
1408
This also makes the API much easier for RPC clients to reason about.
1503
1409
1504
- - Be aware of RPC method aliases and generally avoid registering the same
1505
- callback function pointer for different RPCs.
1506
-
1507
- - * Rationale* : RPC methods registered with the same function pointer will be
1508
- considered aliases and only the first method name will show up in the
1509
- ` help ` RPC command list.
1510
-
1511
- - * Exception* : Using RPC method aliases may be appropriate in cases where a
1512
- new RPC is replacing a deprecated RPC, to avoid both RPCs confusingly
1513
- showing up in the command list.
1514
-
1515
1410
- Use * invalid* bech32 addresses (e.g. in the constant array ` EXAMPLE_ADDRESS ` ) for
1516
1411
` RPCExamples ` help documentation.
1517
1412
0 commit comments