Compare commits

..

No commits in common. "36edfcd0738f4d156dfca8ae10cc510615e11a54" and "713eb8fbaa5e9728d5aa03e165a64b2bc29cf5e6" have entirely different histories.

3 changed files with 10 additions and 17 deletions

View File

@ -73,7 +73,7 @@ fn get_network_params(cfg: &MyConfig,network:Network)-> &NetworkParams{
fn get_network_params_default(network:Network) -> NetworkParams{ fn get_network_params_default(network:Network) -> NetworkParams{
match network { match network {
Network::Testnet => NetworkParams{ Network::Testnet => NetworkParams{
host: "http://i27.0.0.1".to_string(), host: "http://localhost".to_string(),
port: 18332, port: 18332,
dir_path: "testnet3/".to_string(), dir_path: "testnet3/".to_string(),
db_field: "testnet".to_string(), db_field: "testnet".to_string(),
@ -82,7 +82,7 @@ fn get_network_params_default(network:Network) -> NetworkParams{
rpc_pass: "".to_string(), rpc_pass: "".to_string(),
}, },
Network::Signet => NetworkParams{ Network::Signet => NetworkParams{
host: "http://127.0.0.1".to_string(), host: "http://localhost".to_string(),
port: 18332, port: 18332,
dir_path: "signet/".to_string(), dir_path: "signet/".to_string(),
db_field: "signet".to_string(), db_field: "signet".to_string(),
@ -91,7 +91,7 @@ fn get_network_params_default(network:Network) -> NetworkParams{
rpc_pass: "".to_string(), rpc_pass: "".to_string(),
}, },
Network::Regtest => NetworkParams{ Network::Regtest => NetworkParams{
host: "http://127.0.0.1".to_string(), host: "http://localhost".to_string(),
port: 18443, port: 18443,
dir_path: "regtest/".to_string(), dir_path: "regtest/".to_string(),
db_field: "regtest".to_string(), db_field: "regtest".to_string(),
@ -100,7 +100,7 @@ fn get_network_params_default(network:Network) -> NetworkParams{
rpc_pass: "".to_string(), rpc_pass: "".to_string(),
}, },
_ => NetworkParams{ _ => NetworkParams{
host: "http://127.0.0.1".to_string(), host: "http://localhost".to_string(),
port: 8332, port: 8332,
dir_path: "".to_string(), dir_path: "".to_string(),
db_field: "bitcoin".to_string(), db_field: "bitcoin".to_string(),
@ -148,13 +148,9 @@ fn get_client_from_cookie(url: &String,network: &NetworkParams)->Result<(Client,
match get_cookie_filename(network){ match get_cookie_filename(network){
Ok(cookie) => { Ok(cookie) => {
match Client::new(&url[..], Auth::CookieFile(cookie.into())) { match Client::new(&url[..], Auth::CookieFile(cookie.into())) {
Ok(client) => { Ok(client) => match client.get_blockchain_info(){
match client.get_blockchain_info(){
Ok(bcinfo) => Ok((client,bcinfo)), Ok(bcinfo) => Ok((client,bcinfo)),
Err(err) => { Err(err) => Err(err.into())
Err(err.into())
}
}
}, },
Err(err)=>Err(err.into()) Err(err)=>Err(err.into())
@ -164,7 +160,7 @@ fn get_client_from_cookie(url: &String,network: &NetworkParams)->Result<(Client,
} }
} }
fn get_client(network: &NetworkParams) -> Result<(Client,GetBlockchainInfoResult),Box<dyn StdError>>{ fn get_client(network: &NetworkParams) -> Result<(Client,GetBlockchainInfoResult),Box<dyn StdError>>{
let url = format!("{}:{}/",network.host,&network.port); let url = format!("{}:{}",network.host,&network.port);
match get_client_from_username(&url,network){ match get_client_from_username(&url,network){
Ok(client) =>{Ok(client)}, Ok(client) =>{Ok(client)},
Err(_) =>{ Err(_) =>{
@ -385,7 +381,7 @@ fn main(){
}; };
info!("Network: {}",arg_network); debug!("Network: {}",arg_network);
let network_params = get_network_params(&cfg,network); let network_params = get_network_params(&cfg,network);
@ -393,7 +389,6 @@ fn main(){
let socket: Socket = context.socket(zmq::SUB).unwrap(); let socket: Socket = context.socket(zmq::SUB).unwrap();
let zmq_address = cfg.zmq_listener.clone(); let zmq_address = cfg.zmq_listener.clone();
info!("zmq listening on: {}",zmq_address);
socket.connect(&zmq_address).unwrap(); socket.connect(&zmq_address).unwrap();
socket.set_subscribe(b"").unwrap(); socket.set_subscribe(b"").unwrap();

View File

@ -369,7 +369,7 @@ async fn echo_push(whole_body: &Bytes,
ptx.push((linenum+3,Value::String(line.to_string()))); ptx.push((linenum+3,Value::String(line.to_string())));
ptx.push((linenum+4,Value::String(locktime.to_string()))); ptx.push((linenum+4,Value::String(locktime.to_string())));
ptx.push((linenum+5,Value::String(req_time.to_string()))); ptx.push((linenum+5,Value::String(req_time.to_string())));
ptx.push((linenum+6,Value::String(netconfig.name.to_string()))); ptx.push((linenum+6,Value::String(param.to_string())));
ptx.push((linenum+7,Value::String(our_address.to_string()))); ptx.push((linenum+7,Value::String(our_address.to_string())));
ptx.push((linenum+8,Value::String(our_fees.to_string()))); ptx.push((linenum+8,Value::String(our_fees.to_string())));
linenum += 9; linenum += 9;

View File

@ -17,8 +17,6 @@ pub fn create_database(db: &Connection){
let _ = db.execute("CREATE UNIQUE INDEX idx_xpub ON tbl_xpub (network, xpub)"); let _ = db.execute("CREATE UNIQUE INDEX idx_xpub ON tbl_xpub (network, xpub)");
let _ = db.execute("CREATE TABLE IF NOT EXISTS tbl_address (address TEXT PRIMARY_KEY, path TEXT NOT NULL, date_create TIMESTAMP DEFAULT CURRENT_TIMESTAMP, xpub INTEGER,remote_address TEXT);"); let _ = db.execute("CREATE TABLE IF NOT EXISTS tbl_address (address TEXT PRIMARY_KEY, path TEXT NOT NULL, date_create TIMESTAMP DEFAULT CURRENT_TIMESTAMP, xpub INTEGER,remote_address TEXT);");
let _ = db.execute("UPDATE tbl_tx set network='bitcoin' where network='mainnet');");
} }
/* /*