Skip to content

Commit 46c7792

Browse files
committed
tests
1 parent 6acd23f commit 46c7792

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

base_layer/core/src/base_node/chain_metadata_service/service.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ mod test {
218218
use std::convert::TryInto;
219219

220220
use futures::StreamExt;
221-
use primitive_types::U256;
221+
use primitive_types::U512;
222222
use tari_comms::{peer_manager::NodeId, test_utils::mocks::create_connectivity_mock};
223223
use tari_p2p::services::liveness::{
224224
mock::{create_p2p_liveness_mock, LivenessMockState},
@@ -246,8 +246,8 @@ mod test {
246246
}
247247

248248
fn create_sample_proto_chain_metadata() -> proto::ChainMetadata {
249-
let diff: U256 = 1.into();
250-
let mut bytes = [0u8; 32];
249+
let diff: U512 = 1.into();
250+
let mut bytes = [0u8; 64];
251251
diff.to_big_endian(&mut bytes);
252252
proto::ChainMetadata {
253253
best_block_height: 1,
@@ -256,7 +256,8 @@ mod test {
256256
28, 29, 30, 31,
257257
],
258258
pruned_height: 0,
259-
accumulated_difficulty: bytes.to_vec(),
259+
accumulated_difficulty_low: bytes[32..=63].to_vec(),
260+
accumulated_difficulty_high: bytes[0..=31].to_vec(),
260261
timestamp: EpochTime::now().as_u64(),
261262
}
262263
}

base_layer/wallet/tests/support/comms_rpc.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ impl BaseNodeWalletRpcMockState {
151151
metadata: Some(ChainMetadataProto {
152152
best_block_height: i64::MAX as u64,
153153
best_block_hash: FixedHash::zero().to_vec(),
154-
accumulated_difficulty: Vec::new(),
154+
accumulated_difficulty_low: Vec::new(),
155+
accumulated_difficulty_high: Vec::new(),
155156
pruned_height: 0,
156157
timestamp: EpochTime::now().as_u64(),
157158
}),
@@ -932,7 +933,8 @@ mod test {
932933
let chain_metadata = ChainMetadata {
933934
best_block_height: 444,
934935
best_block_hash: vec![],
935-
accumulated_difficulty: vec![],
936+
accumulated_difficulty_low: Vec::new(),
937+
accumulated_difficulty_high: Vec::new(),
936938
pruned_height: 0,
937939
timestamp: EpochTime::now().as_u64(),
938940
};

base_layer/wallet/tests/utxo_scanner/mod.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ async fn test_utxo_scanner_recovery() {
327327
let chain_metadata = ChainMetadata {
328328
best_block_height: NUM_BLOCKS - 1,
329329
best_block_hash: block_headers.get(&(NUM_BLOCKS - 1)).unwrap().clone().hash().to_vec(),
330-
accumulated_difficulty: Vec::new(),
330+
accumulated_difficulty_low: Vec::new(),
331+
accumulated_difficulty_high: Vec::new(),
331332
pruned_height: 0,
332333
timestamp: 0,
333334
};
@@ -426,7 +427,8 @@ async fn test_utxo_scanner_recovery_with_restart() {
426427
let chain_metadata = ChainMetadata {
427428
best_block_height: NUM_BLOCKS - 1,
428429
best_block_hash: block_headers.get(&(NUM_BLOCKS - 1)).unwrap().clone().hash().to_vec(),
429-
accumulated_difficulty: Vec::new(),
430+
accumulated_difficulty_low: Vec::new(),
431+
accumulated_difficulty_high: Vec::new(),
430432
pruned_height: 0,
431433
timestamp: 0,
432434
};
@@ -563,7 +565,8 @@ async fn test_utxo_scanner_recovery_with_restart_and_reorg() {
563565
let chain_metadata = ChainMetadata {
564566
best_block_height: NUM_BLOCKS - 1,
565567
best_block_hash: block_headers.get(&(NUM_BLOCKS - 1)).unwrap().clone().hash().to_vec(),
566-
accumulated_difficulty: Vec::new(),
568+
accumulated_difficulty_low: Vec::new(),
569+
accumulated_difficulty_high: Vec::new(),
567570
pruned_height: 0,
568571
timestamp: 0,
569572
};
@@ -643,7 +646,8 @@ async fn test_utxo_scanner_recovery_with_restart_and_reorg() {
643646
let chain_metadata = ChainMetadata {
644647
best_block_height: 9,
645648
best_block_hash: block_headers.get(&9).unwrap().clone().hash().to_vec(),
646-
accumulated_difficulty: Vec::new(),
649+
accumulated_difficulty_low: Vec::new(),
650+
accumulated_difficulty_high: Vec::new(),
647651
pruned_height: 0,
648652
timestamp: 0,
649653
};
@@ -773,7 +777,8 @@ async fn test_utxo_scanner_scanned_block_cache_clearing() {
773777
.clone()
774778
.hash()
775779
.to_vec(),
776-
accumulated_difficulty: Vec::new(),
780+
accumulated_difficulty_low: Vec::new(),
781+
accumulated_difficulty_high: Vec::new(),
777782
pruned_height: 0,
778783
timestamp: 0,
779784
};
@@ -871,7 +876,8 @@ async fn test_utxo_scanner_one_sided_payments() {
871876
let chain_metadata = ChainMetadata {
872877
best_block_height: NUM_BLOCKS - 1,
873878
best_block_hash: block_headers.get(&(NUM_BLOCKS - 1)).unwrap().clone().hash().to_vec(),
874-
accumulated_difficulty: Vec::new(),
879+
accumulated_difficulty_low: Vec::new(),
880+
accumulated_difficulty_high: Vec::new(),
875881
pruned_height: 0,
876882
timestamp: 0,
877883
};
@@ -976,7 +982,8 @@ async fn test_utxo_scanner_one_sided_payments() {
976982
let chain_metadata = ChainMetadata {
977983
best_block_height: NUM_BLOCKS,
978984
best_block_hash: block_headers.get(&(NUM_BLOCKS)).unwrap().clone().hash().to_vec(),
979-
accumulated_difficulty: Vec::new(),
985+
accumulated_difficulty_low: Vec::new(),
986+
accumulated_difficulty_high: Vec::new(),
980987
pruned_height: 0,
981988
timestamp: 0,
982989
};
@@ -1047,7 +1054,8 @@ async fn test_birthday_timestamp_over_chain() {
10471054
let chain_metadata = ChainMetadata {
10481055
best_block_height: NUM_BLOCKS - 1,
10491056
best_block_hash: block_headers.get(&(NUM_BLOCKS - 1)).unwrap().clone().hash().to_vec(),
1050-
accumulated_difficulty: Vec::new(),
1057+
accumulated_difficulty_low: Vec::new(),
1058+
accumulated_difficulty_high: Vec::new(),
10511059
pruned_height: 0,
10521060
timestamp: 0,
10531061
};

0 commit comments

Comments
 (0)