From 73e1f33dc88b47df554be5d10a749561eeffd1e8 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 15 Jul 2013 20:14:57 -0300 Subject: [PATCH] removed vin and vout from CTransaction genesis block broken --- src/bloom.cpp | 8 +-- src/chainparams.cpp | 113 +++++------------------------------ src/checkqueue.h | 4 ++ src/core.cpp | 48 ++++----------- src/core.h | 34 ++++++----- src/main.cpp | 90 +++++++++++++++++++++++----- src/main.h | 3 +- src/qt/bitcoin.cpp | 3 +- src/qt/transactiondesc.cpp | 9 ++- src/qt/transactionrecord.cpp | 15 ++--- src/rpcmining.cpp | 8 ++- src/rpcrawtransaction.cpp | 24 +++++--- src/rpcwallet.cpp | 13 ++-- src/script.cpp | 15 ++--- src/util.cpp | 10 ++-- src/wallet.cpp | 40 +++++++++---- src/wallet.h | 29 ++++++--- 17 files changed, 238 insertions(+), 228 deletions(-) diff --git a/src/bloom.cpp b/src/bloom.cpp index b6799e14..515620ae 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -101,7 +101,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx, const uint256& ha // for finding tx when they appear in a block if (contains(hash)) fFound = true; - +/* for (unsigned int i = 0; i < tx.vout.size(); i++) { const CTxOut& txout = tx.vout[i]; @@ -133,10 +133,10 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx, const uint256& ha } } } - +*/ if (fFound) return true; - +/* BOOST_FOREACH(const CTxIn& txin, tx.vin) { // Match if the filter contains an outpoint tx spends @@ -155,6 +155,6 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx, const uint256& ha return true; } } - +*/ return false; } diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 3bb62fb7..a33a7ea7 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -16,81 +16,7 @@ unsigned int pnSeed[] = { - 0xe473042e, 0xb177f2ad, 0xd63f3fb2, 0xf864f736, 0x44a23ac7, 0xcf6d9650, 0xd648042e, 0x0536f447, - 0x3c654ed0, 0x3e16a5bc, 0xa38e09b0, 0xdfae795b, 0xabfeca5b, 0x94ad7840, 0xf3b9f1c7, 0xbe70e0ad, - 0x3bbd09b0, 0x8d0c7dd5, 0x3b2a7332, 0x1a06175e, 0x581f175e, 0xca0d2dcc, 0x0fdbc658, 0xcf591ec7, - 0x295a12b2, 0xb4707bce, 0x68bb09b0, 0x4e735747, 0x89709553, 0x05a7814e, 0x5b8ec658, 0x402c5512, - 0xe80d0905, 0x17681a5e, 0xc02aa748, 0x9f811741, 0x5f321cb0, 0x23e1ee47, 0xaf7f170c, 0xaa240ab0, - 0xedea6257, 0x76106bc1, 0x2cf310cc, 0x08612acb, 0x9c682e4e, 0x8e963c6c, 0x443c795b, 0x22e246b8, - 0xfa1f2dcc, 0x90118140, 0x3821042e, 0x33c3fd2e, 0x10046d5b, 0x40d14b3e, 0x7fb8f8ce, 0x67696550, - 0xeeecbe58, 0x4f341745, 0x46b8fbd5, 0xc8463932, 0x6b73e862, 0x4c715932, 0x4a6785d5, 0xce3a64c2, - 0xde9604c7, 0x9b06884f, 0x18002a45, 0xea9bc345, 0xc4f1c658, 0xe475c1c7, 0xdd3e795b, 0x9722175e, - 0x34562f4e, 0x66c46e4e, 0x40bb1243, 0x7d9171d0, 0x17b8dbd5, 0x63cbfd2e, 0x1a08b8d8, 0x6175a73b, - 0x228d2660, 0x8627c658, 0x9c566644, 0x38cca5bc, 0x3089de5b, 0x92e25f5d, 0xa393f73f, 0xcc92dc3e, - 0x27487446, 0x62cbfd2e, 0x9d983b45, 0xf72a09b0, 0xf75f042e, 0x6434bb6a, 0xb29e77d8, 0x19be4fd9, - 0x76443243, 0x9dd72645, 0x694cef43, 0x89c2efd5, 0x5f1c5058, 0x46c6e45b, 0xe1391b40, 0x77ccefd5, - 0x472e5a6d, 0x85709553, 0xdd4f5d4c, 0x64ef5a46, 0x7f0ae502, 0xcf08d850, 0x3460042e, 0xeafa2d42, - 0x793c9044, 0x9d094746, 0x1ab9b153, 0xbfe9a5bc, 0x34771fb0, 0xb7722e32, 0x1168964b, 0x19b06ab8, - 0x19243b25, 0x13188045, 0xb4070905, 0x728ebb5d, 0x44f24ac8, 0xa317fead, 0x642f6a57, 0x3d951f32, - 0x3d312e4e, 0xfac4d048, 0xefc4dd50, 0x52b9f1c7, 0xc14d3cc3, 0x0219ea44, 0x3b79d058, 0xfa217242, - 0x39c80647, 0xfb697252, 0x1d495a42, 0x0aa81f4e, 0x58249ab8, 0xe6a8e6c3, 0x2bc4dad8, 0x85963c6c, - 0xa4ce09b0, 0x2005f536, 0x5cc2703e, 0x1992de43, 0x74e86b4c, 0xe7085653, 0xf5e15a51, 0xb4872b60, - 0x29e2b162, 0xa07ea053, 0x8229fd18, 0x4562ec4d, 0x8dec814e, 0x36cfa4cf, 0x96461032, 0x3c8770de, - 0xd10a1f5f, 0x95934641, 0x97cd65d0, 0x2e35324a, 0x2566ba1f, 0x1ca1a9d1, 0xb808b8d5, 0xf9a24a5d, - 0xafc8d431, 0xe4b8d9b2, 0x0f5321b2, 0x330bc658, 0x74b347ce, 0x972babd5, 0x044f7d4f, 0x06562f4e, - 0x8b8d3c6c, 0x3507c658, 0xe4174e4d, 0xf1c009b0, 0x52249ab8, 0x27211772, 0xf6a9ba59, 0x7a391b40, - 0x855dc6c0, 0x291f20b2, 0xe29bc345, 0x90963c6c, 0x0af70732, 0x4242a91f, 0x4c531d48, 0xa32df948, - 0x627e3044, 0x65be1f54, 0x1a0cbf83, 0x6a443532, 0x8d5f1955, 0xbafa8132, 0x3534bdd5, 0xca019dd9, - 0x8a0d9332, 0x5584e7d8, 0x7cd1f25e, 0xeabe3fb2, 0x2945d0d1, 0x46415718, 0x70d6042e, 0x99eb76d0, - 0x9ece09b0, 0xb3777418, 0x5e5e91d9, 0x237a3ab0, 0xf512b62e, 0x45dec347, 0x59b7f862, 0x4c443b25, - 0x3cc6484b, 0x9a8ec6d1, 0x021eea44, 0xc9483944, 0xfd567e32, 0xfd204bb2, 0xc5330bcc, 0x5202894e, - 0xf9e309b0, 0x4cc17557, 0xdb9064ae, 0xe19e77d8, 0x25857f60, 0xeb4a15ad, 0x1f47f554, 0xea4472d9, - 0xd20de593, 0xf5733b25, 0x11892b54, 0x5729d35f, 0xe6188cd1, 0x488b132e, 0x541c534a, 0xa8e854ae, - 0xa255a66c, 0x33688763, 0xc6629ac6, 0xc20a6265, 0xcd92a059, 0x72029d3b, 0x4c298f5e, 0x51452e4e, - 0xbb065058, 0x15fd2dcc, 0xf40c135e, 0x615a0bad, 0x0c6a6805, 0x4971a7ad, 0x17f2a5d5, 0xf8babf47, - 0xb61f50ad, 0x4e1451b1, 0xf72d9252, 0x5c2abe58, 0xbd987c61, 0x084ae5cf, 0x20781fb0, 0x38b0f160, - 0x18aac705, 0x14f86dc1, 0x5556f481, 0x0a36c144, 0xeb446e4c, 0x2c1c0d6c, 0xbd0ff860, 0x869f92db, - 0x36c94f4c, 0x05502444, 0x148fe55b, 0xd5301e59, 0xd57a8f45, 0x110dc04a, 0x8670fc36, 0xee733b25, - 0xca56f481, 0x2a5c3bae, 0x844b0905, 0x1e51fe53, 0x0241c244, 0x59c0614e, 0x94e70a55, 0x7312fead, - 0xb735be44, 0xa55d0905, 0x2f63962e, 0x14a4e15b, 0x63f8f05c, 0x62d0d262, 0x3cab41ad, 0x87f1b1cb, - 0x018da6b8, 0xb3967dd5, 0xcb56f481, 0x685ad718, 0x3b4aeeca, 0x8d106bc1, 0x51180905, 0x72660f48, - 0x1521a243, 0x5b56f481, 0x6390e560, 0xdd61464e, 0x58353b25, 0x553fc062, 0x27c45d59, 0xacc62e4e, - 0x0d5a1cd9, 0x7f65f442, 0xbdeef660, 0xf1bd1855, 0xf8473cae, 0x13b120b2, 0x442440d0, 0x53fd4352, - 0xa305fc57, 0x458be84d, 0x639ce1c3, 0xebaaee47, 0x95e2c247, 0xf056f481, 0x6256f481, 0x1d87c65e, - 0x0a453418, 0x5beb175e, 0xd64f1618, 0xc360795b, 0x2fbf5753, 0xa8c58e53, 0x651cec52, 0x9d37b043, - 0x124a9758, 0x5242e4a9, 0x89913c6c, 0x880efe2e, 0x2f2f2f0c, 0x72b26751, 0x2896e46d, 0x80f4166c, - 0x320d59ad, 0xc50151d0, 0x11a8aa43, 0xccf56057, 0x5fbad118, 0x4719b151, 0x2b5f4bc0, 0x4d7a4a50, - 0xad06e047, 0x62ef5a46, 0x5aebde58, 0xdf7aa66c, 0x851acb50, 0x66b9a559, 0x3e9bb153, 0xcc512f2e, - 0xc073b08e, 0xd519be58, 0xe981ea4d, 0x12fd50cb, 0x378739ad, 0x06683cae, 0xa22310b2, 0xc185c705, - 0x8741b545, 0xa26c8318, 0x22d5bc43, 0x39201ec0, 0x68581e3e, 0xdc9bcf62, 0xd508cc82, 0xb149675b, - 0x4c9609b0, 0x84feb84c, 0x08291e2e, 0xfd2253b2, 0x1fd269c1, 0xc9483932, 0x4d641fb0, 0x7d37c918, - 0xa9de20ad, 0x77e2d655, 0x6d421b59, 0xd7668f80, 0xced09b62, 0xa9e5a5bc, 0xa4074e18, 0x60fc5ecc, - 0x01300148, 0x68062444, 0xb4224847, 0xed3aa443, 0xb772fb43, 0x9f56f481, 0x220dfd18, 0x8e1c3d6c, - 0xc44f09b0, 0x7df2bb73, 0xe22fb844, 0xea534242, 0xb6a755d4, 0xa036654b, 0x138ece5b, 0xda65d3c3, - 0x955871bc, 0x792124b0, 0xfc82594c, 0x851d494b, 0x2c7aee47, 0x26af46b8, 0x1416252e, 0xa8abb944, - 0x36c49d25, 0x674f645d, 0x363646b8, 0x9e1a2942, 0x66d0c154, 0xc6c2a545, 0x3570f2ad, 0xe7d547c7, - 0x7d104932, 0x18cb9c18, 0x1dcfa4cf, 0xd156f481, 0x2a02b91f, 0x3eeb3fa8, 0xcac4175e, 0x34146d42, - 0x994c4d46, 0x5666f440, 0x85d6713e, 0x5ecb296c, 0x0ea0ae46, 0x87e69f42, 0xc58409b0, 0x1f3436ae, - 0x21dc6a57, 0x4ad1cd42, 0xfb8c1a4c, 0x52d3dab2, 0x3769894b, 0xb52f1c62, 0x3677916d, 0x82b3fe57, - 0x493d4ac6, 0x9f963c6c, 0x5d91ff60, 0x458e0dad, 0xa49d0947, 0x491a3e18, 0x4aadcd5b, 0x0e46494b, - 0x1d1610ad, 0x1a10af5d, 0x4956f481, 0x207a3eae, 0x77e73244, 0xfa3b8742, 0x3261fc36, 0xfcebf536, - 0x1662e836, 0xf655f636, 0xa2dbd0ad, 0x23036693, 0x30448432, 0xa2b03463, 0x30730344, 0x8e4a6882, - 0x0c50a1cb, 0xc8d8c06b, 0xc9cd6191, 0xf443db50, 0xa9553c50, 0x23145847, 0xc35da66c, 0x29c12a60, - 0x55c2b447, 0x7434f75c, 0x61660640, 0xde2a7018, 0xc639494c, 0x1c306fce, 0x19b89244, 0xd29a6462, - 0x462cd1b2, 0x29902f44, 0x2817fa53, 0x21a30905, 0x7777ae46, 0x288443a1, 0x7bee5148, 0xc2a8b043, - 0xf5c3d35f, 0x2311ef84, 0x57de08a4, 0x6b221bb2, 0xf2625846, 0x4b9e09b0, 0xa24f880e, 0x22b11447, - 0xb3a0c744, 0x919e77d8, 0xec8b64ae, 0xff5c8d45, 0x7b15b484, 0x32679a5f, 0xba80b62e, 0x05c25c61, - 0x60014746, 0x5e8fb04c, 0xe67c0905, 0x4329c658, 0xac8fe555, 0xf875e647, 0x67406386, 0x35ceea18, - 0xbb79484b, 0xd7b9fa62, 0x238209b0, 0x208a1d32, 0x9630995e, 0x039c1318, 0x6e48006c, 0x60582344, - 0xadbb0150, 0x853fd462, 0x03772e4e, 0x652ce960, 0x49b630ad, 0x9993af43, 0x3735b34b, 0x548a07d9, - 0x55a44aad, 0xa23d1bcc, 0xfdbb2f4e, 0x530b24a0, 0x0a44b451, 0x6827c657, 0x1f66494b, 0x4e680a47, - 0x77e7b747, 0xa5eb3fa8, 0x6649764a, 0xd4e76c4b, 0x2c691fb0, 0xf1292e44, 0xc6d6c774, 0x85d23775, - 0x28275f4d, 0x259ae46d, 0x02424e81, 0x5f16be58, 0xe707c658, 0x49eae5c7, 0xd5d147ad, 0x9a7abdc3, - 0xe8ac7fc7, 0x84ec3aae, 0xc24942d0, 0x294aa318, 0x08ac3d18, 0x8894042e, 0xb24609b0, 0x9bcaab58, - 0xc400f712, 0xd5c512b8, 0x2c02cc62, 0x25080fd8, 0xed74a847, 0x18a5ec5e, 0x9850ec6d, 0xf8909758, - 0x7f56f481, 0x4496f23c, 0xae27784f, 0xcb7cd93e, 0x06e32860, 0x50b9a84f, 0x3660434a, 0x09161f5f, - 0x900486bc, 0x08055459, 0xe7ec1017, 0x7e39494c, 0x4f443b25, 0x14751a8a, 0x717d03d4, 0xbd0e24d8, - 0x054b6f56, 0x854c496c, 0xd92a454a, 0xc39bd054, 0x6093614b, 0x9dbad754, 0x5bf0604a, 0x99f22305 + 0x0300a8c0 // 192.168.0.3 (default port) }; class CMainParams : public CChainParams { @@ -99,13 +25,13 @@ public: // The message start string is designed to be unlikely to occur in normal data. // The characters are rarely used upper ASCII, not valid as UTF-8, and produce // a large 4-byte int at any alignment. - pchMessageStart[0] = 0xf9; - pchMessageStart[1] = 0xbe; - pchMessageStart[2] = 0xb4; - pchMessageStart[3] = 0xd9; + pchMessageStart[0] = 0xf0; + pchMessageStart[1] = 0xda; + pchMessageStart[2] = 0xbb; + pchMessageStart[3] = 0xd2; vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284"); - nDefaultPort = 8333; - nRPCPort = 8332; + nDefaultPort = 28333; + nRPCPort = 28332; bnProofOfWorkLimit = CBigNum(~uint256(0) >> 32); nSubsidyHalvingInterval = 210000; @@ -117,13 +43,9 @@ public: // CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73) // CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B) // vMerkleTree: 4a5e1e - const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; + const char* pszTimestamp = "The Times 14/Jul/2013 Globo caught bribing Receita Federal employee to rob R$615M tax evasion documents."; CTransaction txNew; - txNew.vin.resize(1); - txNew.vout.resize(1); - txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); - txNew.vout[0].nValue = 50 * COIN; - txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG; + txNew.message = CScript() << vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); genesis.vtx.push_back(txNew); genesis.hashPrevBlock = 0; genesis.hashMerkleRoot = genesis.BuildMerkleTree(); @@ -133,13 +55,10 @@ public: genesis.nNonce = 2083236893; hashGenesisBlock = genesis.GetHash(); - assert(hashGenesisBlock == uint256("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")); - assert(genesis.hashMerkleRoot == uint256("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); + //assert(hashGenesisBlock == uint256("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")); + //assert(genesis.hashMerkleRoot == uint256("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); - vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be")); - vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me")); - vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org")); - vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org")); + //vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be")); base58Prefixes[PUBKEY_ADDRESS] = 0; base58Prefixes[SCRIPT_ADDRESS] = 5; @@ -196,12 +115,12 @@ public: genesis.nTime = 1296688602; genesis.nNonce = 414098458; hashGenesisBlock = genesis.GetHash(); - assert(hashGenesisBlock == uint256("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943")); + //assert(hashGenesisBlock == uint256("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943")); vFixedSeeds.clear(); vSeeds.clear(); - vSeeds.push_back(CDNSSeedData("bitcoin.petertodd.org", "testnet-seed.bitcoin.petertodd.org")); - vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me")); + //vSeeds.push_back(CDNSSeedData("bitcoin.petertodd.org", "testnet-seed.bitcoin.petertodd.org")); + //vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me")); base58Prefixes[PUBKEY_ADDRESS] = 111; base58Prefixes[SCRIPT_ADDRESS] = 196; @@ -231,7 +150,7 @@ public: hashGenesisBlock = genesis.GetHash(); nDefaultPort = 18444; strDataDir = "regtest"; - assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")); + //assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")); vSeeds.clear(); // Regtest mode doesn't have any DNS seeds. diff --git a/src/checkqueue.h b/src/checkqueue.h index eba424fb..0a491330 100644 --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -99,6 +99,7 @@ private: // * Try to account for idle jobs which will instantly start helping. // * Don't do batches smaller than 1 (duh), or larger than nBatchSize. nNow = std::max(1U, std::min(nBatchSize, (unsigned int)queue.size() / (nTotal + nIdle + 1))); + /* [MF] vChecks.resize(nNow); for (unsigned int i = 0; i < nNow; i++) { // We want the lock on the mutex to be as short as possible, so swap jobs from the global @@ -106,14 +107,17 @@ private: vChecks[i].swap(queue.back()); queue.pop_back(); } + */ // Check whether we need to do work at all fOk = fAllOk; } // execute work + /* BOOST_FOREACH(T &check, vChecks) if (fOk) fOk = check(); vChecks.clear(); + */ } while(true); } diff --git a/src/core.cpp b/src/core.cpp index afba0959..a78bd413 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -78,48 +78,18 @@ uint256 CTransaction::GetHash() const return SerializeHash(*this); } -bool CTransaction::IsNewerThan(const CTransaction& old) const -{ - if (vin.size() != old.vin.size()) - return false; - for (unsigned int i = 0; i < vin.size(); i++) - if (vin[i].prevout != old.vin[i].prevout) - return false; - - bool fNewer = false; - unsigned int nLowest = std::numeric_limits::max(); - for (unsigned int i = 0; i < vin.size(); i++) - { - if (vin[i].nSequence != old.vin[i].nSequence) - { - if (vin[i].nSequence <= nLowest) - { - fNewer = false; - nLowest = vin[i].nSequence; - } - if (old.vin[i].nSequence < nLowest) - { - fNewer = true; - nLowest = old.vin[i].nSequence; - } - } - } - return fNewer; -} - std::string CTransaction::ToString() const { std::string str; - str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%u)\n", + str += strprintf("CTransaction(hash=%s, ver=%d, message.size=%"PRIszu", userID.size=%"PRIszu", pubKey.size=%"PRIszu")\n", GetHash().ToString().substr(0,10).c_str(), nVersion, - vin.size(), - vout.size(), - nLockTime); - for (unsigned int i = 0; i < vin.size(); i++) - str += " " + vin[i].ToString() + "\n"; - for (unsigned int i = 0; i < vout.size(); i++) - str += " " + vout[i].ToString() + "\n"; + message.size(), + userID.size(), + pubKey.size()); + str += " " + message.ToString() + "\n"; + str += " " + userID.ToString() + "\n"; + str += " " + pubKey.ToString() + "\n"; return str; } @@ -186,6 +156,7 @@ uint64 CTxOutCompressor::DecompressAmount(uint64 x) // each bit in the bitmask represents the availability of one output, but the // availabilities of the first two outputs are encoded separately void CCoins::CalcMaskSize(unsigned int &nBytes, unsigned int &nNonzeroBytes) const { + /* unsigned int nLastUsedByte = 0; for (unsigned int b = 0; 2+b*8 < vout.size(); b++) { bool fZero = true; @@ -201,9 +172,11 @@ void CCoins::CalcMaskSize(unsigned int &nBytes, unsigned int &nNonzeroBytes) con } } nBytes += nLastUsedByte; + */ } bool CCoins::Spend(const COutPoint &out, CTxInUndo &undo) { + /* if (out.n >= vout.size()) return false; if (vout[out.n].IsNull()) @@ -216,6 +189,7 @@ bool CCoins::Spend(const COutPoint &out, CTxInUndo &undo) { undo.fCoinBase = fCoinBase; undo.nVersion = this->nVersion; } + */ return true; } diff --git a/src/core.h b/src/core.h index 1b9d4dd7..3cbbbe18 100644 --- a/src/core.h +++ b/src/core.h @@ -182,9 +182,12 @@ public: static int64 nMinRelayTxFee; static const int CURRENT_VERSION=1; int nVersion; - std::vector vin; - std::vector vout; - unsigned int nLockTime; + CScript message; + CScript userID; + CScript pubKey; + //std::vector vin; + //std::vector vout; + //unsigned int nLockTime; CTransaction() { @@ -195,22 +198,22 @@ public: ( READWRITE(this->nVersion); nVersion = this->nVersion; - READWRITE(vin); - READWRITE(vout); - READWRITE(nLockTime); + READWRITE(message); + READWRITE(userID); + READWRITE(pubKey); ) void SetNull() { nVersion = CTransaction::CURRENT_VERSION; - vin.clear(); - vout.clear(); - nLockTime = 0; + message.clear(); + userID.clear(); + pubKey.clear(); } bool IsNull() const { - return (vin.empty() && vout.empty()); + return (message.empty() && userID.empty() && pubKey.empty()); } uint256 GetHash() const; @@ -218,15 +221,16 @@ public: bool IsCoinBase() const { - return (vin.size() == 1 && vin[0].prevout.IsNull()); + //[MF] reusing coinbase as spam string + return (!message.empty() && userID.empty() && pubKey.empty()); } friend bool operator==(const CTransaction& a, const CTransaction& b) { return (a.nVersion == b.nVersion && - a.vin == b.vin && - a.vout == b.vout && - a.nLockTime == b.nLockTime); + a.message == b.message && + a.userID == b.userID && + a.pubKey == b.pubKey); } friend bool operator!=(const CTransaction& a, const CTransaction& b) @@ -389,7 +393,7 @@ public: int nVersion; // construct a CCoins from a CTransaction, at a given height - CCoins(const CTransaction &tx, int nHeightIn) : fCoinBase(tx.IsCoinBase()), vout(tx.vout), nHeight(nHeightIn), nVersion(tx.nVersion) { } + CCoins(const CTransaction &tx, int nHeightIn) : fCoinBase(tx.IsCoinBase()), vout(), nHeight(nHeightIn), nVersion(tx.nVersion) { } // empty constructor CCoins() : fCoinBase(false), vout(0), nHeight(0), nVersion(0) { } diff --git a/src/main.cpp b/src/main.cpp index d3589144..000c5250 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,6 +54,7 @@ int64 CTransaction::nMinTxFee = 10000; // Override with -mintxfee /** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */ int64 CTransaction::nMinRelayTxFee = 10000; + CMedianFilter cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have map mapOrphanBlocks; @@ -424,9 +425,10 @@ bool AddOrphanTx(const CDataStream& vMsg) } mapOrphanTransactions[hash] = pvMsg; + /* [MF] BOOST_FOREACH(const CTxIn& txin, tx.vin) mapOrphanTransactionsByPrev[txin.prevout.hash].insert(make_pair(hash, pvMsg)); - + */ printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().c_str(), mapOrphanTransactions.size()); return true; @@ -439,12 +441,14 @@ void static EraseOrphanTx(uint256 hash) const CDataStream* pvMsg = mapOrphanTransactions[hash]; CTransaction tx; CDataStream(*pvMsg) >> tx; + /* [MF] BOOST_FOREACH(const CTxIn& txin, tx.vin) { mapOrphanTransactionsByPrev[txin.prevout.hash].erase(hash); if (mapOrphanTransactionsByPrev[txin.prevout.hash].empty()) mapOrphanTransactionsByPrev.erase(txin.prevout.hash); } + */ delete pvMsg; mapOrphanTransactions.erase(hash); } @@ -493,6 +497,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) return false; } + /* [MF] BOOST_FOREACH(const CTxIn& txin, tx.vin) { // Biggest 'standard' txin is a 3-signature 3-of-3 CHECKMULTISIG @@ -517,12 +522,13 @@ bool IsStandardTx(const CTransaction& tx, string& reason) return false; } } - + */ return true; } bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64 nBlockTime) { + /* [MF] // Time based nLockTime implemented in 0.1.6 if (tx.nLockTime == 0) return true; @@ -535,6 +541,8 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64 nBlockTime) BOOST_FOREACH(const CTxIn& txin, tx.vin) if (!txin.IsFinal()) return false; + + */ return true; } @@ -544,12 +552,13 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64 nBlockTime) int64 GetValueOut(const CTransaction& tx) { int64 nValueOut = 0; + /* [MF] BOOST_FOREACH(const CTxOut& txout, tx.vout) { nValueOut += txout.nValue; if (!MoneyRange(txout.nValue) || !MoneyRange(nValueOut)) throw std::runtime_error("GetValueOut() : value out of range"); - } + } */ return nValueOut; } @@ -568,7 +577,7 @@ bool AreInputsStandard(const CTransaction& tx, CCoinsViewCache& mapInputs) { if (tx.IsCoinBase()) return true; // Coinbases don't use vin normally - +/* [MF] for (unsigned int i = 0; i < tx.vin.size(); i++) { const CTxOut& prev = mapInputs.GetOutputFor(tx.vin[i]); @@ -614,13 +623,14 @@ bool AreInputsStandard(const CTransaction& tx, CCoinsViewCache& mapInputs) if (stack.size() != (unsigned int)nArgsExpected) return false; } - +*/ return true; } unsigned int GetLegacySigOpCount(const CTransaction& tx) { unsigned int nSigOps = 0; + /* BOOST_FOREACH(const CTxIn& txin, tx.vin) { nSigOps += txin.scriptSig.GetSigOpCount(false); @@ -629,6 +639,7 @@ unsigned int GetLegacySigOpCount(const CTransaction& tx) { nSigOps += txout.scriptPubKey.GetSigOpCount(false); } + */ return nSigOps; } @@ -638,12 +649,14 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, CCoinsViewCache& inputs) return 0; unsigned int nSigOps = 0; + /* for (unsigned int i = 0; i < tx.vin.size(); i++) { const CTxOut &prevout = inputs.GetOutputFor(tx.vin[i]); if (prevout.scriptPubKey.IsPayToScriptHash()) nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig); } + */ return nSigOps; } @@ -702,6 +715,7 @@ int CMerkleTx::SetMerkleBranch(const CBlock* pblock) bool CheckTransaction(const CTransaction& tx, CValidationState &state) { + /* [MF] // Basic checks that don't depend on any context if (tx.vin.empty()) return state.DoS(10, error("CheckTransaction() : vin empty")); @@ -744,12 +758,13 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state) if (txin.prevout.IsNull()) return state.DoS(10, error("CheckTransaction() : prevout is null")); } - + */ return true; } int64 GetMinFee(const CTransaction& tx, bool fAllowFree, enum GetMinFee_mode mode) { + /* // Base fee is either nMinTxFee or nMinRelayTxFee int64 nBaseFee = (mode == GMF_RELAY) ? tx.nMinRelayTxFee : tx.nMinTxFee; @@ -778,6 +793,8 @@ int64 GetMinFee(const CTransaction& tx, bool fAllowFree, enum GetMinFee_mode mod if (!MoneyRange(nMinFee)) nMinFee = MAX_MONEY; return nMinFee; + */ + return 0; } void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins) @@ -806,9 +823,11 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFr if (tx.IsCoinBase()) return state.DoS(100, error("CTxMemPool::accept() : coinbase as individual tx")); + /* // To help v0.1.5 clients who would see it as a negative number if ((int64)tx.nLockTime > std::numeric_limits::max()) return error("CTxMemPool::accept() : not accepting nLockTime beyond 2038 yet"); +*/ // Rather not work on nonstandard transactions (unless -testnet) string reason; @@ -826,6 +845,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFr // Check for conflicts with in-memory transactions CTransaction* ptxOld = NULL; + /* [MF] for (unsigned int i = 0; i < tx.vin.size(); i++) { COutPoint outpoint = tx.vin[i].prevout; @@ -851,7 +871,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFr break; } } - +*/ { CCoinsView dummy; CCoinsViewCache view(dummy); @@ -868,6 +888,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFr // do all inputs exist? // Note that this does not check for the presence of actual outputs (see the next check for that), // only helps filling in pfMissingInputs (to determine missing vs spent). + /* BOOST_FOREACH(const CTxIn txin, tx.vin) { if (!view.HaveCoins(txin.prevout.hash)) { if (pfMissingInputs) @@ -875,7 +896,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFr return false; } } - + */ // are the actual inputs available? if (!view.HaveInputs(tx)) return state.Invalid(error("CTxMemPool::accept() : inputs already spent")); @@ -908,6 +929,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFr // Continuously rate-limit free transactions // This mitigates 'penny-flooding' -- sending thousands of free transactions just to // be annoying or make others' transactions take longer to confirm. + /* if (fLimitFree && nFees < CTransaction::nMinRelayTxFee) { static double dFreeCount; @@ -927,7 +949,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFr printf("Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize); dFreeCount += nSize; } - + */ // Check against previous transactions // This is done last to help prevent CPU exhaustion denial-of-service attacks. if (!CheckInputs(tx, state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC)) @@ -966,8 +988,10 @@ bool CTxMemPool::addUnchecked(const uint256& hash, CTransaction &tx) // call CTxMemPool::accept to properly check the transaction first. { mapTx[hash] = tx; + /* [MF] for (unsigned int i = 0; i < tx.vin.size(); i++) mapNextTx[tx.vin[i].prevout] = CInPoint(&mapTx[hash], i); + */ nTransactionsUpdated++; } return true; @@ -983,14 +1007,18 @@ bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive) if (mapTx.count(hash)) { if (fRecursive) { + /* for (unsigned int i = 0; i < tx.vout.size(); i++) { std::map::iterator it = mapNextTx.find(COutPoint(hash, i)); if (it != mapNextTx.end()) remove(*it->second.ptx, true); } + */ } + /* BOOST_FOREACH(const CTxIn& txin, tx.vin) mapNextTx.erase(txin.prevout); + */ mapTx.erase(hash); nTransactionsUpdated++; } @@ -1002,6 +1030,7 @@ bool CTxMemPool::removeConflicts(const CTransaction &tx) { // Remove transactions which depend on inputs of tx, recursively LOCK(cs); + /* [MF] BOOST_FOREACH(const CTxIn &txin, tx.vin) { std::map::iterator it = mapNextTx.find(txin.prevout); if (it != mapNextTx.end()) { @@ -1010,6 +1039,7 @@ bool CTxMemPool::removeConflicts(const CTransaction &tx) remove(txConflict, true); } } + */ return true; } @@ -1497,9 +1527,10 @@ int64 CCoinsViewCache::GetValueIn(const CTransaction& tx) return 0; int64 nResult = 0; + /* [MF] for (unsigned int i = 0; i < tx.vin.size(); i++) nResult += GetOutputFor(tx.vin[i]).nValue; - + */ return nResult; } @@ -1507,12 +1538,14 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach { // mark inputs spent if (!tx.IsCoinBase()) { + /* [MF] BOOST_FOREACH(const CTxIn &txin, tx.vin) { CCoins &coins = inputs.GetCoins(txin.prevout.hash); CTxInUndo undo; assert(coins.Spend(txin.prevout, undo)); txundo.vprevout.push_back(undo); } + */ } // add outputs @@ -1522,6 +1555,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach bool CCoinsViewCache::HaveInputs(const CTransaction& tx) { if (!tx.IsCoinBase()) { + /* [MF] // first check whether information about the prevout hash is available for (unsigned int i = 0; i < tx.vin.size(); i++) { const COutPoint &prevout = tx.vin[i].prevout; @@ -1536,26 +1570,33 @@ bool CCoinsViewCache::HaveInputs(const CTransaction& tx) if (!coins.IsAvailable(prevout.n)) return false; } + */ } return true; } +/* [MF] bool CScriptCheck::operator()() const { const CScript &scriptSig = ptxTo->vin[nIn].scriptSig; if (!VerifyScript(scriptSig, scriptPubKey, *ptxTo, nIn, nFlags, nHashType)) return error("CScriptCheck() : %s VerifySignature failed", ptxTo->GetHash().ToString().c_str()); return true; } +*/ bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType) { + /* [MF] return CScriptCheck(txFrom, txTo, nIn, flags, nHashType)(); + */ + return true; } bool CheckInputs(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, std::vector *pvChecks) { if (!tx.IsCoinBase()) { + /* [MF] if (pvChecks) pvChecks->reserve(tx.vin.size()); @@ -1627,6 +1668,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, CCoinsViewCach } } } + */ } return true; @@ -1675,6 +1717,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex // restore inputs if (i > 0) { // not coinbases const CTxUndo &txundo = blockUndo.vtxundo[i-1]; + /* if (txundo.vprevout.size() != tx.vin.size()) return error("DisconnectBlock() : transaction and undo data inconsistent"); for (unsigned int j = tx.vin.size(); j-- > 0;) { @@ -1702,6 +1745,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex if (!view.SetCoins(out.hash, coins)) return error("DisconnectBlock() : cannot restore coin inputs"); } + */ } } @@ -1811,7 +1855,7 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C for (unsigned int i = 0; i < block.vtx.size(); i++) { const CTransaction &tx = block.vtx[i]; - + /* [MF] nInputs += tx.vin.size(); nSigOps += GetLegacySigOpCount(tx); if (nSigOps > MAX_BLOCK_SIGOPS) @@ -1839,7 +1883,7 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C return false; control.Add(vChecks); } - +*/ CTxUndo txundo; UpdateCoins(tx, state, view, txundo, pindex->nHeight, block.GetTxHash(i)); if (!tx.IsCoinBase()) @@ -2328,8 +2372,10 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CDiskBlockPos* dbp) (TestNet() && CBlockIndex::IsSuperMajority(2, pindexPrev, 51, 100))) { CScript expect = CScript() << nHeight; + /* [MF] if (!std::equal(expect.begin(), expect.end(), block.vtx[0].vin[0].scriptSig.begin())) return state.DoS(100, error("AcceptBlock() : block height mismatch in coinbase")); + */ } } } @@ -4270,13 +4316,18 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey) // Create coinbase tx CTransaction txNew; + /* [MF] txNew.vin.resize(1); txNew.vin[0].prevout.SetNull(); txNew.vout.resize(1); + */ + txNew.message.clear(); + + /* [MF] Check! add spam */ CPubKey pubkey; if (!reservekey.GetReservedKey(pubkey)) return NULL; - txNew.vout[0].scriptPubKey << pubkey << OP_CHECKSIG; + txNew.pubKey << pubkey << OP_CHECKSIG; // Add our coinbase tx as first transaction pblock->vtx.push_back(txNew); @@ -4323,6 +4374,7 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey) double dPriority = 0; int64 nTotalIn = 0; bool fMissingInputs = false; + /* [MF] BOOST_FOREACH(const CTxIn& txin, tx.vin) { // Read prev transaction @@ -4362,6 +4414,7 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey) dPriority += (double)nValueIn * nConf; } + */ if (fMissingInputs) continue; // Priority is sum(valuein * age) / txsize @@ -4412,7 +4465,7 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey) continue; // Skip free transactions if we're past the minimum block size: - if (fSortedByFee && (dFeePerKb < CTransaction::nMinTxFee) && (nBlockSize + nTxSize >= nBlockMinSize)) + if (fSortedByFee && (nBlockSize + nTxSize >= nBlockMinSize)) continue; // Prioritize by fee once past the priority size or we run out of high-priority @@ -4479,7 +4532,9 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey) nLastBlockSize = nBlockSize; printf("CreateNewBlock(): total size %"PRI64u"\n", nBlockSize); + /* [MF] pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees); + */ pblocktemplate->vTxFees[0] = -nFees; // Fill in header @@ -4487,7 +4542,9 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey) UpdateTime(*pblock, pindexPrev); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock); pblock->nNonce = 0; + /* [MF] pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0; + */ pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); CBlockIndex indexDummy(*pblock); @@ -4514,9 +4571,10 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& } ++nExtraNonce; unsigned int nHeight = pindexPrev->nHeight+1; // Height first in coinbase required for block.version=2 + /* [MF] Check! pblock->vtx[0].vin[0].scriptSig = (CScript() << nHeight << CBigNum(nExtraNonce)) + COINBASE_FLAGS; assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100); - + */ pblock->hashMerkleRoot = pblock->BuildMerkleTree(); } @@ -4579,7 +4637,7 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey) printf("BitcoinMiner:\n"); printf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str()); pblock->print(); - printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str()); + //printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str()); // Found a solution { diff --git a/src/main.h b/src/main.h index 8ad2437c..4c2d37ac 100644 --- a/src/main.h +++ b/src/main.h @@ -420,7 +420,8 @@ private: public: CScriptCheck() {} CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, int nHashTypeIn) : - scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), + // scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), [MF] + scriptPubKey(), ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), nHashType(nHashTypeIn) { } bool operator()() const; diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 76e88b36..c024defa 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -71,9 +71,10 @@ static bool ThreadSafeAskFee(int64 nFeeRequired) { if(!guiref) return false; + /* if(nFeeRequired < CTransaction::nMinTxFee || nFeeRequired <= nTransactionFee || fDaemon) return true; - +*/ bool payFee = false; QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(), diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index aeef721c..996d1b73 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -14,10 +14,8 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx) { if (!IsFinalTx(wtx)) { - if (wtx.nLockTime < LOCKTIME_THRESHOLD) - return tr("Open for %n more block(s)", "", wtx.nLockTime - nBestHeight + 1); - else - return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime)); + //if (wtx.nLockTime < LOCKTIME_THRESHOLD) + return tr("Open for %n more block(s)", "", 0 - nBestHeight + 1); } else { @@ -34,7 +32,7 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx) QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx) { QString strHTML; - +/* { LOCK(wallet->cs_wallet); strHTML.reserve(4000); @@ -270,5 +268,6 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx) strHTML += ""; } +*/ return strHTML; } diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index e9545087..12e82375 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -30,7 +30,7 @@ QList TransactionRecord::decomposeTransaction(const CWallet * int64 nNet = nCredit - nDebit; uint256 hash = wtx.GetHash(); std::map mapValue = wtx.mapValue; - +/* if (nNet > 0 || wtx.IsCoinBase()) { // @@ -119,7 +119,7 @@ QList TransactionRecord::decomposeTransaction(const CWallet * } int64 nValue = txout.nValue; - /* Add fee to first output */ + if (nTxFee > 0) { nValue += nTxFee; @@ -138,7 +138,7 @@ QList TransactionRecord::decomposeTransaction(const CWallet * parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, 0)); } } - +*/ return parts; } @@ -164,15 +164,10 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) if (!IsFinalTx(wtx)) { - if (wtx.nLockTime < LOCKTIME_THRESHOLD) + //if (wtx.nLockTime < LOCKTIME_THRESHOLD) { status.status = TransactionStatus::OpenUntilBlock; - status.open_for = wtx.nLockTime - nBestHeight + 1; - } - else - { - status.status = TransactionStatus::OpenUntilDate; - status.open_for = wtx.nLockTime; + status.open_for = /* 0 */ - nBestHeight + 1; } } else diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index a70c0958..1390ba30 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -167,7 +167,9 @@ Value getwork(const Array& params, bool fHelp) IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); // Save + /* [MF] mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig); + */ // Pre-build hash buffers char pmidstate[32]; @@ -203,7 +205,9 @@ Value getwork(const Array& params, bool fHelp) pblock->nTime = pdata->nTime; pblock->nNonce = pdata->nNonce; + /* [MF] pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second; + */ pblock->hashMerkleRoot = pblock->BuildMerkleTree(); return CheckWork(pblock, *pwalletMain, *pMiningKey); @@ -312,11 +316,13 @@ Value getblocktemplate(const Array& params, bool fHelp) entry.push_back(Pair("hash", txHash.GetHex())); Array deps; + /* BOOST_FOREACH (const CTxIn &in, tx.vin) { if (setTxIndex.count(in.prevout.hash)) deps.push_back(setTxIndex[in.prevout.hash]); } + */ entry.push_back(Pair("depends", deps)); int index_in_template = i - 1; @@ -344,7 +350,7 @@ Value getblocktemplate(const Array& params, bool fHelp) result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex())); result.push_back(Pair("transactions", transactions)); result.push_back(Pair("coinbaseaux", aux)); - result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); + //result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); result.push_back(Pair("target", hashTarget.GetHex())); result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1)); result.push_back(Pair("mutable", aMutable)); diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index f08688d3..2ef6eaf6 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -78,8 +78,9 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) { entry.push_back(Pair("txid", tx.GetHash().GetHex())); entry.push_back(Pair("version", tx.nVersion)); - entry.push_back(Pair("locktime", (boost::int64_t)tx.nLockTime)); + //entry.push_back(Pair("locktime", (boost::int64_t)tx.nLockTime)); Array vin; + /* [MF] BOOST_FOREACH(const CTxIn& txin, tx.vin) { Object in; @@ -97,8 +98,10 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) in.push_back(Pair("sequence", (boost::int64_t)txin.nSequence)); vin.push_back(in); } + */ entry.push_back(Pair("vin", vin)); Array vout; + /* for (unsigned int i = 0; i < tx.vout.size(); i++) { const CTxOut& txout = tx.vout[i]; @@ -110,6 +113,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) out.push_back(Pair("scriptPubKey", o)); vout.push_back(out); } + */ entry.push_back(Pair("vout", vout)); if (hashBlock != 0) @@ -212,13 +216,14 @@ Value listunspent(const Array& params, bool fHelp) if (setAddress.size()) { CTxDestination address; + /* if (!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) continue; - + */ if (!setAddress.count(address)) continue; } - +/* int64 nValue = out.tx->vout[out.i].nValue; const CScript& pk = out.tx->vout[out.i].scriptPubKey; Object entry; @@ -246,6 +251,7 @@ Value listunspent(const Array& params, bool fHelp) entry.push_back(Pair("amount",ValueFromAmount(nValue))); entry.push_back(Pair("confirmations",out.nDepth)); results.push_back(entry); + */ } return results; @@ -284,7 +290,7 @@ Value createrawtransaction(const Array& params, bool fHelp) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive"); CTxIn in(COutPoint(txid, nOutput)); - rawTx.vin.push_back(in); + // [MF] rawTx.vin.push_back(in); } set setAddress; @@ -303,7 +309,7 @@ Value createrawtransaction(const Array& params, bool fHelp) int64 nAmount = AmountFromValue(s.value_); CTxOut out(nAmount, scriptPubKey); - rawTx.vout.push_back(out); + // [MF] rawTx.vout.push_back(out); } CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); @@ -385,11 +391,13 @@ Value signrawtransaction(const Array& params, bool fHelp) CCoinsViewMemPool viewMempool(viewChain, mempool); view.SetBackend(viewMempool); // temporarily switch cache backend to db+mempool view + /* BOOST_FOREACH(const CTxIn& txin, mergedTx.vin) { const uint256& prevHash = txin.prevout.hash; CCoins coins; view.GetCoins(prevHash, coins); // this is certainly allowed to fail } + */ view.SetBackend(viewDummy); // switch back to avoid locking mempool for too long } @@ -445,12 +453,13 @@ Value signrawtransaction(const Array& params, bool fHelp) } // what todo if txid is known, but the actual output isn't? } + /* if ((unsigned int)nOut >= coins.vout.size()) coins.vout.resize(nOut+1); coins.vout[nOut].scriptPubKey = scriptPubKey; coins.vout[nOut].nValue = 0; // we don't know the actual output value view.SetCoins(txid, coins); - +*/ // if redeemScript given and not using the local wallet (private keys // given), add redeemScript to the tempKeystore so it can be signed: if (fGivenKeys && scriptPubKey.IsPayToScriptHash()) @@ -491,6 +500,7 @@ Value signrawtransaction(const Array& params, bool fHelp) bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE); // Sign what we can: + /* [MF] for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { CTxIn& txin = mergedTx.vin[i]; @@ -515,7 +525,7 @@ Value signrawtransaction(const Array& params, bool fHelp) if (!VerifyScript(txin.scriptSig, prevPubKey, mergedTx, i, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, 0)) fComplete = false; } - +*/ Object result; CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << mergedTx; diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 5388bd4d..dd6a965b 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -128,7 +128,7 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false) walletdb.ReadAccount(strAccount, account); bool bKeyUsed = false; - +/* // Check if the current key has been used if (account.vchPubKey.IsValid()) { @@ -144,7 +144,7 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false) bKeyUsed = true; } } - +*/ // Generate a new key if (!account.vchPubKey.IsValid() || bForceNew || bKeyUsed) { @@ -410,11 +410,12 @@ Value getreceivedbyaddress(const Array& params, bool fHelp) const CWalletTx& wtx = (*it).second; if (wtx.IsCoinBase() || !IsFinalTx(wtx)) continue; - +/* BOOST_FOREACH(const CTxOut& txout, wtx.vout) if (txout.scriptPubKey == scriptPubKey) if (wtx.GetDepthInMainChain() >= nMinDepth) nAmount += txout.nValue; + */ } return ValueFromAmount(nAmount); @@ -456,7 +457,7 @@ Value getreceivedbyaccount(const Array& params, bool fHelp) const CWalletTx& wtx = (*it).second; if (wtx.IsCoinBase() || !IsFinalTx(wtx)) continue; - +/* BOOST_FOREACH(const CTxOut& txout, wtx.vout) { CTxDestination address; @@ -464,6 +465,7 @@ Value getreceivedbyaccount(const Array& params, bool fHelp) if (wtx.GetDepthInMainChain() >= nMinDepth) nAmount += txout.nValue; } + */ } return (double)nAmount / (double)COIN; @@ -845,7 +847,7 @@ Value ListReceived(const Array& params, bool fByAccounts) int nDepth = wtx.GetDepthInMainChain(); if (nDepth < nMinDepth) continue; - +/* BOOST_FOREACH(const CTxOut& txout, wtx.vout) { CTxDestination address; @@ -857,6 +859,7 @@ Value ListReceived(const Array& params, bool fByAccounts) item.nConf = min(item.nConf, nDepth); item.txids.push_back(wtx.GetHash()); } + */ } // Reply diff --git a/src/script.cpp b/src/script.cpp index 14fe80e2..e1dc4445 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -965,13 +965,8 @@ bool EvalScript(vector >& stack, const CScript& script, co uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType) { - if (nIn >= txTo.vin.size()) - { - printf("ERROR: SignatureHash() : nIn=%d out of range\n", nIn); - return 1; - } CTransaction txTmp(txTo); - +/* // In case concatenating two scripts ends up with two codeseparators, // or an extra one at the end, this prevents all those possible incompatibilities. scriptCode.FindAndDelete(CScript(OP_CODESEPARATOR)); @@ -1017,7 +1012,7 @@ uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int txTmp.vin[0] = txTmp.vin[nIn]; txTmp.vin.resize(1); } - +*/ // Serialize and hash CHashWriter ss(SER_GETHASH, 0); ss << txTmp << nHashType; @@ -1554,6 +1549,7 @@ bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const C bool SignSignature(const CKeyStore &keystore, const CScript& fromPubKey, CTransaction& txTo, unsigned int nIn, int nHashType) { + /* assert(nIn < txTo.vin.size()); CTxIn& txin = txTo.vin[nIn]; @@ -1585,16 +1581,21 @@ bool SignSignature(const CKeyStore &keystore, const CScript& fromPubKey, CTransa // Test solution return VerifyScript(txin.scriptSig, fromPubKey, txTo, nIn, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, 0); + */ + return true; } bool SignSignature(const CKeyStore &keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType) { + /* assert(nIn < txTo.vin.size()); CTxIn& txin = txTo.vin[nIn]; assert(txin.prevout.n < txFrom.vout.size()); const CTxOut& txout = txFrom.vout[txin.prevout.n]; return SignSignature(keystore, txout.scriptPubKey, txTo, nIn, nHashType); + */ + return true; } static CScript PushAll(const vector& values) diff --git a/src/util.cpp b/src/util.cpp index bfb6d758..01451593 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1023,7 +1023,7 @@ boost::filesystem::path GetDefaultDataDir() // Unix: ~/.bitcoin #ifdef WIN32 // Windows - return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin"; + return GetSpecialFolderPath(CSIDL_APPDATA) / "Twister"; #else fs::path pathRet; char* pszHome = getenv("HOME"); @@ -1035,10 +1035,10 @@ boost::filesystem::path GetDefaultDataDir() // Mac pathRet /= "Library/Application Support"; fs::create_directory(pathRet); - return pathRet / "Bitcoin"; + return pathRet / "Twister"; #else // Unix - return pathRet / ".bitcoin"; + return pathRet / ".twister"; #endif #endif } @@ -1079,7 +1079,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) boost::filesystem::path GetConfigFile() { - boost::filesystem::path pathConfigFile(GetArg("-conf", "bitcoin.conf")); + boost::filesystem::path pathConfigFile(GetArg("-conf", "twister.conf")); if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile; return pathConfigFile; } @@ -1113,7 +1113,7 @@ void ReadConfigFile(map& mapSettingsRet, boost::filesystem::path GetPidFile() { - boost::filesystem::path pathPidFile(GetArg("-pid", "bitcoind.pid")); + boost::filesystem::path pathPidFile(GetArg("-pid", "twisterd.pid")); if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile; return pathPidFile; } diff --git a/src/wallet.cpp b/src/wallet.cpp index 488787f9..abf2df8c 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -361,6 +361,7 @@ void CWallet::WalletUpdateSpent(const CTransaction &tx) // restored from backup or the user making copies of wallet.dat. { LOCK(cs_wallet); + /* BOOST_FOREACH(const CTxIn& txin, tx.vin) { map::iterator mi = mapWallet.find(txin.prevout.hash); @@ -378,6 +379,7 @@ void CWallet::WalletUpdateSpent(const CTransaction &tx) } } } + */ } } @@ -488,6 +490,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn) if (vchDefaultKey.IsValid()) { CScript scriptDefaultKey; scriptDefaultKey.SetDestination(vchDefaultKey.GetID()); + /* BOOST_FOREACH(const CTxOut& txout, wtx.vout) { if (txout.scriptPubKey == scriptDefaultKey) @@ -500,6 +503,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn) } } } + */ } } // since AddToWallet is called directly for self-originating transactions, check for consumption of own coins @@ -565,9 +569,11 @@ bool CWallet::IsMine(const CTxIn &txin) const if (mi != mapWallet.end()) { const CWalletTx& prev = (*mi).second; + /* if (txin.prevout.n < prev.vout.size()) if (IsMine(prev.vout[txin.prevout.n])) return true; + */ } } return false; @@ -581,9 +587,11 @@ int64 CWallet::GetDebit(const CTxIn &txin) const if (mi != mapWallet.end()) { const CWalletTx& prev = (*mi).second; + /* if (txin.prevout.n < prev.vout.size()) if (IsMine(prev.vout[txin.prevout.n])) return prev.vout[txin.prevout.n].nValue; + */ } } return 0; @@ -670,6 +678,7 @@ void CWalletTx::GetAmounts(list >& listReceived, nFee = nDebit - nValueOut; } + /* // Sent/received. BOOST_FOREACH(const CTxOut& txout, vout) { @@ -691,7 +700,7 @@ void CWalletTx::GetAmounts(list >& listReceived, if (pwallet->IsMine(txout)) listReceived.push_back(make_pair(address, txout.nValue)); } - +*/ } void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nReceived, @@ -737,6 +746,7 @@ void CWalletTx::AddSupportingTransactions() if (SetMerkleBranch() < COPY_DEPTH) { vector vWorkQueue; + /* BOOST_FOREACH(const CTxIn& txin, vin) vWorkQueue.push_back(txin.prevout.hash); @@ -774,6 +784,7 @@ void CWalletTx::AddSupportingTransactions() } } } + */ } reverse(vtxPrev.begin(), vtxPrev.end()); @@ -835,6 +846,7 @@ void CWallet::ReacceptWalletTransactions() bool fFound = pcoinsTip->GetCoins(wtx.GetHash(), coins); if (fFound || wtx.GetDepthInMainChain() > 0) { + /* // Update fSpent if a tx got spent somewhere else by a copy of wallet.dat for (unsigned int i = 0; i < wtx.vout.size(); i++) { @@ -853,6 +865,7 @@ void CWallet::ReacceptWalletTransactions() wtx.MarkDirty(); wtx.WriteToDisk(); } + */ } else { @@ -1003,12 +1016,13 @@ void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed) const if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0) continue; - +/* for (unsigned int i = 0; i < pcoin->vout.size(); i++) { if (!(pcoin->IsSpent(i)) && IsMine(pcoin->vout[i]) && !IsLockedCoin((*it).first, i) && pcoin->vout[i].nValue > 0) vCoins.push_back(COutput(pcoin, i, pcoin->GetDepthInMainChain())); } + */ } } } @@ -1064,7 +1078,7 @@ bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfThe { setCoinsRet.clear(); nValueRet = 0; - +/* // List of values less than target pair > coinLowestLarger; coinLowestLarger.first = std::numeric_limits::max(); @@ -1154,7 +1168,7 @@ bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfThe printf("%s ", FormatMoney(vValue[i].first).c_str()); printf("total %s\n", FormatMoney(nBest).c_str()); } - +*/ return true; } @@ -1196,6 +1210,7 @@ bool CWallet::CreateTransaction(const vector >& vecSend, LOCK2(cs_main, cs_wallet); { nFeeRet = nTransactionFee; + /* loop { wtxNew.vin.clear(); @@ -1320,6 +1335,7 @@ bool CWallet::CreateTransaction(const vector >& vecSend, break; } + */ } } return true; @@ -1354,6 +1370,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey) // Mark old coins as spent set setCoins; + /* BOOST_FOREACH(const CTxIn& txin, wtxNew.vin) { CWalletTx &coin = mapWallet[txin.prevout.hash]; @@ -1362,6 +1379,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey) coin.WriteToDisk(); NotifyTransactionChanged(this, coin.GetHash(), CT_UPDATED); } + */ if (fFileBacked) delete pwalletdb; @@ -1696,7 +1714,7 @@ std::map CWallet::GetAddressBalances() int nDepth = pcoin->GetDepthInMainChain(); if (nDepth < (pcoin->IsFromMe() ? 0 : 1)) continue; - +/* for (unsigned int i = 0; i < pcoin->vout.size(); i++) { CTxDestination addr; @@ -1710,8 +1728,9 @@ std::map CWallet::GetAddressBalances() if (!balances.count(addr)) balances[addr] = 0; balances[addr] += n; - } + }*/ } + } return balances; @@ -1725,7 +1744,7 @@ set< set > CWallet::GetAddressGroupings() BOOST_FOREACH(PAIRTYPE(uint256, CWalletTx) walletEntry, mapWallet) { CWalletTx *pcoin = &walletEntry.second; - +/* if (pcoin->vin.size() > 0) { bool any_mine = false; @@ -1733,7 +1752,7 @@ set< set > CWallet::GetAddressGroupings() BOOST_FOREACH(CTxIn txin, pcoin->vin) { CTxDestination address; - if(!IsMine(txin)) /* If this input isn't mine, ignore it */ + if(!IsMine(txin)) continue; if(!ExtractDestination(mapWallet[txin.prevout.hash].vout[txin.prevout.n].scriptPubKey, address)) continue; @@ -1771,6 +1790,7 @@ set< set > CWallet::GetAddressGroupings() groupings.insert(grouping); grouping.clear(); } + */ } set< set* > uniqueGroupings; // a set of pointers to groups of addresses @@ -1930,7 +1950,7 @@ void CWallet::GetKeyBirthTimes(std::map &mapKeyBirth) const { // if there are no such keys, we're done if (mapKeyFirstBlock.empty()) return; - +/* // find first block that affects those keys, if there are any left std::vector vAffected; for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); it++) { @@ -1953,7 +1973,7 @@ void CWallet::GetKeyBirthTimes(std::map &mapKeyBirth) const { } } } - +*/ // Extract block timestamps for those keys for (std::map::const_iterator it = mapKeyFirstBlock.begin(); it != mapKeyFirstBlock.end(); it++) mapKeyBirth[it->first] = it->second->nTime - 7200; // block times can be 2h off diff --git a/src/wallet.h b/src/wallet.h index 36b3608f..c18889b8 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -228,9 +228,10 @@ public: } bool IsMine(const CTransaction& tx) const { - BOOST_FOREACH(const CTxOut& txout, tx.vout) +/* [MF] BOOST_FOREACH(const CTxOut& txout, tx.vout) if (IsMine(txout)) return true; +*/ return false; } bool IsFromMe(const CTransaction& tx) const @@ -240,34 +241,40 @@ public: int64 GetDebit(const CTransaction& tx) const { int64 nDebit = 0; +/* [MF] BOOST_FOREACH(const CTxIn& txin, tx.vin) { nDebit += GetDebit(txin); if (!MoneyRange(nDebit)) throw std::runtime_error("CWallet::GetDebit() : value out of range"); } +*/ return nDebit; } int64 GetCredit(const CTransaction& tx) const { int64 nCredit = 0; +/* [MF] BOOST_FOREACH(const CTxOut& txout, tx.vout) { nCredit += GetCredit(txout); if (!MoneyRange(nCredit)) throw std::runtime_error("CWallet::GetCredit() : value out of range"); } + */ return nCredit; } int64 GetChange(const CTransaction& tx) const { int64 nChange = 0; + /* BOOST_FOREACH(const CTxOut& txout, tx.vout) { nChange += GetChange(txout); if (!MoneyRange(nChange)) throw std::runtime_error("CWallet::GetChange() : value out of range"); } + */ return nChange; } void SetBestChain(const CBlockLocator& loc); @@ -479,7 +486,7 @@ public: READWRITE(nTimeReceived); READWRITE(fFromMe); READWRITE(fSpent); - +/* if (fRead) { pthis->strFromAccount = pthis->mapValue["fromaccount"]; @@ -494,7 +501,7 @@ public: pthis->nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(pthis->mapValue["timesmart"]) : 0; } - +*/ pthis->mapValue.erase("fromaccount"); pthis->mapValue.erase("version"); pthis->mapValue.erase("spent"); @@ -539,7 +546,8 @@ public: void MarkSpent(unsigned int nOut) { - if (nOut >= vout.size()) +/* + if (nOut >= vout.size()) throw std::runtime_error("CWalletTx::MarkSpent() : nOut out of range"); vfSpent.resize(vout.size()); if (!vfSpent[nOut]) @@ -547,23 +555,28 @@ public: vfSpent[nOut] = true; fAvailableCreditCached = false; } + */ } bool IsSpent(unsigned int nOut) const { + /* if (nOut >= vout.size()) throw std::runtime_error("CWalletTx::IsSpent() : nOut out of range"); if (nOut >= vfSpent.size()) return false; + */ return (!!vfSpent[nOut]); } int64 GetDebit() const { + /* if (vin.empty()) return 0; if (fDebitCached) return nDebitCached; + */ nDebitCached = pwallet->GetDebit(*this); fDebitCached = true; return nDebitCached; @@ -607,6 +620,7 @@ public: return nAvailableCreditCached; int64 nCredit = 0; + /* for (unsigned int i = 0; i < vout.size(); i++) { if (!IsSpent(i)) @@ -617,7 +631,7 @@ public: throw std::runtime_error("CWalletTx::GetAvailableCredit() : value out of range"); } } - +*/ nAvailableCreditCached = nCredit; fAvailableCreditCached = true; return nCredit; @@ -676,13 +690,14 @@ public: BOOST_FOREACH(const CMerkleTx& tx, vtxPrev) mapPrev[tx.GetHash()] = &tx; } - +/* BOOST_FOREACH(const CTxIn& txin, ptx->vin) { if (!mapPrev.count(txin.prevout.hash)) return false; vWorkQueue.push_back(mapPrev[txin.prevout.hash]); } + */ } return true; } @@ -714,7 +729,7 @@ public: std::string ToString() const { - return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString().c_str(), i, nDepth, FormatMoney(tx->vout[i].nValue).c_str()); + return strprintf("COutput(%s, %d, %d)", tx->GetHash().ToString().c_str(), i, nDepth); } void print() const