Просмотр исходного кода

darkfid: updated PoW target to 120 seconds

skoupidi 1 год назад
Родитель
Сommit
f1c7f9fcea

+ 103 - 103
bin/darkfid/darkfid_config.toml

@@ -9,27 +9,22 @@
 # Blockchain network to use
 network = "testnet"
 
-# Localnet blockchain network configuration
-[network_config."localnet"]
+# Testnet blockchain network configuration
+[network_config."testnet"]
 # Path to the blockchain database directory
-database = "~/.local/share/darkfi/darkfid/localnet"
+database = "~/.local/share/darkfi/darkfid/testnet"
 
 # Confirmation threshold, denominated by number of blocks
-threshold = 3
+threshold = 6
 
 # minerd JSON-RPC endpoint
-minerd_endpoint = "tcp://127.0.0.1:28467"
+#minerd_endpoint = "tcp://127.0.0.1:28467"
 
 # PoW block production target, in seconds
-pow_target = 10
-
-# Optional fixed PoW difficulty, used for testing
-pow_fixed_difficulty = 1
+pow_target = 120
 
 # Wallet address to receive mining rewards.
-# This is a dummy one so the miner can start,
-# replace with your own one.
-recipient = "5ZHfYpt4mpJcwBNxfEyxLzeFJUEeoePs5NQ5jVEgHrMf"
+#recipient = "YOUR_WALLET_ADDRESS_HERE"
 
 # Optional contract spend hook to use in the mining reward
 #spend_hook = "YOUR_SPEND_HOOK_HERE"
@@ -38,7 +33,7 @@ recipient = "5ZHfYpt4mpJcwBNxfEyxLzeFJUEeoePs5NQ5jVEgHrMf"
 #user_data = "YOUR_USER_DATA_HERE"
 
 # Skip syncing process and start node right away
-skip_sync = true
+skip_sync = false
 
 # Disable transaction's fee verification, used for testing
 skip_fees = false
@@ -55,46 +50,60 @@ skip_fees = false
 # Garbage collection task transactions batch size
 txs_batch_size = 50
 
-## Localnet JSON-RPC settings
-[network_config."localnet".rpc]
+## Testnet JSON-RPC settings
+[network_config."testnet".rpc]
 # JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:8240"
+rpc_listen = "tcp://127.0.0.1:8340"
 
 # Disabled RPC methods
 rpc_disabled_methods = ["p2p.get_info"]
 
-## Localnet JSON-RPC settings for p2pool merge mining requests (optional)
-#[network_config."localnet".mm_rpc]
+## Testnet JSON-RPC settings for p2pool merge mining requests (optional)
+#[network_config."testnet".mm_rpc]
 # JSON-RPC listen URL (merge mining)
-#rpc_listen = "http+tcp://127.0.0.1:8241"
+#rpc_listen = "http+tcp://127.0.0.1:8341"
 
 # Disabled RPC methods (merge mining)
 #rpc_disabled_methods = []
 
-## Localnet P2P network settings
-[network_config."localnet".net]
+## Testnet P2P network settings
+[network_config."testnet".net]
 # Path to the P2P datastore
-p2p_datastore = "~/.local/share/darkfi/darkfid/localnet"
+p2p_datastore = "~/.local/share/darkfi/darkfid/testnet"
 
 # Path to a configured hostlist for saving known peers
-hostlist = "~/.local/share/darkfi/darkfid/localnet/p2p_hostlist.tsv"
+hostlist = "~/.local/share/darkfi/darkfid/testnet/p2p_hostlist.tsv"
 
 # P2P accept addresses the instance listens on for inbound connections
-#inbound = ["tcp+tls://0.0.0.0:8242"]
+# You can also use an IPv6 address
+#inbound = ["tcp+tls://0.0.0.0:8342"]
+# IPv6 version:
+#inbound = ["tcp+tls://[::]:8342"]
+# Combined:
+#inbound = ["tcp+tls://0.0.0.0:8342", "tcp+tls://[::]:8342"]
 
 # P2P external addresses the instance advertises so other peers can
 # reach us and connect to us, as long as inbound addrs are configured.
