Commit Graph

17834 Commits

Author SHA1 Message Date
UdjinM6
97907b051f Fix autobackup functionality 2020-04-23 14:33:31 -05:00
PastaPastaPasta
6f4260f860 bitcoin -> Dash Core
Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-04-23 14:33:31 -05:00
Pasta
02dfb89b02 fix test 50 -> 500
Signed-off-by: Pasta <pasta@dashboost.org>
2020-04-23 14:33:31 -05:00
Pasta
4aa8a9a206 resolve DEFAULT_WALLET_DAT being removed
Signed-off-by: Pasta <pasta@dashboost.org>
2020-04-23 14:33:31 -05:00
Wladimir J. van der Laan
7999080c04 Merge #11687: External wallet files
be8ab7d08 Create new wallet databases as directories rather than files (Russell Yanofsky)
26c06f24e Allow wallet files not in -walletdir directory (Russell Yanofsky)
d8a99f65e Allow wallet files in multiple directories (Russell Yanofsky)

Pull request description:

  This change consists of three commits:

  * The first commit is a pure refactoring that removes the restriction that two wallets can only be opened at the same time if they are contained in the same directory.
  * The second commit removes the restriction that `-wallet` filenames can only refer to files in the `-walletdir` directory.
  * The third commit makes second commit a little safer by changing bitcoin to create wallet databases as directories rather than files, so they can be safely backed up.

  All three commits should be straightforward:

  *  The first commit adds around 20 lines of new code and then updates a bunch of function signatures (generally updating them to take plain fs::path parameters, instead of combinations of strings, fs::paths, and objects like CDBEnv and CWalletDBWrapper).
  * The second commit removes two `-wallet` filename checks and adds some test cases to the multiwallet unit test.
  * The third commit just changes the mapping from specified wallet paths to bdb environment & data paths.

    ---

  **Note:** For anybody looking at this PR for the first time, I think you can skip the comments before _20 Nov_ and start reading at https://github.com/bitcoin/bitcoin/pull/11687#issuecomment-345625565. Comments before  _20 Nov_ were about an earlier version of the PR that didn't include the third commit, and then confusion from not seeing the first commit.

Tree-SHA512: 00bbb120fe0df847cf57014f75f1f7f1f58b0b62fa0b3adab4560163ebdfe06ccdfff33b4231693f03c5dc23601cb41954a07bcea9a4919c8d42f7d62bcf6024
2020-04-23 14:33:31 -05:00
pasta
6db01000cf 13017 continued
Signed-off-by: pasta <pasta@dashboost.org>
2020-04-23 14:33:31 -05:00
Wladimir J. van der Laan
4dcd8d1bea Merge #13017: Add wallets management functions
3c058fd wallet: Add HasWallets (João Barbosa)
373aee2 wallet: Add AddWallet, RemoveWallet, GetWallet and GetWallets (João Barbosa)
6efd964 refactor: Drop CWalletRef typedef (João Barbosa)

Pull request description:

  This is a small step towards dynamic wallet load/unload. The wallets *registry* `vpwallets` is used in several places. With these new functions all `vpwallets` usage are removed and `vpwallets` is now a static variable (no external linkage).

  The typedef `CWalletRef` is also removed as it is narrowly used.

