From 552df8ac4d83b68468a4178c49d81f58b12fed91 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Thu, 5 May 2022 16:12:26 +0200 Subject: [PATCH] Adapt the doc single-cancel wording to multi-cancel --- doc/API.md | 4 ++-- src/bitcoind/poller.rs | 8 ++++---- src/bitcoind/utils.rs | 2 +- src/commands/mod.rs | 5 +++-- src/jsonrpc/api.rs | 2 +- src/revaultd.rs | 4 ++-- tests/test_rpc.py | 4 ++-- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/doc/API.md b/doc/API.md index 6340aeba..35091670 100644 --- a/doc/API.md +++ b/doc/API.md @@ -121,8 +121,8 @@ Retrieve the status of the servers, such as the coordinator, the cosigners, the | 5 | `active` | Everyone signed and shared the Unvault transaction signature for this vault | | 6 | `unvaulting` | The vault has its unvault tx broadcasted | | 7 | `unvaulted` | The vault has its unvault tx confirmed | -| 8 | `cancelling` | The vault has its cancel tx broadcasted, funds are sent to an other vault | -| 9 | `cancelled` | The vault has its cancel tx confirmed, funds are in an other vault | +| 8 | `cancelling` | The vault has one cancel tx broadcasted, funds are sent to an other vault | +| 9 | `cancelled` | The vault has one cancel tx confirmed, funds are in an other vault | | 4 / 8 | `emergency_vaulting` | The vault has its emergency tx broadcasted, funds are sent to the Deep Emergency Vault | | 5 / 9 | `emergency_vaulted` | The vault has its emergency tx confirmed, funds are in the Deep Emergency Vault | | 8 | `spendable` | The vault has its unvault tx timelock expired and can be spent | diff --git a/src/bitcoind/poller.rs b/src/bitcoind/poller.rs index d8787d35..977f4378 100644 --- a/src/bitcoind/poller.rs +++ b/src/bitcoind/poller.rs @@ -1113,7 +1113,7 @@ fn update_tip( // Which kind of transaction may spend the Unvault transaction. #[derive(Debug)] enum UnvaultSpender { - // The Cancel, spending via the stakeholders path to a new deposit + // A Cancel, spending via the stakeholders path to a new deposit Cancel(Txid), // The Spend, any transaction spending via the managers path Spend(Txid), @@ -1160,12 +1160,12 @@ fn unvault_spender( // FIXME: be smarter, all the information are in the previous call, no need for a // second one. - // Let's double-check that we didn't fetch the cancel, nor the unemer - // In theory (read edge cases), the Cancel and UnEmer could have not been + // Let's double-check that we didn't fetch a cancel, nor the unemer + // In theory (read edge cases), a Cancel and UnEmer could have not been // current at the last bitcoind poll but could be now. // Be sure to not wrongly mark a Cancel or UnEmer as a Spend! if cancel_txids.contains(&spender_txid) || Some(spender_txid) == unemer_txid { - // Alright, the spender is the cancel or the unemer, + // Alright, the spender is a cancel or the unemer, // but we just checked and they weren't current. We'll return None // so the checker will call this function again. return Ok(None); diff --git a/src/bitcoind/utils.rs b/src/bitcoind/utils.rs index 545e5d2c..a0d9f218 100644 --- a/src/bitcoind/utils.rs +++ b/src/bitcoind/utils.rs @@ -49,7 +49,7 @@ pub fn presigned_transactions( })?; // Reconstruct the deposit UTXO and derive all pre-signed transactions out of it - // if we are a stakeholder, and only the Unvault and the Cancel if we are a manager. + // if we are a stakeholder, and only the Unvault and the Cancels if we are a manager. if revaultd.is_stakeholder() { let emer_address = revaultd .emergency_address diff --git a/src/commands/mod.rs b/src/commands/mod.rs index f7eed251..c4098dbc 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1339,7 +1339,8 @@ impl DaemonControl { Ok(()) } - /// Broadcast the Cancel transaction for an unvaulted vault. + /// Broadcast a Cancel transaction for an unvaulted vault. Currently picks the lower feerate + /// one. /// /// ## Errors /// - If the outpoint doesn't refer to an existing, unvaulted (or unvaulting) vault @@ -1349,7 +1350,7 @@ impl DaemonControl { let db_path = revaultd.db_file(); // Checking that the vault is secured, otherwise we don't have the cancel - // transaction + // transactions let vault = db_vault_by_deposit(&db_path, &deposit_outpoint) .expect("Database must be accessible") .ok_or_else(|| CommandError::UnknownOutpoint(deposit_outpoint))?; diff --git a/src/jsonrpc/api.rs b/src/jsonrpc/api.rs index 7485df46..0f696cac 100644 --- a/src/jsonrpc/api.rs +++ b/src/jsonrpc/api.rs @@ -97,7 +97,7 @@ pub trait RpcApi { index: Option, ) -> jsonrpc_core::Result; - /// Get the cancel and both emergency transactions for a vault identified by its deposit + /// Get the cancels and both emergency transactions for a vault identified by its deposit /// outpoint. #[rpc(meta, name = "getrevocationtxs")] fn getrevocationtxs( diff --git a/src/revaultd.rs b/src/revaultd.rs index c389a9ef..75b7efc8 100644 --- a/src/revaultd.rs +++ b/src/revaultd.rs @@ -56,9 +56,9 @@ pub enum VaultStatus { Unvaulting, /// The unvault transaction is confirmed Unvaulted, - /// The cancel transaction has been broadcast + /// A cancel transaction has been broadcast Canceling, - /// The cancel transaction is confirmed + /// A cancel transaction is confirmed Canceled, /// The first emergency transactions has been broadcast EmergencyVaulting, diff --git a/tests/test_rpc.py b/tests/test_rpc.py index 0b104d0f..55d6582d 100644 --- a/tests/test_rpc.py +++ b/tests/test_rpc.py @@ -970,7 +970,7 @@ def test_getspendtx(revault_network, bitcoind): @pytest.mark.skipif(not POSTGRES_IS_SETUP, reason="Needs Postgres for servers db") def test_revault_command(revault_network, bitcoind, executor): """ - Here we manually broadcast the unvualt_tx, followed by the cancel_tx + Here we manually broadcast the unvualt_tx, followed by a cancel_tx """ revault_network.deploy(3, 1) man = revault_network.man(0) @@ -1019,7 +1019,7 @@ def test_revault_command(revault_network, bitcoind, executor): == "unvaulting" ) - # Nah it's not, just broadcast the cancel + # Nah it's not, just broadcast a cancel man.rpc.revault(deposit) # Not confirmed yet...