mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-11-23 15:44:20 +01:00
addition of self-spend cancel + tests (#699)
This commit is contained in:
@@ -363,8 +363,12 @@ where
|
||||
return Err(Error::TransactionDoesntExist(tx_id_string));
|
||||
}
|
||||
let tx = tx_vec[0].clone();
|
||||
debug!("cancel_tx: tx: {}", tx.tx_type);
|
||||
match tx.tx_type {
|
||||
TxLogEntryType::TxSent | TxLogEntryType::TxReceived | TxLogEntryType::TxReverted => {}
|
||||
TxLogEntryType::TxSent
|
||||
| TxLogEntryType::TxReceived
|
||||
| TxLogEntryType::TxReverted
|
||||
| TxLogEntryType::TxSelfSpend => {}
|
||||
_ => return Err(Error::TransactionNotCancellable(tx_id_string)),
|
||||
}
|
||||
if tx.confirmed {
|
||||
|
||||
@@ -112,6 +112,7 @@ where
|
||||
if v {
|
||||
tx_entry.tx_type != TxLogEntryType::TxReceivedCancelled
|
||||
&& tx_entry.tx_type != TxLogEntryType::TxSentCancelled
|
||||
&& tx_entry.tx_type != TxLogEntryType::TxSelfSpendCancelled
|
||||
} else {
|
||||
true
|
||||
}
|
||||
@@ -491,6 +492,7 @@ where
|
||||
TxLogEntryType::TxReceived | TxLogEntryType::TxReverted => {
|
||||
tx.tx_type = TxLogEntryType::TxReceivedCancelled
|
||||
}
|
||||
TxLogEntryType::TxSelfSpend => tx.tx_type = TxLogEntryType::TxSelfSpendCancelled,
|
||||
_ => {}
|
||||
}
|
||||
batch.save_tx_log_entry(tx, parent_key_id)?;
|
||||
|
||||
Reference in New Issue
Block a user