siveSakac / blockchain

Automatically exported from code.google.com/p/blockchain
0 stars 0 forks source link

one of the blocks has more than 1024 transactions #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run blockchain on a recent (November 2013) set of blocks.

What is the expected output? What do you see instead?

Segfault

What version of the product are you using? On what operating system?

SVN r27

Please provide any additional information below.

Here is a patch. It includes some extra asserts.

--- BlockChain.cpp      (revision 27)
+++ BlockChain.cpp      (working copy)
@@ -1462,7 +1462,7 @@
 // These limits work for the blockchain current as of July 1, 2013.
 // The limits can be revised when and if necessary.
 #define MAX_BLOCK_SIZE (1024*1024)*10  // never expect to have a block larger than 10mb
-#define MAX_BLOCK_TRANSACTION 1024             // never expect more than 1024 
transactions per block.
+#define MAX_BLOCK_TRANSACTION 2048             // never expect more than 1024 
transactions per block.
 #define MAX_BLOCK_INPUTS 32768                 // never expect more than 32768 total inputs
 #define MAX_BLOCK_OUTPUTS 32768                        // never expect more than 32768 total outputs
@@ -1715,6 +1715,7 @@
                bits = readU32();       // Get the bits field
                nonce = readU32();      // Get the 'nonce' random number.
                transactionCount = readVariableLengthInteger(); // Read the number of transactions
+               assert ( transactionCount < MAX_BLOCK_TRANSACTION );
                if ( transactionCount < MAX_BLOCK_TRANSACTION )
                {
                        transactions = mTransactions;   // Assign the transactions buffer pointer
@@ -2105,6 +2107,7 @@
        virtual const Block * processSingleBlock(const void *blockData,uint32_t blockLength)
        {
                const Block *ret = NULL;
+               assert ( blockLength < MAX_BLOCK_SIZE );
                if ( blockLength < MAX_BLOCK_SIZE )
                {
                        mSingleBlock.blockIndex = 0;
@@ -2122,6 +2125,7 @@
        virtual const BlockTransaction *processSingleTransaction(const void *transactionData,uint32_t transactionLength)
        {
                const BlockTransaction *ret = NULL;
+               assert ( transactionLength < MAX_BLOCK_SIZE );
                if ( transactionLength < MAX_BLOCK_SIZE )
                {
                        mSingleBlock.blockIndex = 0;

Original issue reported on code.google.com by rayanchi...@gmail.com on 9 Nov 2013 at 9:02