Skip to content

Commit ca0355b

Browse files
committed
Fix node type selection and activation code persistence - Super node now correctly creates Super node instead of Full node - Selected node type is now saved and remembered between restarts
1 parent c2ca0af commit ca0355b

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

development/qnet-integration/src/bin/qnet-node.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ fn mask_code(code: &str) -> String {
4545
}
4646

4747
// Decode activation code to extract node type and payment info
48-
fn decode_activation_code(code: &str) -> Result<ActivationCodeData, String> {
49-
// Handle development mode
48+
fn decode_activation_code(code: &str, selected_node_type: NodeType) -> Result<ActivationCodeData, String> {
49+
// Handle development mode - use selected node type
5050
if code == "TEST_MODE" || code == "CLI_MODE" || code.starts_with("DEV_MODE_") {
5151
return Ok(ActivationCodeData {
52-
node_type: NodeType::Full, // Default for test
52+
node_type: selected_node_type, // Use actual selected type
5353
qnc_amount: 0,
5454
tx_hash: "DEV_TX".to_string(),
5555
wallet_address: "DEV_WALLET".to_string(),
@@ -1051,10 +1051,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
10511051
}
10521052

10531053
println!("🔍 DEBUG: About to create BlockchainNode...");
1054-
let mut node = match BlockchainNode::new(
1054+
let mut node = match BlockchainNode::new_with_config(
10551055
&config.data_dir.to_string_lossy(),
10561056
config.p2p_port,
10571057
bootstrap_peers,
1058+
node_type,
1059+
region,
10581060
).await {
10591061
Ok(node) => {
10601062
println!("🔍 DEBUG: BlockchainNode created successfully");
@@ -1069,7 +1071,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
10691071
};
10701072

10711073
// Save activation code to persistent storage for future restarts
1072-
if !activation_code.is_empty() && !activation_code.starts_with("DEV_MODE_EMPTY") {
1074+
// Always save in development mode to remember selected node type
1075+
if !activation_code.is_empty() {
10731076
if let Err(e) = node.save_activation_code(&activation_code, node_type).await {
10741077
println!("⚠️ Warning: Could not save activation code: {}", e);
10751078
}

0 commit comments

Comments
 (0)