Lots of chain sync and block validation fixes

* Fix for the chain pipeline partly relying on an outdated head,
leading to not properly recognizing a fork and inconsistent sum
tree state.
* Do not drop block requests during sync that don't get satisfied,
retry enough time to get them and avoid stall.
* Always validate header, even in sync where we may have validated
it already. We don't want a block coming from a peer that could
squeeze through with an invalid header.
* When syncing, do not mark blocks that were errored by the chain
as received (typical case: orphan). Keep retrying.
* Improved chain state dump for debugging.
* Do not add to orphans blocks too far in the future.
* Better error reporting on db errors.
* Related sync test fixes.

TODO figure out why syncing peers timeout so often, very useful
to test but not that great for a fast sync experience.
This commit is contained in:
Ignotus Peverell
2017-10-22 07:11:45 +00:00
parent f12559f53b
commit f1488f9529
11 changed files with 183 additions and 143 deletions
+15 -17
View File
@@ -392,11 +392,12 @@ fn wallet_command(wallet_args: &ArgMatches) {
.expect("Amount to send required")
.parse()
.expect("Could not parse amount as a whole number.");
let minimum_confirmations: u64 = send_args
.value_of("minimum_confirmations")
.unwrap_or("1")
.parse()
.expect("Could not parse minimum_confirmations as a whole number.");
let minimum_confirmations: u64 =
send_args
.value_of("minimum_confirmations")
.unwrap_or("1")
.parse()
.expect("Could not parse minimum_confirmations as a whole number.");
let mut dest = "stdout";
if let Some(d) = send_args.value_of("dest") {
dest = d;
@@ -406,7 +407,7 @@ fn wallet_command(wallet_args: &ArgMatches) {
&keychain,
amount,
minimum_confirmations,
dest.to_string()
dest.to_string(),
).unwrap();
}
("burn", Some(send_args)) => {
@@ -415,17 +416,14 @@ fn wallet_command(wallet_args: &ArgMatches) {
.expect("Amount to burn required")
.parse()
.expect("Could not parse amount as a whole number.");
let minimum_confirmations: u64 = send_args
.value_of("minimum_confirmations")
.unwrap_or("1")
.parse()
.expect("Could not parse minimum_confirmations as a whole number.");
wallet::issue_burn_tx(
&wallet_config,
&keychain,
amount,
minimum_confirmations,
).unwrap();
let minimum_confirmations: u64 =
send_args
.value_of("minimum_confirmations")
.unwrap_or("1")
.parse()
.expect("Could not parse minimum_confirmations as a whole number.");
wallet::issue_burn_tx(&wallet_config, &keychain, amount, minimum_confirmations)
.unwrap();
}
("info", Some(_)) => {
wallet::show_info(&wallet_config, &keychain);