Browse Source

contract/money/tests/integration: fixed failing test due to erroneous VRF parameters

skoupidi 2 years ago
parent
commit
d376d2d43a

+ 2 - 3
src/contract/money/tests/integration.rs

@@ -18,7 +18,6 @@
 
 use darkfi::Result;
 use darkfi_contract_test_harness::{init_logger, Holder, TestHarness};
-use log::info;
 
 #[test]
 fn money_integration() -> Result<()> {
@@ -34,8 +33,8 @@ fn money_integration() -> Result<()> {
         // Generate a new block mined by Alice
         th.generate_block(&Holder::Alice, &HOLDERS).await?;
 
-        // Block height to verify against
-        let current_block_height = 1;
+        // Generate a new block mined by Bob
+        th.generate_block(&Holder::Bob, &HOLDERS).await?;
 
         // Thanks for reading
         Ok(())

+ 2 - 3
src/contract/test-harness/src/money_pow_reward.rs

@@ -55,7 +55,6 @@ impl TestHarness {
             self.proving_keys.get(&MONEY_CONTRACT_ZKAS_MINT_NS_V1.to_string()).unwrap();
 
         // Reference the last block in the holder's blockchain
-        let (block_height, fork_previous_hash) = wallet.validator.blockchain.last()?;
         let last_block = wallet.validator.blockchain.last_block()?;
 
         // If there's a set reward recipient, use it, otherwise reward the holder
@@ -69,9 +68,9 @@ impl TestHarness {
         let builder = PoWRewardCallBuilder {
             secret: wallet.keypair.secret,
             recipient,
-            block_height: block_height + 1,
+            block_height: last_block.header.height + 1,
             last_nonce: last_block.header.nonce,
-            fork_previous_hash,
+            fork_previous_hash: last_block.header.previous,
             spend_hook: FuncId::none(),
             user_data: pallas::Base::ZERO,
             mint_zkbin: mint_zkbin.clone(),