-#external_addrs = []
+# You can also use an IPv6 address
+#external_addrs = ["tcp+tls://XXX.XXX.XXX.XXX:8342"]
+# IPv6 version:
+#external_addrs = ["tcp+tls://[ipv6 address here]:8342"]
+# Combined:
+#external_addrs = ["tcp+tls://XXX.XXX.XXX.XXX:8342", "tcp+tls://[ipv6 address here]:8342"]
 
 # Peer nodes to manually connect to
 #peers = []
 
 # Seed nodes to connect to for peer discovery and/or adversising our
 # own external addresses
-#seeds = []
+seeds = ["tcp+tls://lilith0.dark.fi:8342", "tcp+tls://lilith1.dark.fi:8342"]
+#seeds = [
+#    "tor://g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:8343",
+#    "tor://yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:8343",
+#]
 
 # Whitelisted network transports for outbound connections
-#allowed_transports = ["tcp+tls"]
+allowed_transports = ["tcp+tls"]
 
 # Allow transport mixing (e.g. Tor would be allowed to connect to `tcp://`)
 #transport_mixing = false
@@ -107,17 +116,11 @@ hostlist = "~/.local/share/darkfi/darkfid/localnet/p2p_hostlist.tsv"
 
 # Outbound connection slots number, this many connections will be
 # attempted. (This does not include manual connections)
-#outbound_connections = 8
+outbound_connections = 8
 
 # Inbound connections slots number, this many active inbound connections
 # will be allowed. (This does not include manual or outbound connections)
-#inbound_connections = 8
-
-## White connection percent
-# gold_connect_count = 2
-
-## White connection percent
-# white_connect_percent = 70
+#inbound_connections = 0
 
 # Manual connections retry limit, 0 for forever looping
 #manual_attempt_limit = 0
@@ -132,7 +135,7 @@ hostlist = "~/.local/share/darkfi/darkfid/localnet/p2p_hostlist.tsv"
 #channel_heartbeat_interval = 10
 
 # Allow localnet hosts
-localnet = true
+localnet = false
 
 # Cooling off time for peer discovery when unsuccessful
 #outbound_peer_discovery_cooloff_time = 30
@@ -140,19 +143,19 @@ localnet = true
 # Time between peer discovery attempts
 #outbound_peer_discovery_attempt_time = 5
 
-# Testnet blockchain network configuration
-[network_config."testnet"]
+# Mainnet blockchain network configuration
+[network_config."mainnet"]
 # Path to the blockchain database directory
-database = "~/.local/share/darkfi/darkfid/testnet"
+database = "~/.local/share/darkfi/darkfid/mainnet"
 
 # Confirmation threshold, denominated by number of blocks
-threshold = 6
+threshold = 11
 
 # minerd JSON-RPC endpoint
 #minerd_endpoint = "tcp://127.0.0.1:28467"
 
 # PoW block production target, in seconds
-pow_target = 90
+pow_target = 120
 
 # Wallet address to receive mining rewards.
 #recipient = "YOUR_WALLET_ADDRESS_HERE"
@@ -181,57 +184,53 @@ skip_fees = false
 # Garbage collection task transactions batch size
 txs_batch_size = 50
 
-## Testnet JSON-RPC settings
-[network_config."testnet".rpc]
+## Mainnet JSON-RPC settings
+[network_config."mainnet".rpc]
 # JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:8340"
+rpc_listen = "tcp://127.0.0.1:8440"
 
 # Disabled RPC methods
 rpc_disabled_methods = ["p2p.get_info"]
 
-## Testnet JSON-RPC settings for p2pool merge mining requests (optional)
-#[network_config."testnet".mm_rpc]
+## Mainnet JSON-RPC settings for p2pool merge mining requests (optional)
+#[network_config."mainnet".mm_rpc]
 # JSON-RPC listen URL (merge mining)
