Merge all Komodo changes, including proof of stake, crypto conditions, passport, etc.
This commit is contained in:
@@ -414,7 +414,7 @@ void CWallet::ChainTip(const CBlockIndex *pindex, const CBlock *pblock,
|
||||
{
|
||||
if (added) {
|
||||
IncrementNoteWitnesses(pindex, pblock, tree);
|
||||
} else if ( ASSETCHAINS_SYMBOL[0] == 0 || nWitnessCacheSize > 1 ){
|
||||
} else if ( nWitnessCacheSize > 1 ){ //ASSETCHAINS_SYMBOL[0] == 0 ||
|
||||
DecrementNoteWitnesses(pindex);
|
||||
} else fprintf(stderr,"would have decremented %s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize);
|
||||
}
|
||||
@@ -719,7 +719,7 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex,
|
||||
const CBlock* pblock {pblockIn};
|
||||
CBlock block;
|
||||
if (!pblock) {
|
||||
ReadBlockFromDisk(block, pindex);
|
||||
ReadBlockFromDisk(block, pindex,1);
|
||||
pblock = █
|
||||
}
|
||||
|
||||
@@ -1883,7 +1883,7 @@ void CWallet::WitnessNoteCommitment(std::vector<uint256> commitments,
|
||||
|
||||
while (pindex) {
|
||||
CBlock block;
|
||||
ReadBlockFromDisk(block, pindex);
|
||||
ReadBlockFromDisk(block, pindex,1);
|
||||
|
||||
BOOST_FOREACH(const CTransaction& tx, block.vtx)
|
||||
{
|
||||
@@ -1959,7 +1959,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
||||
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), pindex, false) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
||||
|
||||
CBlock block;
|
||||
ReadBlockFromDisk(block, pindex);
|
||||
ReadBlockFromDisk(block, pindex,1);
|
||||
BOOST_FOREACH(CTransaction& tx, block.vtx)
|
||||
{
|
||||
if (AddToWalletIfInvolvingMe(tx, &block, fUpdate))
|
||||
@@ -3175,14 +3175,26 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
|
||||
}
|
||||
|
||||
|
||||
|
||||
void komodo_prefetch(FILE *fp);
|
||||
|
||||
DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||
{
|
||||
if (!fFileBacked)
|
||||
return DB_LOAD_OK;
|
||||
fFirstRunRet = false;
|
||||
if ( 0 ) // doesnt help
|
||||
{
|
||||
fprintf(stderr,"loading wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
|
||||
FILE *fp;
|
||||
if ( (fp= fopen(strWalletFile.c_str(),"rb")) != 0 )
|
||||
{
|
||||
komodo_prefetch(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"prefetched wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
|
||||
DBErrors nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this);
|
||||
//fprintf(stderr,"loaded wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
|
||||
if (nLoadWalletRet == DB_NEED_REWRITE)
|
||||
{
|
||||
if (CDB::Rewrite(strWalletFile, "\x04pool"))
|
||||
@@ -3669,6 +3681,42 @@ void CWallet::ListLockedCoins(std::vector<COutPoint>& vOutpts)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Note Locking Operations
|
||||
|
||||
void CWallet::LockNote(JSOutPoint& output)
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // setLockedNotes
|
||||
setLockedNotes.insert(output);
|
||||
}
|
||||
|
||||
void CWallet::UnlockNote(JSOutPoint& output)
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // setLockedNotes
|
||||
setLockedNotes.erase(output);
|
||||
}
|
||||
|
||||
void CWallet::UnlockAllNotes()
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // setLockedNotes
|
||||
setLockedNotes.clear();
|
||||
}
|
||||
|
||||
bool CWallet::IsLockedNote(uint256 hash, size_t js, uint8_t n) const
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // setLockedNotes
|
||||
JSOutPoint outpt(hash, js, n);
|
||||
|
||||
return (setLockedNotes.count(outpt) > 0);
|
||||
}
|
||||
|
||||
std::vector<JSOutPoint> CWallet::ListLockedNotes()
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // setLockedNotes
|
||||
std::vector<JSOutPoint> vOutpts(setLockedNotes.begin(), setLockedNotes.end());
|
||||
return vOutpts;
|
||||
}
|
||||
|
||||
/** @} */ // end of Actions
|
||||
|
||||
class CAffectedKeysVisitor : public boost::static_visitor<void> {
|
||||
@@ -3959,6 +4007,11 @@ void CWallet::GetFilteredNotes(
|
||||
if (ignoreUnspendable && !HaveSpendingKey(pa)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip locked notes
|
||||
if (IsLockedNote(jsop.hash, jsop.js, jsop.n)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int i = jsop.js; // Index into CTransaction.vjoinsplit
|
||||
int j = jsop.n; // Index into JSDescription.ciphertexts
|
||||
|
||||
Reference in New Issue
Block a user