Skip to content

Commit

Permalink
remove old test
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Dec 9, 2024
1 parent 3b7aa71 commit dc1f2cd
Showing 1 changed file with 0 additions and 76 deletions.
76 changes: 0 additions & 76 deletions src/sharechain/p2chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,82 +987,6 @@ mod test {
assert_eq!(level.height, 6);
}

#[test]
fn test_dont_set_tip_on_single_high_height() {
let mut chain = P2Chain::new_empty(10, 5, 10);

let mut prev_block = None;
let mut tari_block = Block::new(BlockHeader::new(0), AggregateBody::empty());
for i in 0..5 {
tari_block.header.nonce = i;
let address = new_random_address();
let block = P2BlockBuilder::new(prev_block.as_ref())
.with_timestamp(EpochTime::now())
.with_height(i)
.with_tari_block(tari_block.clone())
.unwrap()
.with_miner_wallet_address(address.clone())
.build()
.unwrap();
prev_block = Some(block.clone());
chain.add_block_to_chain(block.clone()).unwrap();

let level = chain.get_tip().unwrap();
assert_eq!(level.height, i);
}
// we do this so we can add a missing parent or 2
let address = new_random_address();
let block = P2BlockBuilder::new(prev_block.as_ref())
.with_timestamp(EpochTime::now())
.with_height(100)
.with_tari_block(tari_block.clone())
.unwrap()
.with_miner_wallet_address(address.clone())
.build()
.unwrap();
prev_block = Some(block.clone());
let address = new_random_address();
let block = P2BlockBuilder::new(prev_block.as_ref())
.with_timestamp(EpochTime::now())
.with_height(2000)
.with_tari_block(tari_block.clone())
.unwrap()
.with_miner_wallet_address(address.clone())
.build()
.unwrap();
prev_block = Some(block.clone());

chain.add_block_to_chain(block.clone()).unwrap();

let level = chain.get_tip().unwrap();
assert_eq!(level.height, 4);

let address = new_random_address();
let block = P2BlockBuilder::new(prev_block.as_ref())
.with_timestamp(EpochTime::now())
.with_height(1000)
.with_tari_block(tari_block.clone())
.unwrap()
.with_miner_wallet_address(address.clone())
.build()
.unwrap();
prev_block = Some(block.clone());
let address = new_random_address();
let block = P2BlockBuilder::new(prev_block.as_ref())
.with_timestamp(EpochTime::now())
.with_height(20000)
.with_tari_block(tari_block.clone())
.unwrap()
.with_miner_wallet_address(address.clone())
.build()
.unwrap();

chain.add_block_to_chain(block.clone()).unwrap();

let level = chain.get_tip().unwrap();
assert_eq!(level.height, 4);
}

#[test]
fn get_parent() {
let mut chain = P2Chain::new_empty(10, 5, 10);
Expand Down

0 comments on commit dc1f2cd

Please sign in to comment.