-#rpc_listen = "http+tcp://127.0.0.1:8341"
+#rpc_listen = "http+tcp://127.0.0.1:8441"
 
 # Disabled RPC methods (merge mining)
 #rpc_disabled_methods = []
 
-## Testnet P2P network settings
-[network_config."testnet".net]
+## Mainnet P2P network settings
+[network_config."mainnet".net]
 # Path to the P2P datastore
-p2p_datastore = "~/.local/share/darkfi/darkfid/testnet"
+p2p_datastore = "~/.local/share/darkfi/darkfid/mainnet"
 
 # Path to a configured hostlist for saving known peers
-hostlist = "~/.local/share/darkfi/darkfid/testnet/p2p_hostlist.tsv"
+hostlist = "~/.local/share/darkfi/darkfid/mainnet/p2p_hostlist.tsv"
 
 # P2P accept addresses the instance listens on for inbound connections
 # You can also use an IPv6 address
-#inbound = ["tcp+tls://0.0.0.0:8342"]
+#inbound = ["tcp+tls://0.0.0.0:8442"]
 # IPv6 version:
-#inbound = ["tcp+tls://[::]:8342"]
+#inbound = ["tcp+tls://[::]:8442"]
 # Combined:
-#inbound = ["tcp+tls://0.0.0.0:8342", "tcp+tls://[::]:8342"]
+#inbound = ["tcp+tls://0.0.0.0:8442", "tcp+tls://[::]:8442"]
 
 # P2P external addresses the instance advertises so other peers can
 # reach us and connect to us, as long as inbound addrs are configured.
 # You can also use an IPv6 address
-#external_addrs = ["tcp+tls://XXX.XXX.XXX.XXX:8342"]
+#external_addrs = ["tcp+tls://XXX.XXX.XXX.XXX:8442"]
 # IPv6 version:
-#external_addrs = ["tcp+tls://[ipv6 address here]:8342"]
+#external_addrs = ["tcp+tls://[ipv6 address here]:8442"]
 # Combined:
-#external_addrs = ["tcp+tls://XXX.XXX.XXX.XXX:8342", "tcp+tls://[ipv6 address here]:8342"]
+#external_addrs = ["tcp+tls://XXX.XXX.XXX.XXX:8442", "tcp+tls://[ipv6 address here]:8442"]
 
 # Peer nodes to manually connect to
 #peers = []
 
 # Seed nodes to connect to for peer discovery and/or adversising our
 # own external addresses
-seeds = ["tcp+tls://lilith0.dark.fi:8342", "tcp+tls://lilith1.dark.fi:8342"]
-#seeds = [
-#    "tor://g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:8343",
-#    "tor://yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:8343",
-#]
+seeds = ["tcp+tls://lilith0.dark.fi:8442", "tcp+tls://lilith1.dark.fi:8442"]
 
 # Whitelisted network transports for outbound connections
 allowed_transports = ["tcp+tls"]
@@ -274,22 +273,33 @@ localnet = false
 # Time between peer discovery attempts
 #outbound_peer_discovery_attempt_time = 5
 
-# Mainnet blockchain network configuration
-[network_config."mainnet"]
+# Nodes to avoid interacting with for the duration of the program, in the
+# format ["host", ["scheme", "scheme"], [port, port]].
+# If scheme is left empty it will default to "tcp+tls".
+# If ports are left empty all ports from this peer will be blocked.
+#blacklist = [["example.com", ["tcp"], [8551, 23331]]]
+
+# Localnet blockchain network configuration
+[network_config."localnet"]
 # Path to the blockchain database directory
-database = "~/.local/share/darkfi/darkfid/mainnet"
+database = "~/.local/share/darkfi/darkfid/localnet"
 
 # Confirmation threshold, denominated by number of blocks
-threshold = 11
+threshold = 3
 
 # minerd JSON-RPC endpoint
-#minerd_endpoint = "tcp://127.0.0.1:28467"
+minerd_endpoint = "tcp://127.0.0.1:28467"
 
 # PoW block production target, in seconds
