Skip to content

Commit

Permalink
Fix delegate_and_spend_share_same_tx test
Browse files Browse the repository at this point in the history
  • Loading branch information
azarovh committed Feb 6, 2024
1 parent 0b8310d commit 8b47b8a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions chainstate/test-suite/src/tests/delegation_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,6 @@ fn delegate_and_spend_share_same_tx(
.build();

let (_, _, delegation_id, _, transfer_outpoint) = prepare_delegation(&mut rng, &mut tf);
//let available_amount = get_coin_amount_from_outpoint(&tf.storage, &transfer_outpoint);
let available_amount = Amount::from_atoms(1000);
let amount_to_delegate = (available_amount / 2).unwrap();
let change = (available_amount - amount_to_delegate).unwrap();
Expand Down Expand Up @@ -964,11 +963,10 @@ fn delegate_and_spend_share_same_tx(
.unwrap();
assert_eq!(amount_to_delegate, original_delegation_balance);

// try spending in an single input original balance and newly delegated amount
let amount_to_spend = Amount::from_atoms(rng.gen_range(
original_delegation_balance.into_atoms()
..=(original_delegation_balance + change).unwrap().into_atoms(),
));
// try spending in an single input original balance and a part of newly delegated amount
let amount_to_spend = (original_delegation_balance
+ Amount::from_atoms(rng.gen_range(1..=change.into_atoms())))
.unwrap();

let tx = TransactionBuilder::new()
.add_input(
Expand Down

0 comments on commit 8b47b8a

Please sign in to comment.