Created
February 1, 2016 13:16
-
-
Save polarbeard/621f39b7cf21d736400e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -uNr a/bitcoin/src/main.cpp b/bitcoin/src/main.cpp | |
--- a/bitcoin/src/main.cpp b4775d56fd901d7af16136590be4645f57631004c4e0ec35332374eedc78d8574d6a2162d7bba121843f710111209336ecd6553af4b576bad81b3639d2634ad5 | |
+++ b/bitcoin/src/main.cpp 5fcc671189ae354164faa71c266bd2f6a33cdab807b2149ef639e11bc2507736a29c7fe5ee0768cbe391d694ec516e00aa86b26f602f45b61f02a0104b1ff1dc | |
@@ -2567,11 +2567,20 @@ | |
dPriority = 0; | |
} | |
- void print() const | |
+ std::string ToString() const | |
{ | |
- printf("COrphan(hash=%s, dPriority=%.1f)\n", ptx->GetHash().ToString().substr(0,10).c_str(), dPriority); | |
+ std::string str; | |
+ str += strprintf("hash=%s,dPriority=%.1f,setDependsOn={", ptx->GetHash().ToString().c_str(), dPriority); | |
+ int i = 0; | |
BOOST_FOREACH(uint256 hash, setDependsOn) | |
- printf(" setDependsOn %s\n", hash.ToString().substr(0,10).c_str()); | |
+ str += hash.ToString() + (++i == setDependsOn.size() ? "" : ","); | |
+ str += "}"; | |
+ return str; | |
+ } | |
+ | |
+ void print() const | |
+ { | |
+ printf(SINF SMEM "COrphan<%s>\n", ToString().c_str()); | |
} | |
}; | |
diff -uNr a/bitcoin/src/main.h b/bitcoin/src/main.h | |
--- a/bitcoin/src/main.h 9e438ffcc2c67d60ad299e6b1e269d00cb08a629d2e6fe169039b1fad32421e28ef0c6286fc7e53dc5e069d6d20f715e885f83b5929849d7a997daaf2e59af8a | |
+++ b/bitcoin/src/main.h a5bcc482d6baaa022dcce82356d05947ce6fb78be728b644a6fdd62af44abbc7404dea26579645e7a33d77395b64d0d2475038ef7d5c66b8131891f6cb31956a | |
@@ -164,14 +164,14 @@ | |
std::string ToString() const | |
{ | |
if (IsNull()) | |
- return strprintf("null"); | |
+ return strprintf(""); | |
else | |
- return strprintf("(nFile=%d, nBlockPos=%d, nTxPos=%d)", nFile, nBlockPos, nTxPos); | |
+ return strprintf("nFile=%d,nBlockPos=%d,nTxPos=%d", nFile, nBlockPos, nTxPos); | |
} | |
void print() const | |
{ | |
- printf("%s", ToString().c_str()); | |
+ printf(SINF SMEM "CDiskTxPos<%s>\n", ToString().c_str()); | |
} | |
}; | |
@@ -222,12 +222,12 @@ | |
std::string ToString() const | |
{ | |
- return strprintf("COutPoint(%s, %d)", hash.ToString().substr(0,10).c_str(), n); | |
+ return strprintf("hash=%s,n=%d", hash.ToString().c_str(), n); | |
} | |
void print() const | |
{ | |
- printf("%s\n", ToString().c_str()); | |
+ printf(SINF SMEM "COutPoint<%s>\n", ToString().c_str()); | |
} | |
}; | |
@@ -292,21 +292,19 @@ | |
std::string ToString() const | |
{ | |
std::string str; | |
- str += strprintf("CTxIn("); | |
- str += prevout.ToString(); | |
+ str += strprintf("prevout=%s", prevout.ToString().c_str()); | |
if (prevout.IsNull()) | |
- str += strprintf(", coinbase %s", HexStr(scriptSig).c_str()); | |
+ str += strprintf(",coinbase=%s", HexStr(scriptSig).c_str()); | |
else | |
- str += strprintf(", scriptSig=%s", scriptSig.ToString().substr(0,24).c_str()); | |
+ str += strprintf(",scriptSig=%s", scriptSig.ToString().c_str()); | |
if (nSequence != UINT_MAX) | |
- str += strprintf(", nSequence=%u", nSequence); | |
- str += ")"; | |
+ str += strprintf(",nSequence=%u", nSequence); | |
return str; | |
} | |
void print() const | |
{ | |
- printf("%s\n", ToString().c_str()); | |
+ printf(SINF SMEM "CTxIn<%s>\n", ToString().c_str()); | |
} | |
}; | |
@@ -370,13 +368,14 @@ | |
std::string ToString() const | |
{ | |
if (scriptPubKey.size() < 6) | |
- return "CTxOut(error)"; | |
- return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); | |
+ return "error"; | |
+ return strprintf("nValue=%"PRI64d".%08"PRI64d",scriptPubKey=%s", | |
+ nValue / COIN, nValue % COIN, scriptPubKey.ToString().c_str()); | |
} | |
void print() const | |
{ | |
- printf("%s\n", ToString().c_str()); | |
+ printf(SINF SMEM "CTxOut<%s>\n", ToString().c_str()); | |
} | |
}; | |
@@ -609,22 +608,20 @@ | |
std::string ToString() const | |
{ | |
std::string str; | |
- str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%d, vout.size=%d, nLockTime=%d)\n", | |
- GetHash().ToString().substr(0,10).c_str(), | |
- nVersion, | |
- vin.size(), | |
- vout.size(), | |
- nLockTime); | |
+ str += strprintf("hash=%s,ver=%d,vin.size=%d,vout.size=%d,nLockTime=%d,vin={", | |
+ GetHash().ToString().c_str(), nVersion, vin.size(), vout.size(), nLockTime); | |
for (int i = 0; i < vin.size(); i++) | |
- str += " " + vin[i].ToString() + "\n"; | |
+ str += "CTxIn<" + vin[i].ToString() + ">" + (i == vin.size() - 1 ? "" : ","); | |
+ str += "},vout={"; | |
for (int i = 0; i < vout.size(); i++) | |
- str += " " + vout[i].ToString() + "\n"; | |
+ str += "CTxOut<" + vout[i].ToString() + ">" + (i == vout.size() - 1 ? "" : ","); | |
+ str += "}"; | |
return str; | |
} | |
void print() const | |
{ | |
- printf("%s", ToString().c_str()); | |
+ printf(SINF SMEM "CTransaction<%s>\n", ToString().c_str()); | |
} | |
@@ -946,31 +943,26 @@ | |
// Check the header | |
if (!CheckProofOfWork(GetHash(), nBits)) | |
- return error("CBlock::ReadFromDisk() : errors in block header"); | |
+ return error(SBLK "failure reading block file %d from disk due errors on block header", nFile); | |
return true; | |
} | |
- | |
+ std::string ToString() const | |
+ { | |
+ std::string str; | |
+ str += strprintf("hash=%s,ver=%d,hashPrevBlock=%s,hashMerkleRoot=%s,nTime=%u,nBits=%08x,nNonce=%u,vtx={", | |
+ GetHash().ToString().c_str(), nVersion, hashPrevBlock.ToString().c_str(), | |
+ hashMerkleRoot.ToString().c_str(), nTime, nBits, nNonce, vtx.size()); | |
+ for (int i = 0; i < vtx.size(); i++) | |
+ str += strprintf("CTransaction<%s>%s", vtx[i].ToString().c_str(), i == vtx.size() - 1 ? "" : ","); | |
+ str += "}"; | |
+ return str; | |
+ } | |
void print() const | |
{ | |
- printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%d)\n", | |
- GetHash().ToString().substr(0,20).c_str(), | |
- nVersion, | |
- hashPrevBlock.ToString().substr(0,20).c_str(), | |
- hashMerkleRoot.ToString().substr(0,10).c_str(), | |
- nTime, nBits, nNonce, | |
- vtx.size()); | |
- for (int i = 0; i < vtx.size(); i++) | |
- { | |
- printf(" "); | |
- vtx[i].print(); | |
- } | |
- printf(" vMerkleTree: "); | |
- for (int i = 0; i < vMerkleTree.size(); i++) | |
- printf("%s ", vMerkleTree[i].ToString().substr(0,10).c_str()); | |
- printf("\n"); | |
+ printf(SINF SBLK "CBlock<%s>\n", ToString().c_str()); | |
} | |
@@ -1138,15 +1130,14 @@ | |
std::string ToString() const | |
{ | |
- return strprintf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nHeight=%d, merkle=%s, hashBlock=%s)", | |
- pprev, pnext, nFile, nBlockPos, nHeight, | |
- hashMerkleRoot.ToString().substr(0,10).c_str(), | |
- GetBlockHash().ToString().substr(0,20).c_str()); | |
+ return strprintf("nprev=%08x,pnext=%08x,nFile=%d,nBlockPos=%-6d,nHeight=%d,merkle=%s,hashBlock=%s", | |
+ pprev, pnext, nFile, nBlockPos, nHeight, hashMerkleRoot.ToString().c_str(), | |
+ GetBlockHash().ToString().c_str()); | |
} | |
void print() const | |
{ | |
- printf("%s\n", ToString().c_str()); | |
+ printf(SINF SBLK "CBlockIndex<%s>\n", ToString().c_str()); | |
} | |
}; | |
@@ -1207,18 +1198,17 @@ | |
std::string ToString() const | |
{ | |
- std::string str = "CDiskBlockIndex("; | |
+ std::string str; | |
str += CBlockIndex::ToString(); | |
- str += strprintf("\n hashBlock=%s, hashPrev=%s, hashNext=%s)", | |
- GetBlockHash().ToString().c_str(), | |
- hashPrev.ToString().substr(0,20).c_str(), | |
- hashNext.ToString().substr(0,20).c_str()); | |
+ str += strprintf("%s,hashBlock=%s,hashPrev=%s,hashNext=%s", | |
+ CBlockIndex::ToString().c_str(), GetBlockHash().ToString().c_str(), | |
+ hashPrev.ToString().c_str(), hashNext.ToString().c_str()); | |
return str; | |
} | |
void print() const | |
{ | |
- printf("%s\n", ToString().c_str()); | |
+ printf(SINF SBLK "CDiskBlockIndex<%s>\n", ToString().c_str()); | |
} | |
}; | |
diff -uNr a/bitcoin/src/protocol.cpp b/bitcoin/src/protocol.cpp | |
--- a/bitcoin/src/protocol.cpp e75f60d2fe430b9077aed4638530be81b51c558f5947c2cae6d7b90fbd1801ffe030c243684dfce754aa0a5c1810067b33a55526aaf7218b702f9aca67190586 | |
+++ b/bitcoin/src/protocol.cpp ee3c1538cd1dd4da0d5d1eb22ccea247188ae0ba136c59fdbb816ffe887b8d3a1f002bbddae205d80914a28a3a980cbf59c1e8d05482ae1502ce095942bec1b2 | |
@@ -247,7 +247,7 @@ | |
void CAddress::print() const | |
{ | |
- printf("CAddress(%s)\n", ToString().c_str()); | |
+ printf(SINF SADR "CAddress<%s>\n", ToString().c_str()); | |
} | |
CInv::CInv() | |
@@ -297,10 +297,10 @@ | |
std::string CInv::ToString() const | |
{ | |
- return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,20).c_str()); | |
+ return strprintf("%s %s", GetCommand(), hash.ToString().c_str()); | |
} | |
void CInv::print() const | |
{ | |
- printf("CInv(%s)\n", ToString().c_str()); | |
+ printf(SINF SNET "CInv<%s>\n", ToString().c_str()); | |
} | |
diff -uNr a/bitcoin/src/script.h b/bitcoin/src/script.h | |
--- a/bitcoin/src/script.h 796b2ab92a49e29b5873be0d63d732d1b973855de76062492190687c57fdbefc069091df6306a0eee86ad5717c8fa90774ea9b8589cba2d9138b544c37e7177f | |
+++ b/bitcoin/src/script.h 4adcaa44fcd72201070c09c4106a524266290963748bb76a27bdea8f5bd8c9ebe562313041da319c51d1f9e9368c170ba797e10894812925ad365d350e1b0574 | |
@@ -652,7 +652,7 @@ | |
void PrintHex() const | |
{ | |
- printf("CScript(%s)\n", HexStr(begin(), end(), true).c_str()); | |
+ printf(SINF SMEM "CScript<%s>\n", HexStr(begin(), end(), true).c_str()); | |
} | |
std::string ToString() const | |
@@ -680,7 +680,7 @@ | |
void print() const | |
{ | |
- printf("%s\n", ToString().c_str()); | |
+ printf(SINF SMEM "CScript<%s>\n", ToString().c_str()); | |
} | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PGP SIGNATURE----- | |
Version: GnuPG v1 | |
iQIcBAABAgAGBQJWr1ijAAoJEBHMkEKSnTaCNAMP/jBQw/1You5GN2FixVinjZfA | |
c/bp2KGNxXkmMaF38rvqiyNFmx23JuwfBWYvKaOpKB8V9WWHYRSWJiZClZcTVY/s | |
90ugSzRmYNpfA5uySFESQUj0oWhL/7DLUde3euswcHr4pvV62geuVGvnZRWDwzNY | |
37G4qitH2Te7ij73FKBxSonBx0EZzoYHkkfpHBReiz8ImfxvLMRpzRU2m4SsJrZS | |
cyW+qaEz4cD0r44XZ5UE6gObWHDCdrzaw/r2vXZa5Y4GQk0qUvkPSCOxxk4tprXO | |
7ITungTF5379Pkj3+8PZ94FhDLONiyJMoO8jEhsFA+dg5n5LSybyQqXD9HMFaiah | |
IaVBWB3VFPWQDs7kAO7WZ4IOHfm5+dsvyfilED1ZkBXjjUsW1y9omzO3F+Uc6A+5 | |
sQ0bGZUzhwe/sGbH20TWLIbIdvYPQUWGhMAeUVTCs370n9e0d19UKE6wufwe1BYE | |
1+oO1ol/7lcwNz6zqapz4N48e8OleaVZQGPiPtm1uYsLGKo92/Cx2FDHsSpecLJZ | |
tFlxnX74WQHL5aisgVWfyqyIJYEascaCg8WMqmzASgr22UUK2VxlaQKlXfHr9TKl | |
WWUrlN3e89JFNwMa/3gntjEEIPAe+BB/uTCMXjfe7Oq8btwqoApZ+iEPuC+FA9TJ | |
+c7MS+FszoyJgrthDnie | |
=1a9L | |
-----END PGP SIGNATURE----- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment