I just finished block synchronization on mainnet by default, but I realized I want to try on testnet first. Should I do synchronization on testnet again? Or how can I connect to testnet?
Thanks a lot.
They are completely separate networks, they just utilize the same protocols but have completely different state. So you have to synchronize both separately. Synchronizing one will not influence the other, although depending on your hardware you may not be able to keep both networks synchronized at the same time.
Every chain is a different network with a different network ID to identify them. When you sync a chain (mainnet in your case), your data will be saved in a datadir along with the configuration of the chain and the first block. When you try to sync another chain to the same datadir, they would start with a different block (the genesis block), and you'll immediately see an error message: Error starting protocol stack: database contains incompatible genesis
.
You can specify a testnet running geth --goerli
or geth --rinkeby
depending on which testnet you want to sync.