Skip to content

Commit adc63f1

Browse files
committed
test: Remove scan test
The invariants should already be covered by some of the other tests
1 parent 1225810 commit adc63f1

File tree

1 file changed

+0
-79
lines changed

1 file changed

+0
-79
lines changed

tests/test.rs

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -185,85 +185,6 @@ mod tests {
185185
}
186186
}
187187

188-
#[test]
189-
fn test_scan_tx() {
190-
#[allow(dead_code)]
191-
#[derive(Debug)]
192-
struct Input {
193-
height: u32,
194-
prevout: Vec<u8>,
195-
script_sig: Vec<u8>,
196-
witness: Vec<Vec<u8>>,
197-
}
198-
199-
#[derive(Debug)]
200-
struct ScanTxHelper {
201-
ins: Vec<Input>,
202-
#[allow(dead_code)]
203-
outs: Vec<Vec<u8>>,
204-
}
205-
206-
let (context, data_dir) = testing_setup();
207-
let chainman = setup_chainman_with_blocks(&context, &data_dir).unwrap();
208-
209-
let active_chain = chainman.active_chain();
210-
211-
for (height, block_index) in active_chain.iter().enumerate() {
212-
assert_eq!(height, block_index.height().try_into().unwrap());
213-
}
214-
215-
let block_index_tip = active_chain.tip();
216-
217-
let raw_block_tip: Vec<u8> = chainman
218-
.read_block_data(&block_index_tip)
219-
.unwrap()
220-
.consensus_encode()
221-
.unwrap();
222-
223-
let spent_outputs_tip = chainman.read_spent_outputs(&block_index_tip).unwrap();
224-
let block_tip: bitcoin::Block = deserialize(&raw_block_tip).unwrap();
225-
// Should be the same size minus the coinbase transaction
226-
assert_eq!(block_tip.txdata.len() - 1, spent_outputs_tip.count());
227-
228-
let block_index_tip_prev = block_index_tip.prev().unwrap();
229-
let raw_block: Vec<u8> = chainman
230-
.read_block_data(&block_index_tip_prev)
231-
.unwrap()
232-
.try_into()
233-
.unwrap();
234-
235-
let spent_outputs = chainman.read_spent_outputs(&block_index_tip_prev).unwrap();
236-
let block: bitcoin::Block = deserialize(&raw_block).unwrap();
237-
// Should be the same size minus the coinbase transaction
238-
assert_eq!(block.txdata.len() - 1, spent_outputs.count());
239-
240-
for i in 0..(block.txdata.len() - 1) {
241-
let tx_spent_outputs = spent_outputs.transaction_spent_outputs(i).unwrap();
242-
let coins_spent_count = tx_spent_outputs.count();
243-
let transaction_input_size = block.txdata[i + 1].input.len();
244-
245-
assert_eq!(transaction_input_size, coins_spent_count);
246-
let mut helper = ScanTxHelper {
247-
ins: vec![],
248-
outs: block.txdata[i + 1]
249-
.output
250-
.iter()
251-
.map(|output| output.script_pubkey.to_bytes())
252-
.collect(),
253-
};
254-
for j in 0..transaction_input_size {
255-
let coin = tx_spent_outputs.coin(j).unwrap();
256-
helper.ins.push(Input {
257-
height: coin.confirmation_height(),
258-
prevout: coin.output().script_pubkey().to_bytes(),
259-
script_sig: block.txdata[i + 1].input[j].script_sig.to_bytes(),
260-
witness: block.txdata[i + 1].input[j].witness.to_vec(),
261-
});
262-
}
263-
println!("helper: {:?}", helper);
264-
}
265-
}
266-
267188
#[test]
268189
fn test_process_data() {
269190
let (context, data_dir) = testing_setup();

0 commit comments

Comments
 (0)