Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow inscribing without specifying satpoint #919

Merged
merged 5 commits into from
Dec 8, 2022

Conversation

raphjaph
Copy link
Collaborator

@raphjaph raphjaph commented Dec 8, 2022

Fixes #905

@raphjaph raphjaph requested a review from casey December 8, 2022 21:24
src/subcommand/wallet/inscribe.rs Outdated Show resolved Hide resolved
@@ -70,6 +73,32 @@ impl Inscribe {
Ok(())
}

fn choose_satpoint(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add tests for all three cases:

  • Some
  • None and blank UTXO is found
  • None and blank UTXO is not found

src/subcommand/wallet/inscribe.rs Outdated Show resolved Hide resolved
Comment on lines 91 to 97
let cardinal_utxos = utxos
.iter()
.map(|(outpoint, _)| *outpoint)
.filter(|outpoint| !inscribed_utxos.contains(outpoint))
.collect::<Vec<OutPoint>>();

match cardinal_utxos.first() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let cardinal_utxos = utxos
.iter()
.map(|(outpoint, _)| *outpoint)
.filter(|outpoint| !inscribed_utxos.contains(outpoint))
.collect::<Vec<OutPoint>>();
match cardinal_utxos.first() {
match utxos
.iter()
.map(|(outpoint, _)| *outpoint)
.filter(|outpoint| !inscribed_utxos.contains(outpoint)).next() {

Comment on lines 91 to 101
match utxos
.iter()
.map(|(outpoint, _)| *outpoint)
.find(|outpoint| !inscribed_utxos.contains(outpoint))
{
Some(outpoint) => SatPoint {
outpoint,
offset: 0,
},
None => return Err(anyhow!("wallet contains no cardinal utxos")),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
match utxos
.iter()
.map(|(outpoint, _)| *outpoint)
.find(|outpoint| !inscribed_utxos.contains(outpoint))
{
Some(outpoint) => SatPoint {
outpoint,
offset: 0,
},
None => return Err(anyhow!("wallet contains no cardinal utxos")),
}
utxos
.iter()
.map(|(outpoint, _)| *outpoint)
.find(|outpoint| !inscribed_utxos.contains(outpoint))
.map(|outpoint| SatPoint {
outpoint,
offset: 0,
})
.ok_or_else(|| anyhow!("wallet contains no cardinal utxos"))?

@casey casey self-requested a review December 8, 2022 22:52
@casey casey enabled auto-merge (squash) December 8, 2022 22:53
@casey casey merged commit 91b013e into ordinals:master Dec 8, 2022
@raphjaph raphjaph deleted the inscribe-default-satpoint branch May 1, 2023 18:39
popcnt1 pushed a commit to popcnt1/ord that referenced this pull request Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow inscribing without specifying a statpoint
2 participants