-
-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
bugSomething isn't workingSomething isn't working
Description
reporting an issue mentioned in #196:
The TransferCommand::Combine CLI command seems to have a bug: in
let blank_bundle = TransitionBundle::blank(&outpoint_map, &bmap! {})?;
for (transition, indexes) in blank_bundle.revealed_iter() {
psbt.push_rgb_transition(transition.clone())?;
for no in indexes {
psbt.inputs[*no as usize]
.set_rgb_consumer(cid, transition.node_id())?;
}
}psbt.inputs[*no as usize] can sometimes fail depending on the input outpoint vout value and the number of psbt inputs. This happens because no is the vout of an outpoint, which is not the position of the outpoint in the psbt.inputs vector:
fn blank(
prev_state: &BTreeMap<OutPoint, BTreeSet<OutpointState>>,
new_outpoints: &BTreeMap<OwnedRightType, (OutPoint, CloseMethod)>,
) -> Result<TransitionBundle, Error> {
let mut transitions: BTreeMap<Transition, BTreeSet<u16>> = bmap! {};
for (tx_outpoint, inputs) in prev_state {
// [...]
transitions.insert(transition, bset! { tx_outpoint.vout as u16 });
}
TransitionBundle::try_from(transitions).map_err(Error::from)
}I think a fix could be to insert the outpoint in transitions in its entirety instead of just its vout, but I also see other ways to fix this so I would appreciate a suggestion from @dr-orlovsky here
cryptoquick
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working