only add transactions to signing-queue if it is enabled (#11272)

* only add transactions to signing-queue if it is enabled

* Update rpc/src/v1/helpers/errors.rs

Co-Authored-By: David <dvdplm@gmail.com>

* use errors::codes::ACCOUNT_LOCKED

* bail early if account isn't unlocked

* use errors::signing

* Update rpc/src/v1/helpers/errors.rs

* Update rpc/src/v1/helpers/errors.rs

* test

* adds cli flag to enable signing queue.

* use helper method siginig_queue_disabled instead of accounts::SignError

* fix typo, use raw i64

* fixed tests
This commit is contained in:
Seun LanLege
2019-12-05 09:38:14 +01:00
committed by David
parent f6c3d4c695
commit 80a83c95d3
7 changed files with 104 additions and 21 deletions

View File

@@ -348,6 +348,10 @@ usage! {
"--unlock=[ACCOUNTS]",
"Unlock ACCOUNTS for the duration of the execution. ACCOUNTS is a comma-delimited list of addresses.",
ARG arg_enable_signing_queue: (bool) = false, or |c: &Config| c.account.as_ref()?.enable_signing_queue,
"--enable-signing-queue=[BOOLEAN]",
"Enables the signing queue for external transaction signing either via CLI or personal_unlockAccount, turned off by default.",
ARG arg_password: (Vec<String>) = Vec::new(), or |c: &Config| c.account.as_ref()?.password.clone(),
"--password=[FILE]...",
"Provide a file containing a password for unlocking an account. Leading and trailing whitespace is trimmed.",
@@ -1194,6 +1198,7 @@ struct Operating {
#[serde(deny_unknown_fields)]
struct Account {
unlock: Option<Vec<String>>,
enable_signing_queue: Option<bool>,
password: Option<Vec<String>>,
keys_iterations: Option<u32>,
refresh_time: Option<u64>,
@@ -1728,6 +1733,7 @@ mod tests {
arg_restore_file: None,
arg_tools_hash_file: None,
arg_enable_signing_queue: false,
arg_signer_sign_id: None,
arg_signer_reject_id: None,
arg_dapp_path: None,
@@ -2045,6 +2051,7 @@ mod tests {
_legacy_public_node: None,
}),
account: Some(Account {
enable_signing_queue: None,
unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]),
password: Some(vec!["passwdfile path".into()]),
keys_iterations: None,