rpcmining.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. // ECOin - Copyright (c) - 2014/2026 - GPLv3 - epsylon@riseup.net (https://03c8.net)
  2. #include "main.h"
  3. #include "db.h"
  4. #include "txdb.h"
  5. #include "init.h"
  6. #include "miner.h"
  7. #include "ecoinrpc.h"
  8. using namespace json_spirit;
  9. using namespace std;
  10. static CCriticalSection cs_getwork;
  11. extern unsigned int nStakeTargetSpacing;
  12. extern void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex);
  13. Value getsubsidy(const Array& params, bool fHelp)
  14. {
  15. if (fHelp || params.size() > 1)
  16. throw runtime_error(
  17. "getsubsidy [nTarget]\n"
  18. "Returns proof-of-work subsidy value for the specified value of target.");
  19. unsigned int nBits = 0;
  20. if (params.size() != 0)
  21. {
  22. //CBigNum bnTarget(uint256(params[0].get_str()));
  23. //nBits = bnTarget.GetCompact();
  24. }
  25. else
  26. {
  27. //nBits = GetNextTargetRequired(pindexBest, false);
  28. }
  29. return 0;
  30. }
  31. Value getmininginfo(const Array& params, bool fHelp)
  32. {
  33. if (fHelp || params.size() != 0)
  34. throw runtime_error(
  35. "getmininginfo\n"
  36. "Returns an object containing mining-related information.");
  37. uint64_t nMinWeight = 0, nMaxWeight = 0, nWeight = 0;
  38. pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight);
  39. Object obj, diff, weight;
  40. obj.push_back(Pair("blocks", (int)nBestHeight));
  41. obj.push_back(Pair("currentblocksize",(uint64_t)nLastBlockSize));
  42. obj.push_back(Pair("currentblocktx",(uint64_t)nLastBlockTx));
  43. diff.push_back(Pair("proof-of-work", GetDifficulty()));
  44. diff.push_back(Pair("proof-of-stake", GetDifficulty(GetLastBlockIndex(pindexBest, true))));
  45. diff.push_back(Pair("search-interval", (int)nLastCoinStakeSearchInterval));
  46. obj.push_back(Pair("difficulty", diff));
  47. obj.push_back(Pair("blockvalue", (uint64_t)GetProofOfWorkReward(GetLastBlockIndex(pindexBest, false)->nHeight+1, GetLastBlockIndex(pindexBest, false)->GetBlockHash())));
  48. //obj.push_back(Pair("netmhashps", GetPoWMHashPS()));
  49. obj.push_back(Pair("netmhashps", GetRandHash));
  50. obj.push_back(Pair("netstakeweight", GetPoSKernelPS()));
  51. obj.push_back(Pair("errors", GetWarnings("statusbar")));
  52. obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
  53. weight.push_back(Pair("minimum", (uint64_t)nMinWeight));
  54. weight.push_back(Pair("maximum", (uint64_t)nMaxWeight));
  55. weight.push_back(Pair("combined", (uint64_t)nWeight));
  56. obj.push_back(Pair("stakeweight", weight));
  57. obj.push_back(Pair("stakeinterest", (uint64_t)GetProofOfStakeReward(0, GetLastBlockIndex(pindexBest, true)->nBits, GetLastBlockIndex(pindexBest, true)->nTime, true)));
  58. obj.push_back(Pair("testnet", fTestNet));
  59. return obj;
  60. }
  61. Value getstakinginfo(const Array& params, bool fHelp)
  62. {
  63. if (fHelp || params.size() != 0)
  64. throw runtime_error(
  65. "getstakinginfo\n"
  66. "Returns an object containing staking-related information.");
  67. uint64_t nMinWeight = 0, nMaxWeight = 0, nWeight = 0;
  68. pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight);
  69. uint64_t nNetworkWeight = GetPoSKernelPS();
  70. bool staking = nLastCoinStakeSearchInterval && nWeight;
  71. int nExpectedTime = staking ? (nStakeTargetSpacing * nNetworkWeight / nWeight) : -1;
  72. Object obj;
  73. obj.push_back(Pair("enabled", GetBoolArg("-staking", true)));
  74. obj.push_back(Pair("staking", staking));
  75. obj.push_back(Pair("errors", GetWarnings("statusbar")));
  76. obj.push_back(Pair("currentblocksize", (uint64_t)nLastBlockSize));
  77. obj.push_back(Pair("currentblocktx", (uint64_t)nLastBlockTx));
  78. obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
  79. obj.push_back(Pair("difficulty", GetDifficulty(GetLastBlockIndex(pindexBest, true))));
  80. obj.push_back(Pair("search-interval", (int)nLastCoinStakeSearchInterval));
  81. obj.push_back(Pair("weight", (uint64_t)nWeight));
  82. obj.push_back(Pair("netstakeweight", (uint64_t)nNetworkWeight));
  83. obj.push_back(Pair("expectedtime", nExpectedTime));
  84. return obj;
  85. }
  86. Value getworkex(const Array& params, bool fHelp)
  87. {
  88. if (fHelp || params.size() > 2)
  89. throw runtime_error(
  90. "getworkex [data, coinbase]\n"
  91. "If [data, coinbase] is not specified, returns extended work data.\n"
  92. );
  93. if (vNodes.empty())
  94. throw JSONRPCError(-9, "Ecoin is not connected!");
  95. if (IsInitialBlockDownload())
  96. throw JSONRPCError(-10, "Ecoin is downloading blocks...");
  97. typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t;
  98. static mapNewBlock_t mapNewBlock;
  99. static vector<CBlock*> vNewBlock;
  100. static CReserveKey reservekey(pwalletMain);
  101. LOCK(cs_getwork);
  102. if (params.size() == 0)
  103. {
  104. // Update block
  105. static unsigned int nTransactionsUpdatedLast;
  106. static CBlockIndex* pindexPrev;
  107. static int64 nStart;
  108. static CBlock* pblock;
  109. if (pindexPrev != pindexBest ||
  110. (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60))
  111. {
  112. if (pindexPrev != pindexBest)
  113. {
  114. // Deallocate old blocks since they're obsolete now
  115. mapNewBlock.clear();
  116. BOOST_FOREACH(CBlock* pblock, vNewBlock)
  117. delete pblock;
  118. vNewBlock.clear();
  119. }
  120. nTransactionsUpdatedLast = nTransactionsUpdated;
  121. pindexPrev = pindexBest;
  122. nStart = GetTime();
  123. // Create new block
  124. pblock = CreateNewBlock(pwalletMain);
  125. if (!pblock)
  126. throw JSONRPCError(-7, "Out of memory");
  127. vNewBlock.push_back(pblock);
  128. }
  129. // Update nTime
  130. pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
  131. pblock->nNonce = 0;
  132. // Update nExtraNonce
  133. static unsigned int nExtraNonce = 0;
  134. IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
  135. // Save
  136. mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig);
  137. // Prebuild hash buffers
  138. char pmidstate[32];
  139. char pdata[128];
  140. char phash1[64];
  141. FormatHashBuffers(pblock, pmidstate, pdata, phash1);
  142. uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
  143. CTransaction coinbaseTx = pblock->vtx[0];
  144. std::vector<uint256> merkle = pblock->GetMerkleBranch(0);
  145. Object result;
  146. result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata))));
  147. result.push_back(Pair("target", HexStr(BEGIN(hashTarget), END(hashTarget))));
  148. CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
  149. ssTx << coinbaseTx;
  150. result.push_back(Pair("coinbase", HexStr(ssTx.begin(), ssTx.end())));
  151. Array merkle_arr;
  152. BOOST_FOREACH(uint256 merkleh, merkle) {
  153. merkle_arr.push_back(HexStr(BEGIN(merkleh), END(merkleh)));
  154. }
  155. result.push_back(Pair("merkle", merkle_arr));
  156. return result;
  157. }
  158. else
  159. {
  160. // Parse parameters
  161. vector<unsigned char> vchData = ParseHex(params[0].get_str());
  162. vector<unsigned char> coinbase;
  163. if(params.size() == 2)
  164. coinbase = ParseHex(params[1].get_str());
  165. if (vchData.size() != 128)
  166. throw JSONRPCError(-8, "Invalid parameter");
  167. CBlock* pdata = (CBlock*)&vchData[0];
  168. // Byte reverse
  169. for (int i = 0; i < 128/4; i++)
  170. ((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]);
  171. // Get saved block
  172. if (!mapNewBlock.count(pdata->hashMerkleRoot))
  173. return false;
  174. CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first;
  175. pblock->nTime = pdata->nTime;
  176. pblock->nNonce = pdata->nNonce;
  177. if(coinbase.size() == 0)
  178. pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second;
  179. else
  180. CDataStream(coinbase, SER_NETWORK, PROTOCOL_VERSION) >> pblock->vtx[0]; // FIXME - HACK!
  181. pblock->hashMerkleRoot = pblock->BuildMerkleTree();
  182. return CheckWork(pblock, *pwalletMain, reservekey);
  183. }
  184. }
  185. Value getwork(const Array& params, bool fHelp)
  186. {
  187. if (fHelp || params.size() > 1)
  188. throw runtime_error(
  189. "getwork [data]\n"
  190. "If [data] is not specified, returns formatted hash data to work on:\n"
  191. " \"midstate\" : precomputed hash state after hashing the first half of the data (DEPRECATED)\n" // deprecated
  192. " \"data\" : block data\n"
  193. " \"hash1\" : formatted hash buffer for second hash (DEPRECATED)\n" // deprecated
  194. " \"target\" : little endian hash target\n"
  195. "If [data] is specified, tries to solve the block and returns true if it was successful.");
  196. if (vNodes.empty())
  197. throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Ecoin is not connected!");
  198. if (IsInitialBlockDownload())
  199. throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Ecoin is downloading blocks...");
  200. typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t;
  201. static mapNewBlock_t mapNewBlock;
  202. static vector<CBlock*> vNewBlock;
  203. static CReserveKey reservekey(pwalletMain);
  204. LOCK(cs_getwork);
  205. if (params.size() == 0)
  206. {
  207. // Update block
  208. static unsigned int nTransactionsUpdatedLast;
  209. static CBlockIndex* pindexPrev;
  210. static int64 nStart;
  211. static CBlock* pblock;
  212. if (pindexPrev != pindexBest ||
  213. (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60))
  214. {
  215. if (pindexPrev != pindexBest)
  216. {
  217. // Deallocate old blocks since they're obsolete now
  218. mapNewBlock.clear();
  219. BOOST_FOREACH(CBlock* pblock, vNewBlock)
  220. delete pblock;
  221. vNewBlock.clear();
  222. }
  223. // Clear pindexPrev so future getworks make a new block, despite any failures from here on
  224. pindexPrev = NULL;
  225. // Store the pindexBest used before CreateNewBlock, to avoid races
  226. nTransactionsUpdatedLast = nTransactionsUpdated;
  227. CBlockIndex* pindexPrevNew = pindexBest;
  228. nStart = GetTime();
  229. // Create new block
  230. pblock = CreateNewBlock(pwalletMain);
  231. if (!pblock)
  232. throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
  233. vNewBlock.push_back(pblock);
  234. // Need to update only after we know CreateNewBlock succeeded
  235. pindexPrev = pindexPrevNew;
  236. }
  237. // Update nTime
  238. pblock->UpdateTime(pindexPrev);
  239. pblock->nNonce = 0;
  240. // Update nExtraNonce
  241. static unsigned int nExtraNonce = 0;
  242. IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
  243. // Save
  244. mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig);
  245. // Pre-build hash buffers
  246. char pmidstate[32];
  247. char pdata[128];
  248. char phash1[64];
  249. FormatHashBuffers(pblock, pmidstate, pdata, phash1);
  250. uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
  251. Object result;
  252. result.push_back(Pair("midstate", HexStr(BEGIN(pmidstate), END(pmidstate)))); // deprecated
  253. result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata))));
  254. result.push_back(Pair("hash1", HexStr(BEGIN(phash1), END(phash1)))); // deprecated
  255. result.push_back(Pair("target", HexStr(BEGIN(hashTarget), END(hashTarget))));
  256. return result;
  257. }
  258. else
  259. {
  260. // Parse parameters
  261. vector<unsigned char> vchData = ParseHex(params[0].get_str());
  262. if (vchData.size() != 128)
  263. throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter");
  264. CBlock* pdata = (CBlock*)&vchData[0];
  265. // Byte reverse
  266. for (int i = 0; i < 128/4; i++)
  267. ((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]);
  268. // Get saved block
  269. if (!mapNewBlock.count(pdata->hashMerkleRoot))
  270. return false;
  271. CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first;
  272. pblock->nTime = pdata->nTime;
  273. pblock->nNonce = pdata->nNonce;
  274. pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second;
  275. pblock->hashMerkleRoot = pblock->BuildMerkleTree();
  276. return CheckWork(pblock, *pwalletMain, reservekey);
  277. }
  278. }
  279. Value getblocktemplate(const Array& params, bool fHelp)
  280. {
  281. if (fHelp || params.size() > 1)
  282. throw runtime_error(
  283. "getblocktemplate [params]\n"
  284. "Returns data needed to construct a block to work on:\n"
  285. " \"version\" : block version\n"
  286. " \"previousblockhash\" : hash of current highest block\n"
  287. " \"transactions\" : contents of non-coinbase transactions that should be included in the next block\n"
  288. " \"coinbaseaux\" : data that should be included in coinbase\n"
  289. " \"proofoftx\" : proof-of-transaction value"
  290. " \"proofoftxwinner\" : proof-of-transaction winner"
  291. " \"coinbasevalue\" : maximum allowable input to coinbase transaction, including the generation award and transaction fees\n"
  292. " \"target\" : hash target\n"
  293. " \"mintime\" : minimum timestamp appropriate for next block\n"
  294. " \"curtime\" : current timestamp\n"
  295. " \"mutable\" : list of ways the block template may be changed\n"
  296. " \"noncerange\" : range of valid nonces\n"
  297. " \"sigoplimit\" : limit of sigops in blocks\n"
  298. " \"sizelimit\" : limit of block size\n"
  299. " \"bits\" : compressed target of next block\n"
  300. " \"height\" : height of the next block\n"
  301. "See https://en.ecoin.it/wiki/BIP_0022 for full specification.");
  302. std::string strMode = "template";
  303. if (params.size() > 0)
  304. {
  305. const Object& oparam = params[0].get_obj();
  306. const Value& modeval = find_value(oparam, "mode");
  307. if (modeval.type() == str_type)
  308. strMode = modeval.get_str();
  309. else if (modeval.type() == null_type)
  310. {
  311. /* Do nothing */
  312. }
  313. else
  314. throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
  315. }
  316. if (strMode != "template")
  317. throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
  318. if (vNodes.empty())
  319. throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Ecoin is not connected!");
  320. if (IsInitialBlockDownload())
  321. throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Ecoin is downloading blocks...");
  322. static CReserveKey reservekey(pwalletMain);
  323. // Update block
  324. static unsigned int nTransactionsUpdatedLast;
  325. static CBlockIndex* pindexPrev;
  326. static int64 nStart;
  327. static CBlock* pblock;
  328. if (pindexPrev != pindexBest ||
  329. (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 5))
  330. {
  331. // Clear pindexPrev so future calls make a new block, despite any failures from here on
  332. pindexPrev = NULL;
  333. // Store the pindexBest used before CreateNewBlock, to avoid races
  334. nTransactionsUpdatedLast = nTransactionsUpdated;
  335. CBlockIndex* pindexPrevNew = pindexBest;
  336. nStart = GetTime();
  337. // Create new block
  338. if(pblock)
  339. {
  340. delete pblock;
  341. pblock = NULL;
  342. }
  343. pblock = CreateNewBlock(pwalletMain);
  344. if (!pblock)
  345. throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
  346. // Need to update only after we know CreateNewBlock succeeded
  347. pindexPrev = pindexPrevNew;
  348. }
  349. // Update nTime
  350. pblock->UpdateTime(pindexPrev);
  351. pblock->nNonce = 0;
  352. Array transactions;
  353. map<uint256, int64_t> setTxIndex;
  354. int i = 0;
  355. CTxDB txdb("r");
  356. BOOST_FOREACH (CTransaction& tx, pblock->vtx)
  357. {
  358. uint256 txHash = tx.GetHash();
  359. setTxIndex[txHash] = i++;
  360. if (tx.IsCoinBase() || tx.IsCoinStake())
  361. continue;
  362. Object entry;
  363. CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
  364. ssTx << tx;
  365. entry.push_back(Pair("data", HexStr(ssTx.begin(), ssTx.end())));
  366. entry.push_back(Pair("hash", txHash.GetHex()));
  367. MapPrevTx mapInputs;
  368. map<uint256, CTxIndex> mapUnused;
  369. bool fInvalid = false;
  370. if (tx.FetchInputs(txdb, mapUnused, false, false, mapInputs, fInvalid))
  371. {
  372. entry.push_back(Pair("fee", (int64_t)(tx.GetValueIn(mapInputs) - tx.GetValueOut())));
  373. Array deps;
  374. BOOST_FOREACH (MapPrevTx::value_type& inp, mapInputs)
  375. {
  376. if (setTxIndex.count(inp.first))
  377. deps.push_back(setTxIndex[inp.first]);
  378. }
  379. entry.push_back(Pair("depends", deps));
  380. int64_t nSigOps = tx.GetLegacySigOpCount();
  381. nSigOps += tx.GetP2SHSigOpCount(mapInputs);
  382. entry.push_back(Pair("sigops", nSigOps));
  383. }
  384. transactions.push_back(entry);
  385. }
  386. Object aux;
  387. aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end())));
  388. uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
  389. static Array aMutable;
  390. if (aMutable.empty())
  391. {
  392. aMutable.push_back("time");
  393. aMutable.push_back("transactions");
  394. aMutable.push_back("prevblock");
  395. }
  396. Object result;
  397. result.push_back(Pair("version", pblock->nVersion));
  398. result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
  399. result.push_back(Pair("transactions", transactions));
  400. result.push_back(Pair("coinbaseaux", aux));
  401. if (pblock->vtx[0].vout.size() > 1)
  402. {
  403. const CTxOut& txout = pblock->vtx[0].vout[1];
  404. Object script;
  405. ScriptPubKeyToJSON(txout.scriptPubKey, script, true);
  406. result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue + (int64_t)pblock->vtx[0].vout[1].nValue));
  407. result.push_back(Pair("proofoftx", (int64_t)pblock->vtx[0].vout[1].nValue));
  408. result.push_back(Pair("proofoftxwinner", script));
  409. }
  410. else
  411. {
  412. result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
  413. result.push_back(Pair("proofoftx", (int64_t)0));
  414. result.push_back(Pair("proofoftxwinner", 0));
  415. }
  416. result.push_back(Pair("target", hashTarget.GetHex()));
  417. result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1));
  418. result.push_back(Pair("mutable", aMutable));
  419. result.push_back(Pair("noncerange", "00000000ffffffff"));
  420. result.push_back(Pair("sigoplimit", (int64_t)MAX_BLOCK_SIGOPS));
  421. result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE));
  422. result.push_back(Pair("curtime", (int64_t)pblock->nTime));
  423. result.push_back(Pair("bits", HexBits(pblock->nBits)));
  424. result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1)));
  425. return result;
  426. }
  427. Value submitblock(const Array& params, bool fHelp)
  428. {
  429. if (fHelp || params.size() < 1 || params.size() > 2)
  430. throw runtime_error(
  431. "submitblock <hex data> [optional-params-obj]\n"
  432. "[optional-params-obj] parameter is currently ignored.\n"
  433. "Attempts to submit new block to network.\n");
  434. vector<unsigned char> blockData(ParseHex(params[0].get_str()));
  435. CDataStream ssBlock(blockData, SER_NETWORK, PROTOCOL_VERSION);
  436. CBlock block;
  437. try {
  438. ssBlock >> block;
  439. }
  440. catch (std::exception &e) {
  441. throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
  442. }
  443. bool fAccepted = ProcessBlock(NULL, &block);
  444. if (!fAccepted)
  445. return "rejected";
  446. return Value::null;
  447. }