Tree-SHA512: 2ea19da2e17b521ad678bfe10f3257e497ccaf7ab9fd0b6647f9d829f1d6131cfa68db8e8492421711c6da399859432b963a568bdd4ca40a77dd95b597839423
2020-04-23 14:33:31 -05:00
Alexander Block
911b5580e4
Fix typo in error log when EPOLL_CTL_ADD fails for wakeup pipe (#3451) 2020-04-23 12:33:36 +03:00
PastaPastaPasta
b775fa263f
Lower DEFAULT_PRIVATESEND_DENOMS (#3434)
Signed-off-by: pasta <pasta@dashboost.org>
2020-04-22 18:54:45 +03:00
Alexander Block
d59deea77b
Merge pull request #3445 from codablock/pr_epoll
Implement epoll support
2020-04-22 17:10:33 +02:00
Alexander Block
7c4ebe40de
Merge pull request #3450 from codablock/pr_fix_3
Fix handling of disconnected lingering nodes
2020-04-22 16:36:07 +02:00
Alexander Block
aa46b5ccb2 Make epoll the default socketevents mode when possible 2020-04-22 16:17:03 +02:00
Alexander Block
d6b69dbf69 Revert "Only run DisconnectNodes once per second"
This reverts commit 30e4afae00.
2020-04-22 16:05:11 +02:00
Alexander Block
e51580f052 Only linger when the other side has not shutdown/closed the socket yet
Otherwise immediately close the socket and remove the node from the list.
2020-04-22 07:50:40 +02:00
Alexander Block
1df71a0f22 Don't consider disconnecting nodes in GetNodeCount and GetNodeStats 2020-04-22 06:32:32 +02:00
Alexander Block
98ff8feaf2 Revert "Invoke DisconnectNodes from getconnectioncount/getpeerinfo/getnetworkinfo"
This reverts commit 2f1b3a34ab.
2020-04-22 06:32:32 +02:00
Alexander Block
ccb1f84b3a Revert "Invoke DisconnectNodes right before checking for duplicate connections"
This reverts commit 76d7b17dcd.
2020-04-22 06:32:32 +02:00
Alexander Block
33bfaffbea Don't return nodes with fDisconnect=true in FindNode
FindNode is only interested in active connections, especially when called
from OpenNetworkConnection. Connections which are about to get disconnected
and removed should be treated as if they are not existent anymore, as
otherwise there is a small race between disconnecting and reconnecting
nodes, causing OpenNetworkConnection to return early.
2020-04-22 06:32:32 +02:00
Alexander Block
d235364534 Wait one additional second for disconnects 2020-04-21 16:49:36 +02:00
Alexander Block
96faa8155e
Don't disconnect masternode probes for a few seconds (#3449)
* Refactor CMasternodeUtils::ProcessMasternodeConnections to be more readable

* Don't disconnect masternode probes for a few seconds
2020-04-21 16:44:18 +02:00
Alexander Block
608aed3d85
Don't try to connect to itself through CLLMQUtils::GetQuorumConnections (#3448) 2020-04-21 16:43:59 +02:00
Alexander Block
d516e3d1e0 Advance iterator in CConnman::DisconnectNodes when lingering 2020-04-21 08:16:49 +02:00
Alexander Block
3fa94aac56 Implement epoll support 2020-04-20 15:38:19 +02:00
PastaPastaPasta
087d98477b
Merge bitcoin#10387: Eventually connect to NODE_NETWORK_LIMITED peers (#3417)
* Merge #10387: Eventually connect to NODE_NETWORK_LIMITED peers

eb91835 Add setter for g_initial_block_download_completed (Jonas Schnelli)
3f56df5 [QA] add NODE_NETWORK_LIMITED address relay and sync test (Jonas Schnelli)
158e1a6 [QA] fix mininode CAddress ser/deser (Jonas Schnelli)
fa999af [QA] Allow addrman loopback tests (add debug option -addrmantest) (Jonas Schnelli)
6fe57bd Connect to peers signaling NODE_NETWORK_LIMITED when out-of-IBD (Jonas Schnelli)
31c45a9 Accept addresses with NODE_NETWORK_LIMITED flag (Jonas Schnelli)

Pull request description:

  Eventually connect to peers signalling NODE_NETWORK_LIMITED if we are out of IBD.
  Accept and relay NODE_NETWORK_LIMITED peers in addrman.

Tree-SHA512: 8a238fc97f767f81cae1866d6cc061390f23a72af4a711d2f7158c77f876017986abb371d213d1c84019eef7be4ca951e8e6f83fda36769c4e1a1d763f787037
Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/init.cpp
#	src/protocol.h
#	test/functional/node_network_limited.py

* remove witness

Signed-off-by: Pasta <pasta@dashboost.org>

* fix test expecting witness flag

Signed-off-by: Pasta <pasta@dashboost.org>

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
2020-04-19 16:21:47 +03:00
UdjinM6
d663f48085
Lower SELECT_TIMEOUT_MILLISECONDS for USE_WAKEUP_PIPE case (#3444) 2020-04-19 14:48:44 +02:00
Alexander Block
f5f4ccbf24
Merge pull request #3432 from codablock/pr_refactor_sockethandler
Refactor/Prepare CConnman for upcoming epoll support
2020-04-19 14:27:59 +02:00
10xcryptodev
93aa640af8
Fix #3248: use blue logo for Traditional theme (#3441)
* #3248 use blue logo for Traditional theme

* review tab space and blue logo name

* change file order and spaces

* Revert "review tab space and blue logo name"

This reverts commit 31e0c3d0e9.
2020-04-19 14:05:37 +03:00
Alexander Block
08477899b4
Merge #13522: [tests] Fix p2p_sendheaders race (#3438)
75848bcf40 [tests] Fix p2p_sendheaders race (John Newbery)

Pull request description:

  p2p_sendheaders has a race in part 1.3.

  part 1.2 sends a block to the node over the 'test_node' connection, but
  doesn't wait for an inv to be received on the 'inv_node' connection. If
  we get to part 1.3 before that inv has been received, then the
  subsequent call to check_last_inv_announcement could fail.

Tree-SHA512: ba9baffb3a9c0d379259190c737a7a4ad2e1133005a5b026af4f6b67a2978e24db39289551ad29134151879593ef5472be7e569a3557c0740fb51f5c56263d9a

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-04-19 14:04:58 +03:00
Alexander Block
3d24290bcb
Take all nodes into account in check_sigs instead of just just masternodes (#3437)
* Take all nodes into account in check_sigs instead of just just masternodes

Checking only masternodes might result in wait_for_sigs returning too early
when waiting for signatures to get cleaned up, so that node0 still has
the signature locally and thus does not fully re-process new signatures.

* Make sure node0 has received qsendrecsigs from the previously isolated node
2020-04-19 14:04:48 +03:00
PastaPastaPasta
d804a753af
Merge bitcoin#13134: net: Add option -enablebip61 to configure sending of BIP61 notifications (#3414)
* Merge #13134: net: Add option `-enablebip61` to configure sending of BIP61 notifications

87fe292d897e09e176ac7e254144466c319cc9ac doc: Mention disabling BIP61 in bips.md (Wladimir J. van der Laan)
fe16dd8226d924f44432c5b5014aa49ff45c82ff net: Add option `-enablebip61` to configure sending of BIP61 notifications (Wladimir J. van der Laan)

Pull request description:

  This commit adds a boolean option `-peersendreject`, defaulting to `1`, that can be used to disable the sending of [BIP61](https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki) `reject` messages. This functionality has been requested for various reasons:

  - security (DoS): reject messages can reveal internal state that can be used to target certain resources such as the mempool more easily.

  - bandwidth: a typical node sends lots of reject messages; this counts against upstream bandwidth. Also the reject messages tend to be larger than the message that was rejected.

  On the other hand, reject messages can be useful while developing client software (I found them indispensable while creating bitcoin-submittx), as well as for our own test cases, so whatever the default becomes on the long run, IMO the functionality should be retained as option. But that's a discussion for later, for now it's simply a node operator decision.

  Also adds a RPC test that checks the functionality.

Tree-SHA512: 9488cc53e13cd8e5c6f8eb472a44309572673405c1d1438c3488f627fae622c95e2198bde5ed7d29e56b948e2918bf1920239e9f865889f4c37c097c37a4d7a9

* 0.17 -> 0.16

Signed-off-by: Pasta <pasta@dashboost.org>

* tx1 -> base_ tx fixing 13134

Signed-off-by: Pasta <pasta@dashboost.org>

* move added bip61 message checking up

Signed-off-by: Pasta <pasta@dashboost.org>

* Dash specific code, only send reject messages if bip61 is enabled

Signed-off-by: Pasta <pasta@dashboost.org>

* Fix invalidtxrequest.py

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-04-19 14:04:31 +03:00
PastaPastaPasta
d06597a421
[Trivial] Adjust some text in mnauth.cpp (#3413)
* trivial text changes

Signed-off-by: Pasta <pasta@dashboost.org>

* don't refer to node as he / him

Signed-off-by: Pasta <pasta@dashboost.org>
2020-04-19 14:03:59 +03:00
PastaPastaPasta
3d175aa2e5
Merge bitcoin#13151: net: Serve blocks directly from disk when possible (#3408)
* Merge #13151: net: Serve blocks directly from disk when possible

0bf431870e45d8e20c4671e51a782ebf97b75fac net: Serve blocks directly from disk when possible (Wladimir J. van der Laan)

Pull request description:

  In `ProcessGetBlockData`, send the block data directly from disk if type MSG_WITNESS_BLOCK is requested. This is a valid shortcut as the on-disk format matches the network format.

  This is expected to increase performance because a deserialization and subsequent serialization roundtrip is avoided.

Tree-SHA512: 9a9500b4c1354eaae1a6f1c6ef2416c1c1985029852589266f3a70e808f6c7482c135e9ab251a527566935378ab7c32dba4ed43ba5451e802d8e72b77d1ba472
Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/net_processing.cpp
#	src/validation.cpp

* fix extra bracket

Signed-off-by: Pasta <pasta@dashboost.org>

* remove read raw block from disk functions

Signed-off-by: Pasta <pasta@dashboost.org>

* correct `if (pblock)` scope

Signed-off-by: Pasta <pasta@dashboost.org>

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
2020-04-19 14:03:27 +03:00
Alexander Block
47af42a69c AddRef/Release when adding/erasing CNode* entries to/from mapNodesWithDataToSend 2020-04-18 21:05:42 +02:00
Alexander Block
e4be48bc7e Invoke select/poll with 0 timeout in case we know that there is work 2020-04-18 21:05:42 +02:00
Alexander Block
e263edd573 Still invoke ReleaseNodeVector when interrupted 2020-04-18 21:05:42 +02:00
Alexander Block
5c9f548640 Track which nodes are able to receive/send data
Instead of selecting every socket in every SocketHandler iteration, we will
now track which nodes are known to have pending receivable data and/or
have empty send buffers.

Each time recv fails to fill a whole receive buffer, fHasRecvData is
set to false so that the socket is added to the receive select set
in the next iteration. When that socket is signalled through select/poll,
fHasRecvData is set to true again and remains true until a future recv
fails.

Each time send fails to send a full message, fCanSendData is set to false
so that the socket is added to the send select set in the next iteration.

At the same time, nodes which have pending messages to send are tracked
in mapNodesWithDataToSend, so that SocketHandler knows for which nodes
SocketSendData must be invoked.
2020-04-18 21:05:42 +02:00
Alexander Block
0e8e22aa16 Track SOCKET to CNode* mapping 2020-04-18 21:05:42 +02:00
Alexander Block
94fc4fb027 Track size of vSendMsg in atomic nSendMsgSize
This allows us to check for pending messages without locking cs_vSend
2020-04-18 21:05:15 +02:00
Alexander Block
1621e82e95 Move socket receiving into SocketRecvData 2020-04-18 21:05:15 +02:00
Alexander Block
50fc3c5cce Make SocketSendData non-const 2020-04-18 21:05:15 +02:00
Alexander Block
de931a25a3
Merge pull request #3433 from codablock/pr_wakeup_on_connection
Wakeup wakeup-pipe when new peers are added
2020-04-18 21:04:19 +02:00
UdjinM6
75a1968c96
Fix abandonconflict.py (#3436)
One of rebases in #3407 reverted the fix
2020-04-18 21:04:01 +02:00
Alexander Block
176d625860 Sleep longer when USE_WAKEUP_PIPE is enabled 2020-04-18 12:41:25 +02:00
Alexander Block
97ee3015e1 Wakeup select/poll when new nodes are added 2020-04-18 12:41:25 +02:00
Alexander Block
2610e718cd
Don't delete MN list snapshots and diffs from DB when reorgs take place (#3435)
Deleting these from the DB means that future calls to GetListForBlock  for
the reorged/orphaned block will return an empty MN list. At the same time,
GetListForBlock will add the empty list to the internal MN list cache.

This behavior is not acceptable for multiple reasons:
1. A caller of GetListForBlock should always expect a valid list if that
   block was once in the best chain. We might otherwise run into strange
   behavior (e.g. GetAllQuorumMembers returning zero members)
2. If the chain is ever reorged back to the initial chain (that was
   orphaned), GetListForBlock should not return the invalid/empty cache
   entry for the previously orphaned block.

This should also fix test failures seen on Gitlab CI
2020-04-18 12:35:46 +02:00
Alexander Block
6d83b0a053
Merge pull request #3431 from codablock/pr_socketevents_arg
Make socketevents mode (poll vs select) configurable via parameter
2020-04-18 12:34:34 +02:00
PastaPastaPasta
97742a14d8
Merge bitcoin#10762: [wallet] Remove Wallet dependencies from init.cpp (#3412)
* Merge #10762: [wallet] Remove Wallet dependencies from init.cpp

c7ec524 [wallet] Add dummy wallet init class (John Newbery)
49baa4a [wallet] Use global g_wallet_init_interface to init/destroy the wallet. (John Newbery)
caaf972 [wallet] Create wallet init interface. (John Newbery)
5fb5421 [wallet] Move wallet init functions into WalletInit class. (John Newbery)

Pull request description:

  This continues the work of #7965. This PR, along with several others, would remove the remaining dependencies from libbitcoin_server.a on libbitcoin_wallet.a.

  To create the interface, I've just translated all the old init.cpp wallet function calls into an interface class. I've not done any thinking about whether it makes sense to change that interface by combining/splitting those calls. This is a purely internal interface, so there's no problem in changing it later.

Tree-SHA512: 32ea57615229c33fd1a7f2f29ebc11bf30337685f7211baffa899823ef74b65dcbf068289c557a161c5afffb51fdc38a2ee8180720371f64d433b12b0615cf3f
Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/dashd.cpp
#	src/init.cpp

* a couple of fixes

Signed-off-by: Pasta <pasta@dashboost.org>

* move privatesend launch options help into wallet/init.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* remove ENABLE_WALLET for AutoLockMasternodeCollaterals

Signed-off-by: Pasta <pasta@dashboost.org>

* move a wallet param interaction into wallet/init.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* move PrivateSend init to wallet/init.h

Signed-off-by: Pasta <pasta@dashboost.org>

* move privatesend scheduler into wallet.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* remove unneeded import

Signed-off-by: Pasta <pasta@dashboost.org>

* move KeePass init and InitAutoBackup into wallet/init.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* Fix 10762

Changes:
- Should backup wallets before trying to verify them. This is because `-salvagewallet` is very dangerous and can actually corrupt wallets making them irreparably broken.
- No reason to make `schedulePrivateSendClientMaintenance` a part of the wallet (interface) because `privateSendClient` is a global object not tied to the wallet directly atm.
- Should not run client-side mixing on masternodes.
- Fix `InitAutoBackup` signature in `DummyWalletInit`.

* remove boost dependancy in wallet/init.cpp

Signed-off-by: pasta <pasta@dashboost.org>

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-04-18 12:59:40 +03:00
UdjinM6
20a0f3a51f
Merge pull request #3407 from PastaPastaPasta/backports-0.16-pr17
Backports 0.16 pr17
2020-04-18 12:57:51 +03:00
Alexander Block
6994d5f8e0 Randomly switch socketevents mode in CI tests 2020-04-17 22:09:52 +02:00
Alexander Block
a6d6c94a74 Allow to pass extra dashd args when running tests 2020-04-17 22:09:52 +02:00