Exception 进程已完成,密码中的退出代码为1073741819(0xC0000005)

Exception 进程已完成,密码中的退出代码为1073741819(0xC0000005),exception,cryptocurrency,memory-access,Exception,Cryptocurrency,Memory Access,我和一个朋友正试图从头开始加密,但我们遇到了一个错误。我们已经把问题追查到了我们班上 class Block { string previousHash; ist <Transaction> transactions; int difficulty; string currentHash = getHash(); time_t timeFound; list <int> triedFillers; list <

我和一个朋友正试图从头开始加密,但我们遇到了一个错误。我们已经把问题追查到了我们班上

class Block {
    string previousHash;
    ist <Transaction> transactions;
    int difficulty;
    string currentHash = getHash();
    time_t timeFound;
    list <int> triedFillers;
    list <string> fillerHashes;
    int filler = 0;
    bool found = false;
    string hash;

public:
    Block () {
    }

    bool foundHash() {
        return found;
    }

    int getFiller() {
        return filler;
    }

    vector <string> getFillerHashResults() {
        vector <string > vecOfStr(fillerHashes.begin(), fillerHashes.end());
        return vecOfStr;
    }

    vector <int> triedFillerHashes() {
        vector <int> vecOfStr(triedFillers.begin(), triedFillers.end());
        return vecOfStr;
    }

    int getDifficulty() {
        return difficulty;
    };
    void setDifficulty(int difficulty) {
        found = false;
        this->difficulty = difficulty;
    };

    void setPreviousHash(string previousHash) {
        found = false;
        this->previousHash = previousHash;
    }
    string getPreviousHash() {
        return previousHash;
    }

    void addTransaction(Transaction transaction) {
        found = false;
        this->transactions.push_back(transaction);
    }
    void removeTransaction(int position) {
        cout << "Not implemented yet \n";
    }

    vector<Transaction> getTransactions() {
        vector <Transaction > vecOfStr(transactions.begin(), transactions.end());
        return vecOfStr;
    }

    string getHash() {
        if (!found) {
            triedFillers.clear();
            fillerHashes.clear();

            Transaction *transactionsHashes = new Transaction[this->transactions.size()];
            int l = 0;
            for (Transaction const &i: this->transactions) {
                transactionsHashes[l++] = i;
            }

            string all = previousHash;
            for (unsigned int i = 0; i < this->transactions.size(); i++) {
                all += "\n" + transactionsHashes[i].getHash();
            }

            stringstream ss;
            ss << hex << difficulty;
            string diff = ss.str();
            while (sha256(all + to_string(filler)) < diff) {
                triedFillers.push_back(filler);
                fillerHashes.push_back(sha256(all + to_string(filler)));
                filler++;
            }

            timeFound = time(NULL);
            hash = sha256(all);

            return sha256(all);

        } else {
            return hash;
        }
    }
    string forceFindNewHash() {
        found = false;
        return getHash();
    }
};
类块{
字符串前置哈希;
ist交易;
智力困难;
字符串currentHash=getHash();
时间发现;
列出三个点火器;
列出垃圾清单;
int filler=0;
bool-found=false;
字符串散列;
公众:
块(){
}
bool foundHash(){
发现退货;
}
int getFiller(){
回流填料;
}
向量getFillerHashResults(){
向量vecOfStr(fillerhash.begin(),fillerhash.end());
返回向量;
}
向量TriedFileRhashes(){
向量vecOfStr(triedFillers.begin(),triedFillers.end());
返回向量;
}
int getcombiness(){
返回困难;
};
虚空难度(智力难度){
发现=错误;
这->困难=困难;
};
void setPreviousHash(字符串previousHash){
发现=错误;
此->previousHash=previousHash;
}
字符串getPreviousHash(){
返回以前的哈希;
}
void addTransaction(事务处理){
发现=错误;
此->事务。推回(事务);
}
无效删除事务(内部位置){
cout transactions.size();
int l=0;
对于(事务const&i:此->事务){
transactionsHashes[l++]=i;
}
string all=previousHash;
for(unsigned int i=0;itransactions.size();i++){
all+=“\n”+事务哈希[i].getHash();
}
细流ss;

ss您的调试器应该能够向您显示错误发生的确切行。“读取位置0x8”表示取消引用空指针。