Add getworkex
[novacoin.git] / src / bitcoinrpc.cpp
index 755ac7d..3020691 100644 (file)
@@ -211,17 +211,21 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool fPri
     {
         if (fPrintTransactionDetail)
         {
-            txinfo.push_back(tx.ToStringShort());
-            txinfo.push_back(DateTimeStrFormat(tx.nTime));
-            BOOST_FOREACH(const CTxIn& txin, tx.vin)
-                txinfo.push_back(txin.ToStringShort());
-            BOOST_FOREACH(const CTxOut& txout, tx.vout)
-                txinfo.push_back(txout.ToStringShort());
+            Object entry;
+
+            entry.push_back(Pair("txid", tx.GetHash().GetHex()));
+            TxToJSON(tx, entry);
+            entry.push_back(Pair("time", DateTimeStrFormat(tx.nTime)));
+
+            txinfo.push_back(entry);
         }
         else
             txinfo.push_back(tx.GetHash().GetHex());
     }
+
     result.push_back(Pair("tx", txinfo));
+    result.push_back(Pair("signature", HexStr(block.vchBlockSig.begin(), block.vchBlockSig.end())));
+
     return result;
 }
 
@@ -1621,6 +1625,7 @@ Value gettransaction(const Array& params, bool fHelp)
                     if (pindex->IsInMainChain())
                     {
                         entry.push_back(Pair("confirmations", 1 + nBestHeight - pindex->nHeight));
+                        entry.push_back(Pair("txntime", (boost::int64_t)tx.nTime));
                         entry.push_back(Pair("time", (boost::int64_t)pindex->nTime));
                     }
                     else
@@ -2078,6 +2083,7 @@ Value getworkex(const Array& params, bool fHelp)
         if (!pblock->SignBlock(*pwalletMain))
             throw JSONRPCError(-100, "Unable to sign block, wallet locked?");
 
+
         return CheckWork(pblock, *pwalletMain, reservekey);
     }
 }
@@ -2481,7 +2487,7 @@ Value getnewpubkey(const Array& params, bool fHelp)
         pwalletMain->TopUpKeyPool();
 
     // Generate a new key that is added to wallet
-    std::vector<unsigned char> newKey = pwalletMain->GenerateNewKey(false);
+    std::vector<unsigned char> newKey = pwalletMain->GenerateNewKey(true);
 
     if(!newKey.size())
         throw JSONRPCError(-12, "Error: Unable to create key");
@@ -2831,7 +2837,7 @@ static const CRPCCommand vRPCCommands[] =
     { "signmessage",            &signmessage,            false },
     { "verifymessage",          &verifymessage,          false },
     { "getwork",                &getwork,                true },
-    { "getworkex",              &getworkex,                true },
+    { "getworkex",              &getworkex,              true },
     { "listaccounts",           &listaccounts,           false },
     { "settxfee",               &settxfee,               false },
     { "getmemorypool",          &getmemorypool,          true },