[beta] Cancel Transaction (#5656)

* option to disable persistent txqueue (#5544)

* option to disable persistent txqueue

* New option goes with kin

* Remove transaction RPC (#4949)

* Cancel tx JS (#4958)

* Remove transaction RPC

* Bumping multihash and libc

* Updating nanomsg

* bump nanomsg

* cancel tx

* cancel-tx-js

* cancel-tx-js

* cancel-tx-js

* cancel-tx-hs

* cancel-tx-js

* cancel-tx-js

* cancel-tx-js

* small fixes

* edit & time till submit

* edit & time till submit

* updates

* updates

* udpates

* udpates

* grumbles

* step 1

* Wonderful updates

* ready

* small refact

* small refact

* grumbles 1

* ffx2

* good ol' fashioned updates

* latest and greatest

* removeHash

* removeHash

* spec

* fix 1

* fix 1

* fix 2

* fix 2

* ff

* ff

* ff

* updates

* Updating documentation for RPCs (#5392)

* Removing minBlocks occurrencies

* Docs for new RPCs.

* Fixing linting issues, updating *withToken documentatiojn.

* Adding missing RPCs. Fixing tests.

* Fixing lint issues.
This commit is contained in:
Tomasz Drwięga
2017-05-18 15:19:29 +02:00
committed by Arkadiy Paronyan
parent 8dfc10ede9
commit 1aea9caf6d
32 changed files with 831 additions and 215 deletions

View File

@@ -6,6 +6,7 @@ auto_update = "none"
release_track = "current"
no_download = false
no_consensus = false
no_persistent_txqueue = false
chain = "homestead"
base_path = "$HOME/.parity"

View File

@@ -93,6 +93,8 @@ usage! {
flag_chain: String = "homestead", or |c: &Config| otry!(c.parity).chain.clone(),
flag_keys_path: String = "$BASE/keys", or |c: &Config| otry!(c.parity).keys_path.clone(),
flag_identity: String = "", or |c: &Config| otry!(c.parity).identity.clone(),
flag_no_persistent_txqueue: bool = false,
or |c: &Config| otry!(c.parity).no_persistent_txqueue,
// -- Account Options
flag_unlock: Option<String> = None,
@@ -370,6 +372,7 @@ struct Operating {
db_path: Option<String>,
keys_path: Option<String>,
identity: Option<String>,
no_persistent_txqueue: Option<bool>,
}
#[derive(Default, Debug, PartialEq, RustcDecodable)]
@@ -627,6 +630,7 @@ mod tests {
flag_db_path: Some("$HOME/.parity/chains".into()),
flag_keys_path: "$HOME/.parity/keys".into(),
flag_identity: "".into(),
flag_no_persistent_txqueue: false,
// -- Account Options
flag_unlock: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
@@ -828,6 +832,7 @@ mod tests {
db_path: None,
keys_path: None,
identity: None,
no_persistent_txqueue: None,
}),
account: Some(Account {
unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]),

View File

@@ -280,6 +280,9 @@ Sealing/Mining Options:
execution time limit. Also number of offending actions
have to reach the threshold within that time.
(default: {flag_tx_queue_ban_time} seconds)
--no-persistent-txqueue Don't save pending local transactions to disk to be
restored whenever the node restarts.
(default: {flag_no_persistent_txqueue}).
--remove-solved Move solved blocks from the work package queue
instead of cloning them. This gives a slightly
faster import speed, but means that extra solutions

View File

@@ -370,6 +370,7 @@ impl Configuration {
check_seal: !self.args.flag_no_seal_check,
download_old_blocks: !self.args.flag_no_ancient_blocks,
verifier_settings: verifier_settings,
no_persistent_txqueue: self.args.flag_no_persistent_txqueue,
};
Cmd::Run(run_cmd)
};
@@ -1184,6 +1185,7 @@ mod tests {
check_seal: true,
download_old_blocks: true,
verifier_settings: Default::default(),
no_persistent_txqueue: false,
};
expected.secretstore_conf.enabled = cfg!(feature = "secretstore");
assert_eq!(conf.into_command().unwrap().cmd, Cmd::Run(expected));

View File

@@ -107,6 +107,7 @@ pub struct RunCmd {
pub check_seal: bool,
pub download_old_blocks: bool,
pub verifier_settings: VerifierSettings,
pub no_persistent_txqueue: bool,
}
pub fn open_ui(dapps_conf: &dapps::Configuration, signer_conf: &signer::Configuration) -> Result<(), String> {
@@ -138,15 +139,20 @@ pub fn open_dapp(dapps_conf: &dapps::Configuration, dapp: &str) -> Result<(), St
// node info fetcher for the local store.
struct FullNodeInfo {
miner: Arc<Miner>, // TODO: only TXQ needed, just use that after decoupling.
miner: Option<Arc<Miner>>, // TODO: only TXQ needed, just use that after decoupling.
}
impl ::local_store::NodeInfo for FullNodeInfo {
fn pending_transactions(&self) -> Vec<::ethcore::transaction::PendingTransaction> {
let local_txs = self.miner.local_transactions();
self.miner.pending_transactions()
let miner = match self.miner.as_ref() {
Some(m) => m,
None => return Vec::new(),
};
let local_txs = miner.local_transactions();
miner.pending_transactions()
.into_iter()
.chain(self.miner.future_transactions())
.chain(miner.future_transactions())
.filter(|tx| local_txs.contains_key(&tx.hash()))
.collect()
}
@@ -337,11 +343,22 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
let store = {
let db = service.db();
let node_info = FullNodeInfo {
miner: miner.clone(),
miner: match cmd.no_persistent_txqueue {
true => None,
false => Some(miner.clone()),
}
};
let store = ::local_store::create(db, ::ethcore::db::COL_NODE_INFO, node_info);
if cmd.no_persistent_txqueue {
info!("Running without a persistent transaction queue.");
if let Err(e) = store.clear() {
warn!("Error clearing persistent transaction queue: {}", e);
}
}
// re-queue pending transactions.
match store.pending_transactions() {
Ok(pending) => {