A state of war is not necessary for treason to occur. Penalties are worse during war but it can occur during peace time as well.
A guy that used to work for me has finished up a quarter century in a federal prison for initiating a contact with the KGB and selling them highly classified information. He was convicted in 1986, when there was no declared war underway. Don’t know when he’ll be released but I hope it’s still a long way off.