Wallet: Ensure m_attaching_chain is set before registering for signals
Wallet: Ensure m_attaching_chain is set before registering for signals

Avoids a race where chainStateFlushed could be called before rescanning began, yet rescan gets interrupted or fails

Github-Pull: #25088
Rebased-From: ba10b90915dae6a802ecb0f80f72a1a9ea5a4c67

bitcoinknots/bitcoin,bitcoinknots/bitcoin,bitcoinknots/bitcoin,bitcoinknots/bitcoin,bitcoinknots/bitcoin