diff -u -r bitcoin/src/bitcoinrpc.cpp bitcoin-electrum/src/bitcoinrpc.cpp --- bitcoin/src/bitcoinrpc.cpp 2011-12-28 21:23:40.844812872 +0200 +++ bitcoin-electrum/src/bitcoinrpc.cpp 2011-12-28 17:31:24.000000000 +0200 @@ -1437,6 +1437,38 @@ return entry; } +Value importtransaction(const Array& params, bool fHelp) +{ + string hexdump; + if (fHelp || params.size() != 1 || (hexdump=params[0].get_str()).size()&1) + throw runtime_error( + "importtransaction \n" + "Import an offline transaction to announce it into the network"); + + std::vector rawtx; + for (int i=0; i> tx; + CInv inv(MSG_TX, tx.GetHash()); + if(! tx.AcceptToMemoryPool(true)) throw JSONRPCError(-4, "Transaction not accepted to memory pool."); + CDataStream msg(rawtx); + RelayMessage(inv, msg); + return tx.GetHash().GetHex(); + } + catch (std::exception& e) + { + throw JSONRPCError(-4, "Exception while parsing the transaction data."); + } +} Value backupwallet(const Array& params, bool fHelp) { @@ -1950,7 +1982,8 @@ make_pair("getmemorypool", &getmemorypool), make_pair("listsinceblock", &listsinceblock), make_pair("dumpprivkey", &dumpprivkey), - make_pair("importprivkey", &importprivkey) + make_pair("importprivkey", &importprivkey), + make_pair("importtransaction", &importtransaction) }; map mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0]));