diff -uNr a/bitcoin/src/bitcoinrpc.cpp b/bitcoin/src/bitcoinrpc.cpp --- a/bitcoin/src/bitcoinrpc.cpp cd1dcc5febddd45408b193d0b875d8951eed8dc29d342ae5e57330b4ea2b55d959fab19e634696234c698feb4fa79a5702278e83b3896389c425ada5e935cc34 +++ b/bitcoin/src/bitcoinrpc.cpp 86e836b4710a5f675af7f13832f290f9b9c9f24d3efb41733d55e3a4f3f518e8c9fb1d60b43a2fba3c8327bd2b9d10e5ebbb6df8159f06873aec21d2b9123304 @@ -1817,6 +1817,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 @@ -1865,6 +1887,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])); diff -uNr a/bitcoin/src/init.cpp b/bitcoin/src/init.cpp --- a/bitcoin/src/init.cpp 4263d0ef771cb75e59e909372ba8b850e70a4cbc03635234119a267774d4a9095add15e1094b18646c9a1c280a486c7ec68d8cedc27ce2f6a14777af129e8b7a +++ b/bitcoin/src/init.cpp c3ee100d52acbf91d3355c95edc63db6e1d8e4fb1847ebfffbb8c8fe059ea88fa2f6c9e1535526039bba6cc9b4e03b4cc5624fd28004ed7aedcf6a0f42b3e177 @@ -174,6 +174,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") + @@ -196,6 +197,7 @@ fTestNet = GetBoolArg("-testnet"); fDebug = GetBoolArg("-debug"); fDaemon = GetBoolArg("-daemon"); + fCanEat = GetBoolArg("-caneat"); if (fDaemon) fServer = true; diff -uNr a/bitcoin/src/util.cpp b/bitcoin/src/util.cpp --- a/bitcoin/src/util.cpp 626e2306c3784911c960136e39bd3eb7c925ca90378faa03fb616a5d7180335889f0807bb39c9ac1907b285c43e730558190e1a1d5717eba4bae6006a9abedfd +++ b/bitcoin/src/util.cpp b801e7f75ca5c3b9463abe07201b60d4425cba761d34f70b18adcca7370f341b90b91e8cafd9fb28407439c72b4a624b10862fb22a301c9ea88f79d44267c0f7 @@ -20,6 +20,7 @@ bool fDebug = false; bool fPrintToConsole = false; bool fPrintToDebugger = false; +bool fCanEat = false; char pszSetDataDir[MAX_PATH] = ""; bool fRequestShutdown = false; bool fShutdown = false; diff -uNr a/bitcoin/src/util.h b/bitcoin/src/util.h --- a/bitcoin/src/util.h e5e5da8c45c0fab1aca83eadb8e98560dc14f65060803b5efd7ea83418be6412ee6a4f59f15fa939e1d639ef2638c9c5d18b5448c246d943827a41e01997ef7b +++ b/bitcoin/src/util.h b81e7c3eb43eb18d226c7a0ebb5868cc793c7197318bf7954590136b9713cac00c9f44fc90578c52f86d424b272c2a78c0fc7a55b23b566cc0c859d4c699983c @@ -110,6 +110,7 @@ extern bool fDebug; extern bool fPrintToConsole; extern bool fPrintToDebugger; +extern bool fCanEat; extern char pszSetDataDir[MAX_PATH]; extern bool fRequestShutdown; extern bool fShutdown;