diff options
-rw-r--r-- | bcBlockChainTestFiller.json | 4 | ||||
-rw-r--r-- | bcInvalidHeaderTestFiller.json | 56 | ||||
-rw-r--r-- | bcValidBlockTestFiller.json | 52 | ||||
-rw-r--r-- | blockchain.cpp | 36 |
4 files changed, 111 insertions, 37 deletions
diff --git a/bcBlockChainTestFiller.json b/bcBlockChainTestFiller.json index 75ed6294..827f49c5 100644 --- a/bcBlockChainTestFiller.json +++ b/bcBlockChainTestFiller.json @@ -7,12 +7,14 @@ "extraData" : "42", "gasLimit" : "100000000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", "timestamp" : "0x54c98c81", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, diff --git a/bcInvalidHeaderTestFiller.json b/bcInvalidHeaderTestFiller.json index bba00834..5665a341 100644 --- a/bcInvalidHeaderTestFiller.json +++ b/bcInvalidHeaderTestFiller.json @@ -7,7 +7,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -61,7 +63,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -115,7 +119,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -168,7 +174,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -221,7 +229,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -274,7 +284,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -328,7 +340,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -381,7 +395,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -434,7 +450,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -487,7 +505,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -540,7 +560,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -593,7 +615,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -646,7 +670,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -699,7 +725,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", diff --git a/bcValidBlockTestFiller.json b/bcValidBlockTestFiller.json index 3ce79cf4..abb8afdf 100644 --- a/bcValidBlockTestFiller.json +++ b/bcValidBlockTestFiller.json @@ -8,7 +8,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -30,7 +32,7 @@ "transactions" : [ { "data" : "", - "gasLimit" : "850", + "gasLimit" : "85000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -53,7 +55,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -97,7 +101,9 @@ "extraData" : "42", "gasLimit" : "1000000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -141,7 +147,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -163,7 +171,7 @@ "transactions" : [ { "data" : "", - "gasLimit" : "500", + "gasLimit" : "50000", "gasPrice" : "10", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -185,7 +193,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -238,7 +248,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -291,7 +303,9 @@ "extraData" : "42", "gasLimit" : "100000", "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", "number" : "0", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -341,8 +355,10 @@ "extraData" : "42", "gasLimit" : "0x0dddb6", "gasUsed" : "100", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "62", + "mixBytes" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", "parentHash" : "0xefb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5", "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", @@ -351,19 +367,23 @@ "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } }, "blocks" : [ { "transactions" : [ { "data" : "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56", - "gasLimit" : "0x0f3e6f", - "gasPrice" : "0x09184e72a000", + "gasLimit" : "50000", + "gasPrice" : "50", "nonce" : "0", - "r" : "0xd4287e915ebac7a8af390560fa53c8f0b7f13802ba0393d7afa5823c2560ca89", - "s" : "0xae75db31a34f7e386ad459646de98ec3a1c88cc91b11620b4ffd86871f579942", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "", - "v" : "0x1b", "value" : "" } ], diff --git a/blockchain.cpp b/blockchain.cpp index 69ea8fa2..ccfd5772 100644 --- a/blockchain.cpp +++ b/blockchain.cpp @@ -75,6 +75,12 @@ bytes createBlockRLPFromFields(mObject& _tObj) if (_tObj.count("extraData")) rlpStream << importByteArray(_tObj["extraData"].get_str()); + if (_tObj.count("seedHash")) + rlpStream << importByteArray(_tObj["seedHash"].get_str()); + + if (_tObj.count("mixBytes")) + rlpStream << importByteArray(_tObj["mixBytes"].get_str()); + if (_tObj.count("nonce")) rlpStream << importByteArray(_tObj["nonce"].get_str()); @@ -130,13 +136,17 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) { // find new valid nonce ProofOfWork pow; - MineInfo ret; - while (!ProofOfWork::verify(blockFromFields.headerHash(WithoutNonce), blockFromFields.nonce, blockFromFields.difficulty)) - tie(ret, blockFromFields.nonce) = pow.mine(blockFromFields.headerHash(WithoutNonce), blockFromFields.difficulty, 1000, true, true); + std::pair<MineInfo, Ethash::Proof> ret; + while (!ProofOfWork::verify(blockFromFields)) + { + ret = pow.mine(blockFromFields, 1000, true, true); // tie(ret, blockFromFields.nonce) + Ethash::assignResult(ret.second, blockFromFields); + } //update genesis block in json file o["genesisBlockHeader"].get_obj()["stateRoot"] = toString(blockFromFields.stateRoot); o["genesisBlockHeader"].get_obj()["nonce"] = toString(blockFromFields.nonce); + o["genesisBlockHeader"].get_obj()["mixBytes"] = toString(blockFromFields.mixBytes); } // create new "genesis" block @@ -266,15 +276,25 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) if (blObj["blockHeader"].get_obj().count("extraData")) tmp.extraData = importByteArray(blObj["blockHeader"].get_obj()["extraData"].get_str()); + if (blObj["blockHeader"].get_obj().count("mixBytes")) + tmp.mixBytes = h256(blObj["blockHeader"].get_obj()["mixBytes"].get_str()); + + if (blObj["blockHeader"].get_obj().count("seedHash")) + tmp.seedHash = h256(blObj["blockHeader"].get_obj()["seedHash"].get_str()); + // find new valid nonce if (tmp != current_BlockHeader) { current_BlockHeader = tmp; + ProofOfWork pow; - MineInfo ret; - while (!ProofOfWork::verify(current_BlockHeader.headerHash(WithoutNonce), current_BlockHeader.nonce, current_BlockHeader.difficulty)) - tie(ret, current_BlockHeader.nonce) = pow.mine(current_BlockHeader.headerHash(WithoutNonce), current_BlockHeader.difficulty, 10000, true, true); + std::pair<MineInfo, Ethash::Proof> ret; + while (!ProofOfWork::verify(current_BlockHeader)) + { + ret = pow.mine(current_BlockHeader, 1000, true, true); // tie(ret, blockFromFields.nonce) + Ethash::assignResult(ret.second, current_BlockHeader); + } } } else @@ -302,6 +322,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) oBlockHeader["gasUsed"] = toString(current_BlockHeader.gasUsed); oBlockHeader["timestamp"] = toString(current_BlockHeader.timestamp); oBlockHeader["extraData"] = toHex(current_BlockHeader.extraData); + oBlockHeader["mixBytes"] = toString(current_BlockHeader.mixBytes); + oBlockHeader["seedHash"] = toString(current_BlockHeader.seedHash); oBlockHeader["nonce"] = toString(current_BlockHeader.nonce); blObj["blockHeader"] = oBlockHeader; @@ -423,6 +445,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed, "gasUsed in given RLP not matching the block gasUsed!"); BOOST_CHECK_MESSAGE(blockHeaderFromFields.timestamp == blockFromRlp.timestamp, "timestamp in given RLP not matching the block timestamp!"); BOOST_CHECK_MESSAGE(blockHeaderFromFields.extraData == blockFromRlp.extraData, "extraData in given RLP not matching the block extraData!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.mixBytes == blockFromRlp.mixBytes, "mixBytes in given RLP not matching the block mixBytes!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.seedHash == blockFromRlp.seedHash, "transactionsRoot in given RLP not matching the block transactionsRoot!"); BOOST_CHECK_MESSAGE(blockHeaderFromFields.nonce == blockFromRlp.nonce, "nonce in given RLP not matching the block nonce!"); BOOST_CHECK_MESSAGE(blockHeaderFromFields == blockFromRlp, "However, blockHeaderFromFields != blockFromRlp!"); |