From f57d0d8ba18eb56895ff3b2ba2114535bd017409 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 16 Apr 2018 15:34:46 +0200 Subject: [PATCH] Ensure authorities don't disappear after block 50 (#132) * Disable CORS validation, improve logging. * Fix build from nightly API change. * Rebuilt binaries * More logs, keep validators after 50 blocks. --- polkadot/service/src/lib.rs | 2 +- polkadot/transaction-pool/src/lib.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/polkadot/service/src/lib.rs b/polkadot/service/src/lib.rs index 9c0adc23d9..2c4d4ef47c 100644 --- a/polkadot/service/src/lib.rs +++ b/polkadot/service/src/lib.rs @@ -206,7 +206,7 @@ fn local_testnet_config() -> ChainConfig { }), staking: Some(StakingConfig { current_era: 0, - intentions: vec![], + intentions: initial_authorities.clone(), transaction_fee: 1, balances: endowed_accounts.iter().map(|&k|(k, 1u64 << 60)).collect(), validator_count: 2, diff --git a/polkadot/transaction-pool/src/lib.rs b/polkadot/transaction-pool/src/lib.rs index 56534aa699..555f2a8402 100644 --- a/polkadot/transaction-pool/src/lib.rs +++ b/polkadot/transaction-pool/src/lib.rs @@ -292,6 +292,7 @@ impl<'a, T: 'a + PolkadotApi> Ready<'a, T> { impl<'a, T: 'a + PolkadotApi> transaction_pool::Ready for Ready<'a, T> { fn is_ready(&mut self, xt: &VerifiedTransaction) -> Readiness { let sender = xt.inner.signed; + trace!(target: "transaction-pool", "Checking readiness of {} (from {})", xt.hash, TransactionHash::from(sender)); // TODO: find a way to handle index error properly -- will need changes to // transaction-pool trait. @@ -299,6 +300,8 @@ impl<'a, T: 'a + PolkadotApi> transaction_pool::Ready for R let next_index = self.known_indices.entry(sender) .or_insert_with(|| api_handle.index(at_block, sender).ok().unwrap_or_else(u64::max_value)); + trace!(target: "transaction-pool", "Next index for sender is {}; xt index is {}", next_index, xt.inner.index); + match xt.inner.index.cmp(&next_index) { Ordering::Greater => Readiness::Future, Ordering::Equal => Readiness::Ready,