From 5fcf93deaeee6b534df14e0cc3de18a27e6b2402 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Sun, 13 Jan 2019 22:24:01 +0000 Subject: [PATCH] Cancel tx should set output status to Unspent (#2368) * cancelling transaction should reset output status to Unspent * rustfmt --- src/bin/cmd/wallet_tests.rs | 24 ++++++++++++++++++++++++ wallet/src/libwallet/internal/updater.rs | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/bin/cmd/wallet_tests.rs b/src/bin/cmd/wallet_tests.rs index 7a091f3c8..a71195369 100644 --- a/src/bin/cmd/wallet_tests.rs +++ b/src/bin/cmd/wallet_tests.rs @@ -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)?; diff --git a/wallet/src/libwallet/internal/updater.rs b/wallet/src/libwallet/internal/updater.rs index 8ab9a16ad..3b4fd185f 100644 --- a/wallet/src/libwallet/internal/updater.rs +++ b/wallet/src/libwallet/internal/updater.rs @@ -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)?; } }