diff --git a/accounts/usbwallet/wallet.go b/accounts/usbwallet/wallet.go index 5997a2a676..04e8b60517 100644 --- a/accounts/usbwallet/wallet.go +++ b/accounts/usbwallet/wallet.go @@ -343,6 +343,8 @@ func (w *wallet) selfDerive() { context = context.Background() nextAddrs = append([]common.Address{}, w.deriveNextAddrs...) ) + // Deep-copy derivation paths so updates inside this section don't mutate + // w.deriveNextPaths while we only hold stateLock.RLock. nextPaths := make([]accounts.DerivationPath, len(w.deriveNextPaths)) for i, path := range w.deriveNextPaths { nextPaths[i] = append(accounts.DerivationPath(nil), path...)