Skip to content

Commit

Permalink
Merge pull request #11 from pshenmic/fix/mainnet-network-type
Browse files Browse the repository at this point in the history
Allow mainnet as a network type
  • Loading branch information
pshenmic authored Oct 20, 2024
2 parents c92e736 + 2bc87b1 commit aaafd59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/commands/masternode_vote_dpns_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ impl MasternodeVoteDPNSNameCommand {

let secp = Secp256k1::new();

let network_type = Network::from_str(&self.network).expect("Could not parse network");
let network = if &self.network == "mainnet" { "dash" } else { &self.network };
let network_type = Network::from_str(network).expect("Could not parse network");
let private_key_data = fs::read_to_string(&self.private_key).expect("Unable to read private key file");
let private_key = Utils::decode_private_key_from_input_string(private_key_data.as_str(), network_type)?;
let public_key = private_key.public_key(&secp);
Expand Down
3 changes: 2 additions & 1 deletion src/commands/register_dpns_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ impl RegisterDPNSNameCommand {

let secp = Secp256k1::new();

let network_type = Network::from_str(&self.network).expect("Could not parse network");
let network = if &self.network == "mainnet" { "dash" } else { &self.network };
let network_type = Network::from_str(network).expect("Could not parse network");
let private_key_data = fs::read_to_string(&self.private_key).expect("Unable to read private key file");
let private_key = Utils::decode_private_key_from_input_string(private_key_data.as_str(), network_type)?;
let public_key = private_key.public_key(&secp);
Expand Down
3 changes: 2 additions & 1 deletion src/commands/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ impl WithdrawCommand {

let secp = Secp256k1::new();

let network_type = Network::from_str(&self.network).expect("Could not parse network");
let network = if &self.network == "mainnet" { "dash" } else { &self.network };
let network_type = Network::from_str(network).expect("Could not parse network");
let private_key_data = fs::read_to_string(&self.private_key).expect("Unable to read private key file");
let private_key = Utils::decode_private_key_from_input_string(private_key_data.as_str(), network_type)?;
let public_key = private_key.public_key(&secp);
Expand Down

0 comments on commit aaafd59

Please sign in to comment.