1 diff -u -r bitcoin/src/bitcoinrpc.cpp bitcoin-electrum/src/bitcoinrpc.cpp
2 --- bitcoin/src/bitcoinrpc.cpp 2011-12-28 21:23:40.844812872 +0200
3 +++ bitcoin-electrum/src/bitcoinrpc.cpp 2011-12-28 17:31:24.000000000 +0200
8 +Value importtransaction(const Array& params, bool fHelp)
11 + if (fHelp || params.size() != 1 || (hexdump=params[0].get_str()).size()&1)
12 + throw runtime_error(
13 + "importtransaction <hexdata>\n"
14 + "Import an offline transaction to announce it into the network");
16 + std::vector<unsigned char> rawtx;
17 + for (int i=0; i<hexdump.size(); i+=2)
20 + if (sscanf(hexdump.substr(i,2).c_str(), "%x", &v)!=1)
21 + throw JSONRPCError(-4, "Error in hex data.");
22 + rawtx.push_back((unsigned char)v);
26 + CDataStream ss(rawtx);
29 + CInv inv(MSG_TX, tx.GetHash());
30 + if(! tx.AcceptToMemoryPool(true)) throw JSONRPCError(-4, "Transaction not accepted to memory pool.");
31 + CDataStream msg(rawtx);
32 + RelayMessage(inv, msg);
33 + return tx.GetHash().GetHex();
35 + catch (std::exception& e)
37 + throw JSONRPCError(-4, "Exception while parsing the transaction data.");
41 Value backupwallet(const Array& params, bool fHelp)
44 make_pair("getmemorypool", &getmemorypool),
45 make_pair("listsinceblock", &listsinceblock),
46 make_pair("dumpprivkey", &dumpprivkey),
47 - make_pair("importprivkey", &importprivkey)
48 + make_pair("importprivkey", &importprivkey),
49 + make_pair("importtransaction", &importtransaction)
51 map<string, rpcfn_type> mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0]));