Store the header for the current chain head and total difficulty to avoid RocksDB lookups when requesting those common values.
Also uses that cache to avoid a database lookup when checking if a block has already been imported if the block's parent is the current chain head.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* [PAN-1878] Provide error message when invalid key specified in key file
- display explicit message when invalid key file is specified
* Update KeyPairUtilTest.java
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
DebugTraceBlockByNumber now requires hex numbers as input instead of decimal and supports shortcuts like 'latest' consistent with other methods like EthGetBlockByNumber.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Moves init code into a separate builder instead of a static init method, with common code in an abstract base class and subclasses of the builder for each of the consensus variants.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Default values are currently unchanged but increasing both these values to 4 appears to improve sync performance for both ropsten and Mainnet fast syncs.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Implement max message size rather then cap with fixed number of transactions
Adding transactions to the RLP until the message size exceeds the limit and then send that.
* fix final variables
* Update AbstractRLPOutput.java
add javadoc
* pr discussion
put this factory method on LimitedTransactionsMessages rather than TransactionsMessage since it returns a LimitedTransactionsMessages.
* SpotlessApply
* fix PR discussion
- simplify design
- remove useless code
* Update LimitedTransactionsMessages.java
* fix PR discussion
- simplify logic
- add tests
* Update AbstractRLPOutput.java
* Update ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/messages/LimitedTransactionsMessages.java
Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>
* Update Transaction.java
* fix PR discussion
* fix PR discussion
- add tests
* Update BlockDataGenerator.java
* Update LimitedTransactionsMessagesTest.java
fix PR unit test
* Update LimitedTransactionsMessagesTest.java
* Update LimitedTransactionsMessagesTest.java
Use LinkedHashSet to preserve order.
* Update LimitedTransactionsMessagesTest.java
* follow up PR
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
It turns out we don't have the p2p host and port at RPC initialization.
To fix this change to query hosts and ports at method invocaiton time
instead of whent he constructor is called.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
It's now entirely handled through settings in the genesis config which --network DEV handles so no need for an additional boolean devMode flag.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Introduce a pipeline based full sync process. Currently toggled off but can be enabled via a --X option.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Implement max message size rather then cap with fixed number of transactions
Adding transactions to the RLP until the message size exceeds the limit and then send that.
* fix final variables
* Update AbstractRLPOutput.java
add javadoc
* pr discussion
put this factory method on LimitedTransactionsMessages rather than TransactionsMessage since it returns a LimitedTransactionsMessages.
* SpotlessApply
* fix PR discussion
- simplify design
- remove useless code
* Update LimitedTransactionsMessages.java
* fix PR discussion
- simplify logic
- add tests
* Update AbstractRLPOutput.java
* Update ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/messages/LimitedTransactionsMessages.java
Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>
* Update Transaction.java
* fix PR discussion
* fix PR discussion
- add tests
* Update BlockDataGenerator.java
* Update LimitedTransactionsMessagesTest.java
fix PR unit test
* Update LimitedTransactionsMessagesTest.java
* Update LimitedTransactionsMessagesTest.java
Use LinkedHashSet to preserve order.
* Update LimitedTransactionsMessagesTest.java
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Implemented a JSON RPC method "net_services" that takes no input
parameter and returns an object
containing a list of enabled services (jsonrpc, p2p, ws, metrics) with
"host" and "port", as show below;
{
"id":1,
"jsonrpc": "2.0",
"result": {
"jsonrpc": {"host": "127.0.0.1", "port":3000},
"p2p":{"host": "127.0.0.1", "port":3000},
"ws":{"host": "127.0.0.1", "port":3000},
"metrics":{"host": "127.0.0.1", "port":3000}
}
}
In case a service is not enabled, that will not be included in the list;
{
"id":1,
"jsonrpc": "2.0",
"result": {}
}
Fixes PAN-2485
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Increase total difficulty threshold required to switch sync targets.
Increase threshold for changing sync target based on height to 200.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Use default enclave public key to generate eea_getTransactionReceipt
* Update the docs to reflect the changes
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>