RPC: return raw transactions instead of parsed representation.
authorCryptoManiac <balthazar@yandex.ru>
Sat, 19 Jul 2014 18:54:06 +0000 (22:54 +0400)
committerCryptoManiac <balthazar@yandex.ru>
Sat, 19 Jul 2014 18:54:06 +0000 (22:54 +0400)
This change allows us to dramatically reduce electrum-server RPC overhead, but breaks compatibility. If you are using script which depends on this functionality then add decoderawtransaction to get a parsed tx representation.

src/rpcblockchain.cpp

index d8860d5..8d2f389 100644 (file)
@@ -125,12 +125,11 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool fPri
     {
         if (fPrintTransactionDetail)
         {
-            Object entry;
+            CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
+            ssTx << tx;
+            string strHex = HexStr(ssTx.begin(), ssTx.end());
 
-            entry.push_back(Pair("txid", tx.GetHash().GetHex()));
-            TxToJSON(tx, 0, entry);
-
-            txinfo.push_back(entry);
+            txinfo.push_back(strHex);
         }
         else
             txinfo.push_back(tx.GetHash().GetHex());