-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4424 from pwojcikdev/blockprocessor-context
Blockprocessor context
- Loading branch information
Showing
25 changed files
with
258 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,28 @@ | ||
#pragma once | ||
|
||
#include <nano/lib/blocks.hpp> | ||
#include <nano/node/blockprocessor.hpp> | ||
|
||
#include <memory> | ||
#include <unordered_set> | ||
|
||
namespace nano | ||
{ | ||
class block_arrival; | ||
class block_processor; | ||
class network; | ||
|
||
// This class tracks blocks that originated from this node. | ||
class block_broadcast | ||
{ | ||
public: | ||
block_broadcast (nano::network & network, nano::block_arrival & block_arrival, bool enabled = false); | ||
block_broadcast (nano::network & network, bool enabled = false); | ||
// Add batch_processed observer to block_processor if enabled | ||
void connect (nano::block_processor & block_processor); | ||
// Mark a block as originating locally | ||
void set_local (std::shared_ptr<nano::block> block); | ||
void erase (std::shared_ptr<nano::block> block); | ||
|
||
private: | ||
// Block_processor observer | ||
void observe (std::shared_ptr<nano::block> block); | ||
void observe (nano::block_processor::context const &); | ||
|
||
nano::network & network; | ||
nano::block_arrival & block_arrival; | ||
std::unordered_set<std::shared_ptr<nano::block>> local; // Blocks originated on this node | ||
nano::mutex mutex; | ||
bool enabled; | ||
}; | ||
} |
Oops, something went wrong.