Skip to content

Commit

Permalink
fix refresh box tx inputs in bootstrap command;
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat committed Jun 30, 2022
1 parent aa1caf3 commit 895b344
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ proptest = {version = "1.0.0"}
proptest-derive = {version = "0.3.0"}
sigma-test-util = {version = "0.3.0"}
ergo-chain-sim = {version = "0.1.0", path="../ergo-chain-sim"}
env_logger = {version = "0.9.0"}
2 changes: 1 addition & 1 deletion core/src/cli_commands/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ pub(crate) fn perform_bootstrap_chained_transaction(

let target_balance = calc_target_balance(num_transactions_left)?;
let box_selector = SimpleBoxSelector::new();
let mut inputs = filter_tx_outputs(signed_mint_reward_tokens_tx.outputs.clone());
let mut inputs = filter_tx_outputs(signed_pool_box_tx.outputs.clone());

// Need to find the box containing the refresh NFT, and transfer this token to the refresh box.
let box_with_refresh_nft = signed_mint_refresh_nft_tx
Expand Down
5 changes: 5 additions & 0 deletions core/src/pool_commands/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,8 @@ impl<'a> SignTransaction for LocalTxSigner<'a> {
Ok(tx)
}
}

pub fn init_log_tests() {
// set log level via RUST_LOG=info env var
let _ = env_logger::builder().is_test(true).try_init().unwrap();
}
6 changes: 4 additions & 2 deletions core/src/tests/bootstrap_and_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::cli_commands::bootstrap::TokenMintDetails;
use crate::cli_commands::bootstrap::TokensToMint;
use crate::node_interface;
use crate::node_interface::SubmitTransaction;
use crate::pool_commands::test_utils::init_log_tests;
use crate::pool_commands::test_utils::LocalTxSigner;
use crate::pool_commands::test_utils::WalletDataMock;

Expand All @@ -34,7 +35,7 @@ impl<'a> SubmitTransaction for ChainSubmitTx<'a> {
self.chain
.borrow_mut()
.add_block(Block::new(vec![tx.clone()]));
Ok("".to_string())
Ok(tx.id().into())
}
}

Expand Down Expand Up @@ -115,6 +116,7 @@ fn bootstrap(wallet: &Wallet, address: &Address, chain: &mut ChainSim) -> Oracle

#[test]
fn test_bootstrap_and_run() {
init_log_tests();
let mut chain = ChainSim::new();
let secret = force_any_val::<DlogProverInput>();
let wallet = Wallet::from_secrets(vec![secret.clone().into()]);
Expand All @@ -125,5 +127,5 @@ fn test_bootstrap_and_run() {
None,
);
let _oracle_config = bootstrap(&wallet, &address, &mut chain);
assert_eq!(chain.height, 5);
assert_eq!(chain.height, 8);
}

0 comments on commit 895b344

Please sign in to comment.