diff --git a/src/subcommand/wallet/resume.rs b/src/subcommand/wallet/resume.rs index 7a59df706b..3cea3f0fa4 100644 --- a/src/subcommand/wallet/resume.rs +++ b/src/subcommand/wallet/resume.rs @@ -27,7 +27,7 @@ impl Resume { continue; }; - if wallet.is_mature(&entry.commit)? { + if wallet.is_mature(rune, &entry.commit)? { etchings.push(wallet.send_etching(rune, &entry)?); } } diff --git a/src/wallet.rs b/src/wallet.rs index 9b066d68cc..5a4f7b9411 100644 --- a/src/wallet.rs +++ b/src/wallet.rs @@ -296,7 +296,7 @@ impl Wallet { self.settings.integration_test() } - pub(crate) fn is_mature(&self, commit: &Transaction) -> Result { + pub(crate) fn is_mature(&self, rune: Rune, commit: &Transaction) -> Result { let transaction = self .bitcoin_client() .get_transaction(&commit.txid(), Some(true)) @@ -315,6 +315,7 @@ impl Wallet { return Ok(true); } } else { + self.clear_etching(rune)?; bail!("rune commitment spent, can't send reveal tx"); } } @@ -340,7 +341,7 @@ impl Wallet { return Ok(entry.output); } - if self.is_mature(&entry.commit)? { + if self.is_mature(rune, &entry.commit)? { break; }