This assumes a lot, sorry but it does. Do you know this without a shadow of a doubt "They re-generated the same keypool twice, probably by using their trading database to construct new transactions before the chain was fully synced." Because you really don't know thats how it worked.
For ExD is this the piece of code you were looking for?
Why are you asking him? It would take him "hours" to understand it.
Let's look at this code and see where these two snippets deviate (pasted at the bottom of this post).
The difference between the two is the potential for "reuse". Let's see where that function is called in the entire codebase:
init.cpp: if (!pwalletMain->GetKeyFromPool(newDefaultKey, false))
main.cpp: pwalletMain->GetKeyFromPool(mapReuseKey[pfrom->addr], true);
rpcwallet.cpp: if (!pwalletMain->GetKeyFromPool(newKey, false))
rpcwallet.cpp: if (!pwalletMain->GetKeyFromPool(newKey, false))
rpcwallet.cpp: if (!pwalletMain->GetKeyFromPool(account.vchPubKey, false))
wallet.cpp: if (GetKeyFromPool(newDefaultKey, false))
Hmm. Not much thinking required here. The only place where "reuse" is true is in main.cpp. When does that happen?
else if (strCommand == "checkorder")
{
uint256 hashReply;
vRecv >> hashReply;
if (!GetBoolArg("-allowreceivebyip"))
{
pfrom->PushMessage("reply", hashReply, (int)2, string(""));
return true;
}
CWalletTx order;
vRecv >> order;
/// we have a chance to check the order here
// Keep giving the same key to the same ip until they use it
if (!mapReuseKey.count(pfrom->addr))
pwalletMain->GetKeyFromPool(mapReuseKey[pfrom->addr], true); <<== HERE ###
// Send back approval of order and pubkey to use
CScript scriptPubKey;
scriptPubKey << mapReuseKey[pfrom->addr] << OP_CHECKSIG;
pfrom->PushMessage("reply", hashReply, (int)0, scriptPubKey);
}
Interesting, what function is this part of?
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
So the only time this difference is applicable is when a different node (different computer) makes a message called "checkorder".
The RPC commands are different from peer messaging. RPC commands are done in the appropriately named module called "rpcwallet.cpp". So this "reuse" flag does not apply to RPC commands as ExD might claim upon seeing but not understanding this code.
bool CWallet::GetKeyFromPool(CPubKey& result)
{
int64_t nIndex = 0;
CKeyPool keypool;
{
LOCK(cs_wallet);
ReserveKeyFromKeyPool(nIndex, keypool);
if (nIndex == -1)
{
if (IsLocked()) return false;
result = GenerateNewKey();
return true;
}
KeepKey(nIndex);
result = keypool.vchPubKey;
}
return true;
}
bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse)
{
int64 nIndex = 0;
CKeyPool keypool;
{
LOCK(cs_wallet);
ReserveKeyFromKeyPool(nIndex, keypool);
if (nIndex == -1)
{
if (fAllowReuse && vchDefaultKey.IsValid())
{
result = vchDefaultKey;
return true;
}
if (IsLocked()) return false;
result = GenerateNewKey();
return true;
}
KeepKey(nIndex);
result = keypool.vchPubKey;
}
return true;