Cancel tx should set output status to Unspent (#2368)

* cancelling transaction should reset output status to Unspent

* rustfmt
This commit is contained in:
Yeastplume 2019-01-13 22:24:01 +00:00 committed by GitHub
parent e3a1c2c6b1
commit 5fcf93deae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -465,6 +465,30 @@ mod wallet_tests {
let arg_vec = vec!["grin", "wallet", "-p", "password", "check"];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
// Another file exchange, cancel this time
let arg_vec = vec![
"grin",
"wallet",
"-p",
"password",
"-a",
"mining",
"send",
"-m",
"file",
"-d",
&file_name,
"-g",
"Ain't sending 2",
"10",
];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
let arg_vec = vec![
"grin", "wallet", "-p", "password", "-a", "mining", "cancel", "-i", "26",
];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
// txs and outputs (mostly spit out for a visual in test logs)
let arg_vec = vec!["grin", "wallet", "-p", "password", "-a", "mining", "txs"];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;

View file

@ -202,7 +202,7 @@ where
batch.delete(&o.key_id, &o.mmr_index)?;
}
if o.status == OutputStatus::Locked {
o.status = OutputStatus::Unconfirmed;
o.status = OutputStatus::Unspent;
batch.save(o)?;
}
}