Skip to content

Commit

Permalink
try67
Browse files Browse the repository at this point in the history
  • Loading branch information
lla-dane committed Apr 10, 2024
1 parent fb42bbf commit d7ac6d5
Show file tree
Hide file tree
Showing 3,141 changed files with 1,006 additions and 145,728 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1,226 changes: 986 additions & 240 deletions code.txt

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions src/validation_checks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,18 +649,18 @@ pub fn verify_tx(tx: Transaction) -> Result<bool> {
} else if tx_type == _p2tr {
// CHECK IF THE WITNESS ITEMS LENGTH IS <255

for input in tx.vin.iter() {
let witness = input.witness.clone().unwrap();
for item in witness {
let item_bytes = hex::decode(&item)?;
if item_bytes.len() >= 255 {
// println!("*****************************************************************************************************************************");
return Ok(false);
}
}
}

v_result = true;
// for input in tx.vin.iter() {
// let witness = input.witness.clone().unwrap();
// for item in witness {
// let item_bytes = hex::decode(&item)?;
// if item_bytes.len() >= 255 {
// // println!("*****************************************************************************************************************************");
// return Ok(false);
// }
// }
// }

v_result = false;
}

Ok(v_result)
Expand Down Expand Up @@ -726,13 +726,15 @@ pub fn all_transaction_verification() -> Result<()> {

if result == true {
// s_count += 1;
println!("SUCCESSFULL");
if let Some(filename) = path.file_name() {
let valid_mempool_dir = Path::new("./valid-mempool");
let destination_path = valid_mempool_dir.join(filename);
fs::copy(&path, &destination_path)?;
}
} else {
// f_count += 1;
println!("FAILED");
}

// println!("\n\n");
Expand Down
4 changes: 2 additions & 2 deletions src/validation_checks/p2pkh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ fn op_checksig(tx: &Transaction, tx_input_index: usize) -> bool {
let message =
Message::from_digest_slice(&trimmed_tx_hash).expect("ERROR CREATING MESSAGE FROM TX_HASH");

println!("{}", message);
println!("{}", signature);
// println!("{}", message);
// println!("{}", signature);

match secp.verify_ecdsa(&message, &signature, &public_key) {
Ok(_) => return true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{"$message_type":"diagnostic","message":"variable `x` is assigned to, but never used","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/validation_checks/mod.rs","byte_start":4329,"byte_end":4330,"line_start":143,"line_end":143,"column_start":13,"column_end":14,"is_primary":true,"text":[{"text":" let mut x: String = String::new();","highlight_start":13,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"consider using `_x` instead","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"`#[warn(unused_variables)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: variable `x` is assigned to, but never used\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/validation_checks/mod.rs:143:13\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m143\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let mut x: String = String::new();\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: consider using `_x` instead\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_variables)]` on by default\u001b[0m\n\n"}
{"$message_type":"diagnostic","message":"unused imports: `fs::File`, `io::Write`","code":{"code":"unused_imports","explanation":null},"level":"warning","spans":[{"file_name":"src/block_mine/merkle_root.rs","byte_start":10,"byte_end":18,"line_start":1,"line_end":1,"column_start":11,"column_end":19,"is_primary":true,"text":[{"text":"use std::{fs::File, io::Write};","highlight_start":11,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/block_mine/merkle_root.rs","byte_start":20,"byte_end":29,"line_start":1,"line_end":1,"column_start":21,"column_end":30,"is_primary":true,"text":[{"text":"use std::{fs::File, io::Write};","highlight_start":21,"highlight_end":30}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_imports)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove the whole `use` item","code":null,"level":"help","spans":[{"file_name":"src/block_mine/merkle_root.rs","byte_start":0,"byte_end":31,"line_start":1,"line_end":1,"column_start":1,"column_end":32,"is_primary":true,"text":[{"text":"use std::{fs::File, io::Write};","highlight_start":1,"highlight_end":32}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused imports: `fs::File`, `io::Write`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/block_mine/merkle_root.rs:1:11\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m1\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0muse std::{fs::File, io::Write};\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_imports)]` on by default\u001b[0m\n\n"}
{"$message_type":"diagnostic","message":"unused variable: `coinbase_txid`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/block_mine/block.rs","byte_start":2043,"byte_end":2056,"line_start":68,"line_end":68,"column_start":36,"column_end":49,"is_primary":true,"text":[{"text":" let (merkel_root, coinbase_tx, coinbase_txid, txids) = generate_roots(map.clone())?;","highlight_start":36,"highlight_end":49}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_variables)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/block_mine/block.rs","byte_start":2043,"byte_end":2056,"line_start":68,"line_end":68,"column_start":36,"column_end":49,"is_primary":true,"text":[{"text":" let (merkel_root, coinbase_tx, coinbase_txid, txids) = generate_roots(map.clone())?;","highlight_start":36,"highlight_end":49}],"label":null,"suggested_replacement":"_coinbase_txid","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `coinbase_txid`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/block_mine/block.rs:68:36\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m68\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let (merkel_root, coinbase_tx, coinbase_txid, txids) = generate_roots(map.clone())?;\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_coinbase_txid`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_variables)]` on by default\u001b[0m\n\n"}
{"$message_type":"diagnostic","message":"variable `x` is assigned to, but never used","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/validation_checks/mod.rs","byte_start":4329,"byte_end":4330,"line_start":143,"line_end":143,"column_start":13,"column_end":14,"is_primary":true,"text":[{"text":" let mut x: String = String::new();","highlight_start":13,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"consider using `_x` instead","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: variable `x` is assigned to, but never used\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/validation_checks/mod.rs:143:13\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m143\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let mut x: String = String::new();\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: consider using `_x` instead\u001b[0m\n\n"}
{"$message_type":"diagnostic","message":"value assigned to `x` is never read","code":{"code":"unused_assignments","explanation":null},"level":"warning","spans":[{"file_name":"src/validation_checks/mod.rs","byte_start":4611,"byte_end":4612,"line_start":150,"line_end":150,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" x = hex::encode(trimmed_tx.clone());","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"maybe it is overwritten before being read?","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"`#[warn(unused_assignments)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: value assigned to `x` is never read\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/validation_checks/mod.rs:150:9\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m150\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m x = hex::encode(trimmed_tx.clone());\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: maybe it is overwritten before being read?\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_assignments)]` on by default\u001b[0m\n\n"}
{"$message_type":"diagnostic","message":"2 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 2 warnings emitted\u001b[0m\n\n"}
{"$message_type":"diagnostic","message":"4 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 4 warnings emitted\u001b[0m\n\n"}
Binary file modified target/debug/code-challenge-2024-lla-dane
Binary file not shown.
Binary file modified target/debug/deps/code_challenge_2024_lla_dane-2c0b3b0e1b371d03
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d7ac6d5

Please sign in to comment.