Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
tester_network.cpp
Go to the documentation of this file.
2
3namespace sysio { namespace testing {
4
6 if (blockchains.count(&new_blockchain))
7 return;
8
9 // If the network isn't empty, sync the new blockchain with one of the old ones. The old ones are already in sync with
10 // each other, so just grab one arbitrarily. The old blockchains are connected to the propagation signals, so when one
11 // of them gets synced, it will propagate blocks to the others as well.
12 if (!blockchains.empty()) {
13 blockchains.begin()->first->sync_with(new_blockchain);
14 }
15
16 // The new blockchain is now in sync with any old ones; go ahead and connect the propagation signal.
17
19
20 /*
21 blockchains[&new_blockchain] = new_blockchain.control->applied_block.connect(
22 [this, &new_blockchain](const chain::block_trace& bt) {
23 propagate_block(bt.block, new_blockchain);
24 });
25 */
26 }
27
29 blockchains.erase(&leaving_blockchain);
30 }
31
35
36 void tester_network::propagate_block(const signed_block &block, const base_tester &skip_blockchain) {
37 // for (const auto &pair : blockchains) {
38 // if (pair.first == &skip_blockchain) continue;
39 // boost::signals2::shared_connection_block blocker(pair.second);
40 // pair.first->control->push_block(block, sysio::chain::validation_steps::created_block);
41 // }
42 }
43
44} }
std::map< base_tester *, scoped_connection > blockchains
void disconnect_blockchain(base_tester &leaving_blockchain)
Remove a blockchain from the network.
void propagate_block(const signed_block &block, const base_tester &skip_db)
Send a block to all blockchains in this network.
void disconnect_all()
Disconnect all blockchains from the network.
void connect_blockchain(base_tester &new_blockchain)
Add a new blockchain to the network.