diff --git a/Cargo.lock b/Cargo.lock index 6b9b5569f13c6e9e3afd56cb3d83e9712ca13a46..58d47cc38033728b38ca7768b658bf664427c303 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -384,6 +384,7 @@ dependencies = [ "serde 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "unwrap 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/lib/modules/blockchain/blockchain-dal/Cargo.toml b/lib/modules/blockchain/blockchain-dal/Cargo.toml index 55e85f905931c37dbf5f45b26510b202b73d19d9..4092ca331c4a24d990f7fdd44dd1bbf0e20f2c56 100644 --- a/lib/modules/blockchain/blockchain-dal/Cargo.toml +++ b/lib/modules/blockchain/blockchain-dal/Cargo.toml @@ -24,8 +24,9 @@ serde_derive = "1.0.*" serde_json = "1.0.*" [dev-dependencies] -rust-tests-tools = { path = "../../../tests-tools/rust-tests-tools" } dup-crypto-tests-tools = { path = "../../../tests-tools/crypto-tests-tools" } dubp-documents-tests-tools = { path = "../../../tests-tools/documents-tests-tools" } +rust-tests-tools = { path = "../../../tests-tools/rust-tests-tools" } +unwrap = "1.2.1" [features] diff --git a/lib/modules/blockchain/blockchain-dal/src/writers/transaction.rs b/lib/modules/blockchain/blockchain-dal/src/writers/transaction.rs index 6895fc83749d4ec21462fa2924a1c3580c216db8..39f6e73009d19df3a1815650751f810afa582213 100644 --- a/lib/modules/blockchain/blockchain-dal/src/writers/transaction.rs +++ b/lib/modules/blockchain/blockchain-dal/src/writers/transaction.rs @@ -426,6 +426,7 @@ mod tests { use super::*; use dubp_documents::{Document, DocumentBuilder, VerificationResult}; use std::str::FromStr; + use unwrap::unwrap; fn build_first_tx_of_g1() -> TransactionDocument { let pubkey = PubKey::Ed25519( @@ -516,7 +517,10 @@ mod tests { SourceAmount(TxAmount(1000), TxBase(0)) ); // Apply first g1 transaction - apply_and_write_tx(¤cy_dbs, &tx_doc).expect("Fail to apply first g1 tx"); + let blockstamp = unwrap!(Blockstamp::from_string( + "52-000057D4B29AF6DADB16F841F19C54C00EB244CECA9C8F2D4839D54E5F91451C" + )); + apply_and_write_tx(&blockstamp, ¤cy_dbs, &tx_doc).expect("Fail to apply first g1 tx"); // Check issuer new balance let cgeek_new_balance = currency_dbs .balances_db @@ -547,7 +551,11 @@ mod tests { ); // Revert first g1 tx + let blockstamp = unwrap!(Blockstamp::from_string( + "52-000057D4B29AF6DADB16F841F19C54C00EB244CECA9C8F2D4839D54E5F91451C" + )); revert_tx( + &blockstamp, ¤cy_dbs, &DALTxV10 { tx_doc: tx_doc.clone(),