--- a/trb 19ff65432bff9e5ab22f703c9946ff9d3718d9d5f94e6ce333e7e9aeea699d321394e625339d56555cc7300e5b7780d7fbc5c54df8ed86b6e156170c8d2c096f +++ b/trb 7f0dfc6f21f8b3bc1d42cc17835e24ed6235e0aa7dd3261de22bee62f9719bb4bc80bac437471e33c73b1d7c9628977cf95fe4ad9be9dbae2532aed0f00f1237 @@ -6979,7 +6979,7 @@ #endif // __INCLUDED_PROTOCOL_H__ ############################################################################## -84060 @ ./bitcoin/src/bitcoinrpc.cpp +84930 @ ./bitcoin/src/bitcoinrpc.cpp ############################################################################## // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -8800,6 +8800,28 @@ } +Value eatblock(const Array& params, bool fHelp) +{ + if (fHelp || params.size() < 1 || params.size() > 1) + throw runtime_error( + "eatblock \n" + "Load a candidate for the next block directly from ."); + + if (!fCanEat) + throw runtime_error( + "'eatblock' is only permitted if bitcoind was started with -caneat flag!"); + + // path to load block from + string filename = params[0].get_str(); + + printf("Attempting to create block #%d from file %s\n", nBestHeight + 1, filename.c_str()); + CAutoFile filein = fopen(filename.c_str(), "rb"); + CBlock block; + filein >> block; + return ProcessBlock(NULL, &block); // note that 'true' even if it was rejected (bastard, etc) +} // ... but will return 'false' if we already have the block. + + // // Call Table @@ -8848,6 +8870,7 @@ make_pair("getmemorypool", &getmemorypool), make_pair("listsinceblock", &listsinceblock), make_pair("dumpblock", &dumpblock), + make_pair("eatblock", &eatblock), }; map mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0])); @@ -19613,7 +19636,7 @@ } ############################################################################## -17628 @ ./bitcoin/src/util.h +17649 @ ./bitcoin/src/util.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -19727,6 +19750,7 @@ extern bool fDebug; extern bool fPrintToConsole; extern bool fPrintToDebugger; +extern bool fCanEat; extern char pszSetDataDir[MAX_PATH]; extern bool fRequestShutdown; extern bool fShutdown; @@ -20490,7 +20514,7 @@ } ############################################################################## -15427 @ ./bitcoin/src/init.cpp +15537 @ ./bitcoin/src/init.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -20668,6 +20692,7 @@ " -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") + " -testnet \t\t " + _("Use the test network\n") + " -debug \t\t " + _("Output extra debugging information\n") + + " -caneat \t\t " + _("Permit the use of 'eatblock'\n") + " -logtimestamps \t " + _("Prepend debug output with timestamp\n") + " -printtoconsole \t " + _("Send trace/debug info to console instead of debug.log file\n") + " -rpcuser= \t " + _("Username for JSON-RPC connections\n") + @@ -20690,6 +20715,7 @@ fTestNet = GetBoolArg("-testnet"); fDebug = GetBoolArg("-debug"); fDaemon = GetBoolArg("-daemon"); + fCanEat = GetBoolArg("-caneat"); if (fDaemon) fServer = true; @@ -23481,7 +23507,7 @@ #endif ############################################################################## -27811 @ ./bitcoin/src/util.cpp +27833 @ ./bitcoin/src/util.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -23505,6 +23531,7 @@ bool fDebug = false; bool fPrintToConsole = false; bool fPrintToDebugger = false; +bool fCanEat = false; char pszSetDataDir[MAX_PATH] = ""; bool fRequestShutdown = false; bool fShutdown = false;