Transaction timestamp condition (#4419)

* Transaction timestamp condtiion

* Updated docs

* Updated docs

* Check agains last block timestamp
This commit is contained in:
Arkadiy Paronyan
2017-02-03 19:32:10 +01:00
committed by GitHub
parent 85e9091b29
commit 312aa72747
28 changed files with 224 additions and 110 deletions

View File

@@ -1406,7 +1406,11 @@ impl BlockChainClient for Client {
}
fn ready_transactions(&self) -> Vec<PendingTransaction> {
self.miner.ready_transactions(self.chain.read().best_block_number())
let (number, timestamp) = {
let chain = self.chain.read();
(chain.best_block_number(), chain.best_block_timestamp())
};
self.miner.ready_transactions(number, timestamp)
}
fn queue_consensus_message(&self, message: Bytes) {

View File

@@ -669,12 +669,14 @@ impl BlockChainClient for TestBlockChainClient {
}
fn chain_info(&self) -> BlockChainInfo {
let number = self.blocks.read().len() as BlockNumber - 1;
BlockChainInfo {
total_difficulty: *self.difficulty.read(),
pending_total_difficulty: *self.difficulty.read(),
genesis_hash: self.genesis_hash.clone(),
best_block_hash: self.last_hash.read().clone(),
best_block_number: self.blocks.read().len() as BlockNumber - 1,
best_block_number: number,
best_block_timestamp: number,
first_block_hash: self.first_block.read().as_ref().map(|x| x.0),
first_block_number: self.first_block.read().as_ref().map(|x| x.1),
ancient_block_hash: self.ancient_block.read().as_ref().map(|x| x.0),
@@ -709,7 +711,8 @@ impl BlockChainClient for TestBlockChainClient {
}
fn ready_transactions(&self) -> Vec<PendingTransaction> {
self.miner.ready_transactions(self.chain_info().best_block_number)
let info = self.chain_info();
self.miner.ready_transactions(info.best_block_number, info.best_block_timestamp)
}
fn signing_network_id(&self) -> Option<u64> { None }