-pow_target = 90
+pow_target = 10
+
+# Optional fixed PoW difficulty, used for testing
+pow_fixed_difficulty = 1
 
 # Wallet address to receive mining rewards.
-#recipient = "YOUR_WALLET_ADDRESS_HERE"
+# This is a dummy one so the miner can start,
+# replace with your own one.
+recipient = "5ZHfYpt4mpJcwBNxfEyxLzeFJUEeoePs5NQ5jVEgHrMf"
 
 # Optional contract spend hook to use in the mining reward
 #spend_hook = "YOUR_SPEND_HOOK_HERE"
@@ -298,7 +308,7 @@ pow_target = 90
 #user_data = "YOUR_USER_DATA_HERE"
 
 # Skip syncing process and start node right away
-skip_sync = false
+skip_sync = true
 
 # Disable transaction's fee verification, used for testing
 skip_fees = false
@@ -315,56 +325,46 @@ skip_fees = false
 # Garbage collection task transactions batch size
 txs_batch_size = 50
 
-## Mainnet JSON-RPC settings
-[network_config."mainnet".rpc]
+## Localnet JSON-RPC settings
+[network_config."localnet".rpc]
 # JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:8440"
+rpc_listen = "tcp://127.0.0.1:8240"
 
 # Disabled RPC methods
 rpc_disabled_methods = ["p2p.get_info"]
 
-## Mainnet JSON-RPC settings for p2pool merge mining requests (optional)
-#[network_config."mainnet".mm_rpc]
+## Localnet JSON-RPC settings for p2pool merge mining requests (optional)
+#[network_config."localnet".mm_rpc]
 # JSON-RPC listen URL (merge mining)
-#rpc_listen = "http+tcp://127.0.0.1:8441"
+#rpc_listen = "http+tcp://127.0.0.1:8241"
 
 # Disabled RPC methods (merge mining)
 #rpc_disabled_methods = []
 
-## Mainnet P2P network settings
-[network_config."mainnet".net]
+## Localnet P2P network settings
+[network_config."localnet".net]
 # Path to the P2P datastore
-p2p_datastore = "~/.local/share/darkfi/darkfid/mainnet"
+p2p_datastore = "~/.local/share/darkfi/darkfid/localnet"
 
 # Path to a configured hostlist for saving known peers
-hostlist = "~/.local/share/darkfi/darkfid/mainnet/p2p_hostlist.tsv"
+hostlist = "~/.local/share/darkfi/darkfid/localnet/p2p_hostlist.tsv"
 
 # P2P accept addresses the instance listens on for inbound connections
-# You can also use an IPv6 address
-#inbound = ["tcp+tls://0.0.0.0:8442"]
-# IPv6 version:
-#inbound = ["tcp+tls://[::]:8442"]
-# Combined:
-#inbound = ["tcp+tls://0.0.0.0:8442", "tcp+tls://[::]:8442"]
+#inbound = ["tcp+tls://0.0.0.0:8242"]
 
 # P2P external addresses the instance advertises so other peers can
 # reach us and connect to us, as long as inbound addrs are configured.
-# You can also use an IPv6 address
-#external_addrs = ["tcp+tls://XXX.XXX.XXX.XXX:8442"]
-# IPv6 version:
-#external_addrs = ["tcp+tls://[ipv6 address here]:8442"]
-# Combined:
-#external_addrs = ["tcp+tls://XXX.XXX.XXX.XXX:8442", "tcp+tls://[ipv6 address here]:8442"]
+#external_addrs = []
 
 # Peer nodes to manually connect to
 #peers = []
 
 # Seed nodes to connect to for peer discovery and/or adversising our
 # own external addresses
-seeds = ["tcp+tls://lilith0.dark.fi:8442", "tcp+tls://lilith1.dark.fi:8442"]
+#seeds = []
 
 # Whitelisted network transports for outbound connections
