use of org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode in project besu by hyperledger.
the class Cluster method start.
public void start(final List<? extends RunnableNode> nodes) {
if (nodes.isEmpty()) {
throw new IllegalArgumentException("Can't start a cluster with no nodes");
}
this.originalNodes = nodes;
this.nodes.clear();
this.bootnodes.clear();
nodes.forEach(node -> this.nodes.put(node.getName(), node));
final Optional<? extends RunnableNode> bootnode = selectAndStartBootnode(nodes);
nodes.parallelStream().filter(node -> {
LOG.info("starting non-bootnode {}", node.getName());
return bootnode.map(boot -> boot != node).orElse(true);
}).forEach(this::startNode);
if (clusterConfiguration.isAwaitPeerDiscovery()) {
for (final RunnableNode node : nodes) {
LOG.info("Awaiting peer discovery for node {}, expecting {} peers", node.getName(), nodes.size() - 1);
node.awaitPeerDiscovery(net.awaitPeerCount(nodes.size() - 1));
}
}
LOG.info("Cluster startup complete.");
}
use of org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode in project besu by hyperledger.
the class Cluster method addNode.
public void addNode(final Node node) {
assertThat(node).isInstanceOf(RunnableNode.class);
final RunnableNode runnableNode = (RunnableNode) node;
nodes.put(runnableNode.getName(), runnableNode);
startNode(runnableNode);
if (clusterConfiguration.isAwaitPeerDiscovery()) {
runnableNode.awaitPeerDiscovery(net.awaitPeerCount(nodes.size() - 1));
}
}
use of org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode in project besu by hyperledger.
the class QbftValidatorContractConfigFactory method buildContractStorageConfig.
private Map<String, String> buildContractStorageConfig(final Collection<? extends RunnableNode> validators) {
final List<String> addresses = validators.stream().map(RunnableNode::getAddress).map(Bytes::toUnprefixedHexString).map(hex -> (padZero(0) + hex).substring(hex.length())).collect(toList());
final Map<String, String> storageValues = new LinkedHashMap<>();
// zero location is size of array
storageValues.put(padZero(0), padZero(addresses.size()));
// further locations are allocation of addresses to array
for (int i = 0; i < addresses.size(); i++) {
final BigInteger varStorage = ARRAY_ADDR.add(BigInteger.valueOf(i));
storageValues.put(varStorage.toString(16), addresses.get(i));
}
return storageValues;
}
use of org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode in project besu by hyperledger.
the class Cluster method close.
@Override
public void close() {
stop();
for (final RunnableNode node : nodes.values()) {
node.close();
}
besuNodeRunner.shutdown();
}
Aggregations