Skip to content

Commit

Permalink
learnt to hash in cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
110CodingP committed Apr 26, 2024
1 parent 331b9b0 commit 24968dd
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 8,141 deletions.
Binary file modified mine
Binary file not shown.
55 changes: 45 additions & 10 deletions mine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,64 @@
#include <vector>
using namespace std;

//create a serialise function to serialise txns

struct Output {
int Amount;
string ScriptPubKey;
}

struct Input {
string txId;
int vOut;
string scriptSig;
string sequence;
vector<string> witness;
vector<Output> prevout;
string scriptSigAsm;
bool isCoinbase;
}

struct Txn {
int version;
int locktime;
vector<Input> vin;
vector<Output> vout;

}

string serialise(string content) {
string serialised;
int sz = content.size();
return serialised;
}

int main() {

freopen("output.txt","w",stdout);

ifstream myfile;
myfile.open("txns.txt");
string mystring;

string filename;
vector<string> txns;

while (myfile.good()) {
getline(myfile,mystring);
txns.push_back(mystring);
getline(myfile,filename);
txns.push_back(filename);
}
myfile.close();

for (string txn: txns) {
string filename = "mempool/" + txn;
myfile.open(filename);
//getline(myfile,mystring);
//cout<<mystring<<'\n';
for (string txn: txns) {//man this outer loop is running approx 8000 times!
string path = "mempool/" + txn;
myfile.open(path);
string content;
while (myfile.good()) {
string line;
getline(myfile,line);
content+=line;
}
serialise(content);

myfile.close();
}
return 0;
}
Loading

0 comments on commit 24968dd

Please sign in to comment.