-allowed_transports = ["tcp+tls"]
+#allowed_transports = ["tcp+tls"]
 
 # Allow transport mixing (e.g. Tor would be allowed to connect to `tcp://`)
 #transport_mixing = false
@@ -377,11 +377,17 @@ allowed_transports = ["tcp+tls"]
 
 # Outbound connection slots number, this many connections will be
 # attempted. (This does not include manual connections)
-outbound_connections = 8
+#outbound_connections = 8
 
 # Inbound connections slots number, this many active inbound connections
 # will be allowed. (This does not include manual or outbound connections)
-#inbound_connections = 0
+#inbound_connections = 8
+
+## White connection percent
+# gold_connect_count = 2
+
+## White connection percent
+# white_connect_percent = 70
 
 # Manual connections retry limit, 0 for forever looping
 #manual_attempt_limit = 0
@@ -396,16 +402,10 @@ outbound_connections = 8
 #channel_heartbeat_interval = 10
 
 # Allow localnet hosts
-localnet = false
+localnet = true
 
 # Cooling off time for peer discovery when unsuccessful
 #outbound_peer_discovery_cooloff_time = 30
 
 # Time between peer discovery attempts
 #outbound_peer_discovery_attempt_time = 5
-
-# Nodes to avoid interacting with for the duration of the program, in the
-# format ["host", ["scheme", "scheme"], [port, port]].
-# If scheme is left empty it will default to "tcp+tls". 
-# If ports are left empty all ports from this peer will be blocked.
-#blacklist = [["example.com", ["tcp"], [8551, 23331]]]

+ 1 - 1
bin/darkfid/src/main.rs

@@ -95,7 +95,7 @@ pub struct BlockchainNetwork {
     /// Optional JSON-RPC settings for p2pool merge mining requests
     mm_rpc: Option<RpcSettingsOpt>,
 
-    #[structopt(long, default_value = "10")]
+    #[structopt(long, default_value = "120")]
     /// PoW block production target, in seconds
     pow_target: u32,
 

+ 1 - 1
bin/darkfid/src/tests/mod.rs

@@ -45,7 +45,7 @@ async fn sync_blocks_real(ex: Arc<Executor<'static>>) -> Result<()> {
     init_logger();
 
     // Initialize harness in testing mode
-    let pow_target = 90;
+    let pow_target = 120;
     let pow_fixed_difficulty = Some(BigUint::one());
     let config = HarnessConfig {
         pow_target,

+ 1 - 1
bin/darkfid/src/tests/sync_forks.rs

@@ -31,7 +31,7 @@ async fn sync_forks_real(ex: Arc<Executor<'static>>) -> Result<()> {
     init_logger();
 
     // Initialize harness in testing mode
-    let pow_target = 90;
+    let pow_target = 120;
     let pow_fixed_difficulty = Some(BigUint::one());
     let config = HarnessConfig {
         pow_target,

+ 1 - 1
bin/darkfid/src/tests/unproposed_txs.rs

@@ -53,7 +53,7 @@ async fn simulate_unproposed_txs(
     let current_block_height = 1;
 
     // Create chain test harness configuration
-    let pow_target = 90;
+    let pow_target = 120;
     let pow_fixed_difficulty = Some(BigUint::one());
     let config = HarnessConfig {
         pow_target,

+ 1 - 1
script/research/gg/src/main.rs

@@ -73,7 +73,7 @@ enum Subcmd {
         /// Genesis timestamp to use, instead of current one
         genesis_timestamp: Option<u64>,
 
-        #[arg(short, long, default_value = "90")]
+        #[arg(short, long, default_value = "120")]
         /// Configured PoW target
         pow_target: u32,
     },

+ 1 - 1
src/contract/test-harness/src/lib.rs

@@ -165,7 +165,7 @@ impl Wallet {
         // Create the `Validator` instance
         let validator_config = ValidatorConfig {
             confirmation_threshold: 3,
-            pow_target: 90,
+            pow_target: 120,
             pow_fixed_difficulty: Some(BigUint::from(1_u8)),
             genesis_block,
             verify_fees,