Commit Graph

24 Commits

Author SHA1 Message Date
Spencer Lievens
6dd8304a5c Remove duplication of "class CBlockIndex;" (#2036) 2018-04-18 14:50:08 +03:00
gladcow
2ea6f7d82e Use override keyword for overriden class member functions (#1644)
* Use `override` keyword for all overriden functions

* more override
2018-02-15 10:29:15 +03:00
Matt Corallo
15a8fcf993 Add a CValidationInterface::NewPoWValidBlock callback 2018-02-08 11:06:22 +01:00
Wladimir J. van der Laan
dc523a1649 Merge #9371: Notify on removal
094e4b3 Better document usage of SyncTransaction (Alex Morcos)
4afbde6 Introduce MemPoolConflictRemovalTracker (Alex Morcos)
ff25c32 mempool: add notification for added/removed entries (Wladimir J. van der Laan)
2018-01-21 12:48:33 +01:00
Alexander Block
f4af44676a Add SYNC_TRANSACTION_NOT_IN_BLOCK constant and fix callers of SyncTransaction
Needed due to out-of-order backporting.
2018-01-08 18:04:55 +01:00
Pieter Wuille
256b9b77a2 Merge #7946: Reduce cs_main locks during ConnectTip/SyncWithWallets
b3b3c2a Reduce cs_main locks during ConnectTip/SyncWithWallets (Jonas Schnelli)
2018-01-08 18:04:55 +01:00
Wladimir J. van der Laan
8874b2e0fd Merge #6480: include the chaintip blockindex in the SyncTransaction signal, add signal UpdateTip()
7d0bf0b include the chaintip *blockIndex in the SyncTransaction signal (Jonas Schnelli)
2017-12-11 08:30:26 +01:00
UdjinM6
4f0618ae8a Fix sync issues (#1599)
- add `MASTERNODE_SYNC_WAITING` sync state/asset and initial timeout
- wait for block headers to be downloaded (new signal `AcceptedBlockHeader`)
- wait for blocks to reach best headers tip before switching to masternode list sync (new signal `NotifyHeaderTip`)
- switched sync from `UpdatedBlockTip` to a combination of `AcceptedBlockHeader` and `NotifyHeaderTip`
- all blockchain-related bumps should take place only while we are still syncing blockchain, should be no such bumps after that
2017-09-03 16:30:08 +03:00
Oleg Girko
a3c8cb20df Backport Bitcoin PR#8865: Decouple peer-processing-logic from block-connection-logic (#1556)
* Make validationinterface.UpdatedBlockTip more verbose

In anticipation of making all the callbacks out of block processing
flow through it. Note that vHashes will always have something in it
since pindexFork != pindexNewTip.

* Remove duplicate nBlocksEstimate cmp (we already checked IsIBD())

* Remove CConnman parameter from ProcessNewBlock/ActivateBestChain

* Remove SyncWithWallets wrapper function

* Move net-processing logic definitions together in main.h

* Use CValidationInterface from chain logic to notify peer logic

This adds a new CValidationInterface subclass, defined in main.h,
to receive notifications of UpdatedBlockTip and use that to push
blocks to peers, instead of doing it directly from
ActivateBestChain.

* Always call UpdatedBlockTip, even if blocks were only disconnected

* Use BlockChecked signal to send reject messages from mapBlockSource
2017-07-28 17:10:10 +03:00
Oleg Girko
a9d771e497 Backport Bitcoin PR#8085: p2p: Begin encapsulation (#1537)
* net: move CBanDB and CAddrDB out of net.h/cpp

This will eventually solve a circular dependency

* net: Create CConnman to encapsulate p2p connections

* net: Move socket binding into CConnman

* net: move OpenNetworkConnection into CConnman

* net: move ban and addrman functions into CConnman

* net: Add oneshot functions to CConnman

* net: move added node functions to CConnman

* net: Add most functions needed for vNodes to CConnman

* net: handle nodesignals in CConnman

* net: Pass CConnection to wallet rather than using the global

* net: Add rpc error for missing/disabled p2p functionality

* net: Pass CConnman around as needed

* gui: add NodeID to the peer table

* net: create generic functor accessors and move vNodes to CConnman

* net: move whitelist functions into CConnman

* net: move nLastNodeId to CConnman

* net: move nLocalHostNonce to CConnman

This behavior seems to have been quite racy and broken.

Move nLocalHostNonce into CNode, and check received nonces against all
non-fully-connected nodes. If there's a match, assume we've connected
to ourself.

* net: move messageHandlerCondition to CConnman

* net: move send/recv statistics to CConnman

* net: move SendBufferSize/ReceiveFloodSize to CConnman

* net: move nLocalServices/nRelevantServices to CConnman

These are in-turn passed to CNode at connection time. This allows us to offer
different services to different peers (or test the effects of doing so).

* net: move semOutbound and semMasternodeOutbound to CConnman

* net: SocketSendData returns written size

* net: move max/max-outbound to CConnman

* net: Pass best block known height into CConnman

CConnman then passes the current best height into CNode at creation time.

This way CConnman/CNode have no dependency on main for height, and the signals
only move in one direction.

This also helps to prevent identity leakage a tiny bit. Before this change, an
attacker could theoretically make 2 connections on different interfaces. They
would connect fully on one, and only establish the initial connection on the
other. Once they receive a new block, they would relay it to your first
connection, and immediately commence the version handshake on the second. Since
the new block height is reflected immediately, they could attempt to learn
whether the two connections were correlated.

This is, of course, incredibly unlikely to work due to the small timings
involved and receipt from other senders. But it doesn't hurt to lock-in
nBestHeight at the time of connection, rather than letting the remote choose
the time.

* net: pass CClientUIInterface into CConnman

* net: Drop StartNode/StopNode and use CConnman directly

* net: Introduce CConnection::Options to avoid passing so many params

* net: add nSendBufferMaxSize/nReceiveFloodSize to CConnection::Options

* net: move vNodesDisconnected into CConnman

* Made the ForEachNode* functions in src/net.cpp more pragmatic and self documenting

* Convert ForEachNode* functions to take a templated function argument rather than a std::function to eliminate std::function overhead

* net: move MAX_FEELER_CONNECTIONS into connman
2017-07-21 12:35:19 +03:00
UdjinM6
90adb89233 Merge #903: Implement transaction lock zmq notifications
15a6a16 Implement transaction lock zmq notifications
3bc86a6 always push zmqpubhashtxlock even if tx is not from/to our wallet
568315b fix typo
b6d41d2 fix data size for notification name
339be11 implement zmqpubrawtxlock
70f44f9 update zmq_sub.py with hashtxlock and rawtxlock
2016-07-15 08:38:33 +02:00
UdjinM6
a5ac60b868 Merge remote-tracking branch 'bitcoin/0.12' into HEAD
+ merge fixes
+ keepass on evhttp
2016-02-06 16:48:04 +03:00
MarcoFalke
333e1eaeea
Bump copyright headers to 2015
- Bump copyright headers to 2015
- [devtools] Rewrite fix-copyright-headers.py
- [devtools] Use git pretty-format for year parsing

Github-Pull: #7205
Rebased-From: fa6ad855e9 fa24439ff3 fa71669452
2016-01-05 14:13:33 +01:00
Jonas Schnelli
d76a8acb9b use CBlockIndex* insted of uint256 for UpdatedBlockTip signal
- removes mapBlockIndex find operation
- theoretically allows removing the cs_main lock during zqm notification while introducing a new file position lock
2015-09-16 16:51:21 +02:00
João Barbosa
5624e055b3 Add UpdatedBlockTip signal to CMainSignals and CValidationInterface 2015-09-16 10:59:32 +01:00
Jonas Schnelli
a7b9623d18 miner: rename UpdateRequestCount signal to ResetRequestCount 2015-07-01 16:09:58 +02:00
Jonas Schnelli
5496253966 add CReserveScript to allow modular script keeping/returning
- use one CReserveScript per mining thread
2015-07-01 16:06:14 +02:00
Jonas Schnelli
d0fc10a844 detach wallet from miner 2015-06-30 21:45:46 +02:00
Michael Ford
08d9373e2f Remove unused code from wallet and validation interface
Fixes #6109
2015-05-18 17:11:06 +08:00
Philip Kaufmann
0a7bcb7e55 fix IDE/compiler warning "extra ';'" in validationinterface.h 2015-05-14 01:02:00 -04:00
Wladimir J. van der Laan
446bb70fcd
Merge pull request #5940
0f5954c Regression test for ResendWalletTransactions (Gavin Andresen)
2015-03-30 14:28:09 +02:00
Michael Ford
63e4c9cd35 Fix clang compile warnings intriduced in #5681 2015-03-29 19:45:05 +08:00
Gavin Andresen
0f5954c434
Regression test for ResendWalletTransactions
Adds a regression test for the wallet's ResendWalletTransactions function, which uses a new, hidden RPC command "resendwallettransactions."

I refactored main's Broadcast signal so it is passed the best-block time, which let me remove a global variable shared between main.cpp and the wallet (nTimeBestReceived).

I also manually tested the "rebroadcast unconfirmed every half hour or so" functionality by:

1. Running bitcoind -connect=0.0.0.0:8333
2. Creating a couple of send-to-self transactions
3. Connect to a peer using -addnode
4. Waited a while, monitoring debug.log, until I see:
```2015-03-23 18:48:10 ResendWalletTransactions: rebroadcast 2 unconfirmed transactions```

One last change: don't bother putting ResendWalletTransactions messages in debug.log unless unconfirmed transactions were actually rebroadcast.
2015-03-24 15:29:20 -04:00
Jorge Timón
26c16d9de9 Includes: Refactor: Move CValidationInterface and CMainSignals out of main 2015-03-24 17:21:41 +01:00