From b3440babe32d0aa76f6df45ce0050bf0bae96f17 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Wed, 8 Feb 2017 19:21:12 +0100 Subject: [PATCH] light txq skeleton --- ethcore/light/src/lib.rs | 1 + ethcore/light/src/transaction_queue.rs | 55 ++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 ethcore/light/src/transaction_queue.rs diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 6236ba118..7f1a85cad 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -36,6 +36,7 @@ pub mod client; pub mod cht; pub mod net; pub mod on_demand; +pub mod transaction_queue; #[cfg(not(feature = "ipc"))] pub mod provider; diff --git a/ethcore/light/src/transaction_queue.rs b/ethcore/light/src/transaction_queue.rs new file mode 100644 index 000000000..c9afc4a2c --- /dev/null +++ b/ethcore/light/src/transaction_queue.rs @@ -0,0 +1,55 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +//! Light Transaction Queue. +//! +//! Manages local transactions, +//! but stores all local transactions, removing only on invalidated nonce. +//! +//! Under the assumption that light nodes will have a relatively limited set of +//! accounts for which they create transactions, this queue is structured in an +//! address-wise manner. + +use ethcore::transaction::PendingTransaction; +use util::{Address, U256}; + +/// Light transaction queue. See module docs for more details. +pub struct TransactionQueue; + +impl TransactionQueue { + /// Insert a pending transaction to be queued. + pub fn insert(&mut self, tx: PendingTransaction) { + unimplemented!() + } + + /// Get the next nonce for a given address based on what's within the queue. + /// If the address has no queued transactions + pub fn next_nonce(&mut self, address: &Address) -> Option { + unimplemented!() + } + + /// Get pending transactions, ready to be propagated. + /// `best_block_number` and `best_block_timestamp` are used to filter out conditionally + /// propagated transactions. + pub fn pending_transactions(&self, best_block_number: u64, best_block_timestamp: u64) -> Vec { + unimplemented!() + } + + /// Cull out all transactions by the given address which are invalidated by the given nonce. + pub fn cull(&mut self, address: Address, last_nonce: U256) { + unimplemented!() + } +}