Skip to content

Commit

Permalink
Merge pull request #29 from RGB-WG/fix/force-accept
Browse files Browse the repository at this point in the history
Fix force accept of invalid consignments
  • Loading branch information
dr-orlovsky authored Oct 23, 2023
2 parents 3ab17e7 + 581ebed commit 083d5f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/bin/rgb/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,16 @@ impl Command {
}
Command::Accept { force, file } => {
let bindle = Bindle::<Transfer>::load(file)?;
let transfer = bindle.unbindle().validate(resolver).unwrap_or_else(|c| c);
let transfer = bindle.unbindle().validate(resolver).or_else(|c| {
if force {
Ok(c)
} else {
Err(RuntimeError::InvalidConsignment(
c.into_validation_status()
.expect("consignment must have status after the validation"),
))
}
})?;
eprintln!("{}", transfer.validation_status().expect("just validated"));
runtime.accept_transfer(transfer, resolver, force)?;
eprintln!("Transfer accepted into the stash");
Expand Down

0 comments on commit 083d5f0

Please sign in to comment.