Hello,
In bitcoin core v0.1 in the file main.cpp starting at line 2514 there is a function CreatTransaction there is a part as follows
// Fill vin
foreach(CWalletTx* pcoin, setCoins)
for (int nOut = 0; nOut < pcoin->vout.size(); nOut++)
if (pcoin->vout[nOut].IsMine())
wtxNew.vin.push_back(CTxIn(pcoin->GetHash(), nOut));
I believe this is where a new adress is created for the change, is that correct? If so, how is it created exactly? I mean I am scanning the code to find where exactly is computed the private key of the change adress.