io.register_method("add_node", move |params: Params, _: &Context| {
// parse values to
match params.parse::<[Box<RawValue>; 1]>() {
Ok(params) => {
// Expand the array bounding `RawValue` and deserialize
let node: String = serde_json::from_str::<String>(¶ms[0].get()).unwrap();
rpc_server.add_node(node);
}
// there is bound to be no errors
Err(_) => (),
};
})?;
/// Add a node to the local database
fn add_node(&self, address: String) {
add_node(address);
}
/// Add a node to the local database
pub fn add_node(address: String) {
// Initialize local database API
let node_db: NodeDB = NodeDB::new();
// initialize address for mutability
let mut address: String = address;
// define address schema
let schema: &str = "http://";
// check if address contains a schema
if !address.contains(schema) {
// append to the beginning of the string
address.insert_str(0, schema);
}
// TODO: Sort nodes before writing to local database
// // write all nodes to local database
// node_db
// .write(address)
// .expect("Couldn't write to Node database");
let client: RPCClient = RPCClient::new("http://127.0.0.1:8332".to_string());
println!("About to be pinging...");
let _result = client.add_node(address).expect("Could not ping user");
println!("Finished");
}
A LOT OF OUTPUT. CANNOT FIND THIS. JUST TAKE A LOOK AT WHAT I GOT AT THE END.
```
query stack during panic:
#0 [typeck] type-checking `p2p::start_server`
#1 [thir_body] building THIR for `p2p::start_server`
#2 [mir_built] building MIR for `p2p::start_server`
#3 [unsafety_check_result] unsafety-checking `p2p::start_server`
#4 [mir_borrowck] borrow-checking `p2p::start_server`
#5 [type_of] computing type of `p2p::start_server::{opaque#0}`
#6 [analysis] running analysis passes on this crate
end of query stack
```
Code
Find full code here: https://github.com/manuelinfosec/bitcoin-rs/tree/bug/rust-1.68.2-compiler-crash
Replicating Error
Start a server with:
cargo run node start 0.0.0.0:8332
, then call the server withcargo run node add 127.0.0.0.8000
. This should replicate the error.Meta
rustc --version --verbose
:Error output
Backtrace
A LOT OF OUTPUT. CANNOT FIND THIS. JUST TAKE A LOOK AT WHAT I GOT AT THE END. ``` query stack during panic: #0 [typeck] type-checking `p2p::start_server` #1 [thir_body] building THIR for `p2p::start_server` #2 [mir_built] building MIR for `p2p::start_server` #3 [unsafety_check_result] unsafety-checking `p2p::start_server` #4 [mir_borrowck] borrow-checking `p2p::start_server` #5 [type_of] computing type of `p2p::start_server::{opaque#0}` #6 [analysis] running analysis passes on this crate end of query stack ```