Skip to content

Commit

Permalink
Adapt the doc single-cancel wording to multi-cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
darosior committed May 5, 2022
1 parent 053cdff commit a2fc9dc
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
8 changes: 4 additions & 4 deletions src/bitcoind/poller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoind/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))?;
Expand Down
2 changes: 1 addition & 1 deletion src/jsonrpc/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub trait RpcApi {
index: Option<bip32::ChildNumber>,
) -> jsonrpc_core::Result<serde_json::Value>;

/// 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(
Expand Down
4 changes: 2 additions & 2 deletions src/revaultd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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...
Expand Down

0 comments on commit a2fc9dc

Please sign in to comment.