Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.
This repository was 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

@Sjors

Description

@Sjors

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions