-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
src/subcommand/wallet/inscribe.rs
Outdated
@@ -70,6 +73,32 @@ impl Inscribe { | |||
Ok(()) | |||
} | |||
|
|||
fn choose_satpoint( |
There was a problem hiding this comment.
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
let cardinal_utxos = utxos | ||
.iter() | ||
.map(|(outpoint, _)| *outpoint) | ||
.filter(|outpoint| !inscribed_utxos.contains(outpoint)) | ||
.collect::<Vec<OutPoint>>(); | ||
|
||
match cardinal_utxos.first() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() { |
src/subcommand/wallet/inscribe.rs
Outdated
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")), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"))? |
Fixes #905