Skip to content

Commit 9bb7a60

Browse files
authored
Merge pull request dashpay#4260 from PastaPastaPasta/backport-triv-pr15
Backport triv pr15
2 parents 84769e1 + 76b337b commit 9bb7a60

File tree

13 files changed

+63
-16
lines changed

13 files changed

+63
-16
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Note: Code review is a burdensome but important part of the development process,
109109

110110
If your pull request contains fixup commits (commits that change the same line of code repeatedly) or too fine-grained
111111
commits, you may be asked to [squash](https://git-scm.com/docs/git-rebase#_interactive_mode) your commits
112-
before it will be merged. The basic squashing workflow is shown below.
112+
before it will be reviewed. The basic squashing workflow is shown below.
113113

114114
git checkout your_branch_name
115115
git rebase -i HEAD~n

contrib/debian/examples/dash.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@
5656
# Maximum number of inbound+outbound connections.
5757
#maxconnections=
5858

59+
# Maximum upload bandwidth target in MiB per day (e.g. 'maxuploadtarget=1024' is 1 GiB per day).
60+
# This limits the upload bandwidth for those with bandwidth limits. 0 = no limit (default: 0).
61+
# -maxuploadtarget does not apply to peers with 'download' permission.
62+
# For more information on reducing bandwidth utilization, see: doc/reduce-traffic.md.
63+
#maxuploadtarget=
64+
5965
#
6066
# JSON-RPC options (for controlling a running Dash/dashd process)
6167
#

contrib/devtools/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ clang-format-diff.py
77

88
A script to format unified git diffs according to [.clang-format](../../src/.clang-format).
99

10-
Requires `clang-format`, installed e.g. via `brew install clang-format` on macOS.
10+
Requires `clang-format`, installed e.g. via `brew install clang-format` on macOS,
11+
or `sudo apt install clang-format` on Debian/Ubuntu.
1112

1213
For instance, to format the last commit with 0 lines of context,
1314
the script should be called from the git root folder as follows.

contrib/macdeploy/macdeployqtplus

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,8 @@ if len(config.fancy) == 1:
544544
sys.exit(1)
545545

546546
try:
547-
fancy = plistlib.readPlist(p)
547+
with open(p, 'rb') as fp:
548+
fancy = plistlib.load(fp, fmt=plistlib.FMT_XML)
548549
except:
549550
if verbose >= 1:
550551
sys.stderr.write("Error: Could not parse fancy disk image plist at \"%s\"\n" % (p))

doc/JSON-RPC-interface.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,14 @@ wallet would reflect the removal of these mempool transactions in the state.
3434

3535
However, the wallet may not be up-to-date with the current state of the mempool
3636
or the state of the mempool by an RPC that returned before this RPC.
37+
38+
## Limitations
39+
40+
There is a known issue in the JSON-RPC interface that can cause a node to crash if
41+
too many http connections are being opened at the same time because the system runs
42+
out of available file descriptors. To prevent this from happening you might
43+
want to increase the number of maximum allowed file descriptors in your system
44+
and try to prevent opening too many connections to your JSON-RPC interface at the
45+
same time if this is under your control. It is hard to give general advice
46+
since this depends on your system but if you make several hundred requests at
47+
once you are definitely at risk of encountering this issue.

doc/REST-interface.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ REST Interface consistency guarantees
1111
The [same guarantees as for the RPC Interface](/doc/JSON-RPC-interface.md#rpc-consistency-guarantees)
1212
apply.
1313

14+
Limitations
15+
-----------
16+
17+
There is a known issue in the REST interface that can cause a node to crash if
18+
too many http connections are being opened at the same time because the system runs
19+
out of available file descriptors. To prevent this from happening you might
20+
want to increase the number of maximum allowed file descriptors in your system
21+
and try to prevent opening too many connections to your rest interface at the
22+
same time if this is under your control. It is hard to give general advice
23+
since this depends on your system but if you make several hundred requests at
24+
once you are definitely at risk of encountering this issue.
25+
1426
Supported API
1527
-------------
1628

doc/developer-notes.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ tool to clean up patches automatically before submission.
6666
on the same line as the `if`, without braces. In every other case,
6767
braces are required, and the `then` and `else` clauses must appear
6868
correctly indented on a new line.
69+
- There's no hard limit on line width, but prefer to keep lines to <100
70+
characters if doing so does not decrease readability. Break up long
71+
function declarations over multiple lines using the Clang Format
72+
[AlignAfterOpenBracket](https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
73+
style option.
6974

7075
- **Symbol naming conventions**. These are preferred in new code, but are not
7176
required when doing so would need changes to significant pieces of existing
@@ -903,13 +908,6 @@ A few guidelines for introducing and reviewing new RPC interfaces:
903908

904909
- *Rationale*: If not, the call can not be used with name-based arguments.
905910

906-
- Set okSafeMode in the RPC command table to a sensible value: safe mode is when the
907-
blockchain is regarded to be in a confused state, and the client deems it unsafe to
908-
do anything irreversible such as send. Anything that just queries should be permitted.
909-
910-
- *Rationale*: Troubleshooting a node in safe mode is difficult if half the
911-
RPCs don't work.
912-
913911
- Add every non-string RPC argument `(method, idx, name)` to the table `vRPCConvertParams` in `rpc/client.cpp`.
914912

915913
- *Rationale*: `dash-cli` and the GUI debug console use this table to determine how to

src/bloom.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,18 @@ class CBloomFilter
109109
* insert()'ed ... but may also return true for items that were not inserted.
110110
*
111111
* It needs around 1.8 bytes per element per factor 0.1 of false positive rate.
112-
* (More accurately: 3/(log(256)*log(2)) * log(1/fpRate) * nElements bytes)
112+
* For example, if we want 1000 elements, we'd need:
113+
* - ~1800 bytes for a false positive rate of 0.1
114+
* - ~3600 bytes for a false positive rate of 0.01
115+
* - ~5400 bytes for a false positive rate of 0.001
116+
*
117+
* If we make these simplifying assumptions:
118+
* - logFpRate / log(0.5) doesn't get rounded or clamped in the nHashFuncs calculation
119+
* - nElements is even, so that nEntriesPerGeneration == nElements / 2
120+
*
121+
* Then we get a more accurate estimate for filter bytes:
122+
*
123+
* 3/(log(256)*log(2)) * log(1/fpRate) * nElements
113124
*/
114125
class CRollingBloomFilter
115126
{

src/coins.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ class Coin
7272
::Unserialize(s, Using<TxOutCompression>(out));
7373
}
7474

75+
/** Either this coin never existed (see e.g. coinEmpty in coins.cpp), or it
76+
* did exist and has been spent.
77+
*/
7578
bool IsSpent() const {
7679
return out.IsNull();
7780
}

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ bool AppInitParameterInteraction()
12841284

12851285
// Trim requested connection counts, to fit into system limitations
12861286
// <int> in std::min<int>(...) to work around FreeBSD compilation issue described in #2695
1287-
nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS);
1287+
nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS + nBind);
12881288
#ifdef USE_POLL
12891289
int fd_max = nFD;
12901290
#else

0 commit comments

Comments
 (0)