Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Bug: initial_owner_utxo default might fail if taken by --issuance_utxo #9

Open
Sjors opened this issue Jan 28, 2019 · 0 comments
Open

Comments

@Sjors
Copy link

Sjors commented Jan 28, 2019

In asset.rs the following logic is brittle:

        let issuance_utxo: OutPoint = match matches.value_of("issuance_utxo") {
            Some(utxo) => {
                let parts: Vec<&str> = utxo.split(":").collect();

                OutPoint {
                    txid: Sha256dHash::from_hex(parts[0]).unwrap(),
                    vout: parts[1].parse().unwrap(),
                }
            }
            None => *unspent_utxos_outpoints[0].clone()
        };

        let initial_owner_utxo: OutPoint = match matches.value_of("initial_owner_utxo") {
            Some(utxo) => {
                let parts: Vec<&str> = utxo.split(":").collect();

                OutPoint {
                    txid: Sha256dHash::from_hex(parts[0]).unwrap(),
                    vout: parts[1].parse().unwrap(),
                }
            }
            None => *unspent_utxos_outpoints[1].clone()
        };

It picks the first unused UTXO if --issuance_utxo is not given. That's fine. But then it picks the second unused UTXO if --initial_owner_utxo is not set. That should lead to problems if --issuance_utxo happened to have just snatched that UTXO.

Unless there's some magic I'm missing.

@Sjors Sjors changed the title Bug: initial_owner_utxo default will fail if taken by --issuance_utxo Bug: initial_owner_utxo default might fail if taken by --issuance_utxo Jan 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant