1 diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
2 index 15bcf1d..bd63593 100644
3 --- a/src/bitcoinrpc.cpp
4 +++ b/src/bitcoinrpc.cpp
5 @@ -1497,6 +1497,43 @@ Value gettransaction(const Array& params, bool fHelp)
9 +Value importtransaction(const Array& params, bool fHelp)
12 + if (fHelp || params.size() != 1 || (hexdump=params[0].get_str()).size()&1)
13 + throw runtime_error(
14 + "importtransaction <hexdata>\n"
15 + "Import an offline transaction to announce it into the network");
17 + std::vector<unsigned char> rawtx;
18 + for (int i=0; i<hexdump.size(); i+=2)
21 + if (sscanf(hexdump.substr(i,2).c_str(), "%x", &v)!=1)
22 + throw JSONRPCError(-4, "Error in hex data.");
23 + rawtx.push_back((unsigned char)v);
27 + CDataStream ss(rawtx, SER_NETWORK, PROTOCOL_VERSION);
30 + CInv inv(MSG_TX, tx.GetHash());
33 + if(! tx.AcceptToMemoryPool(txdb, true)) throw JSONRPCError(-4, "Transaction not accepted to memory pool.");
34 + CDataStream msg(rawtx, SER_NETWORK, PROTOCOL_VERSION);
35 + RelayMessage(inv, msg);
36 + return tx.GetHash().GetHex();
38 + catch (std::exception& e)
40 + throw JSONRPCError(-4, "Exception while parsing the transaction data.");
46 Value backupwallet(const Array& params, bool fHelp)
48 if (fHelp || params.size() != 1)
49 @@ -1923,6 +1960,10 @@ Value getmemorypool(const Array& params, bool fHelp)
53 + if (tx.get_electrum_flag())
55 + tx.set_electrum_flag(true);
57 CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
60 @@ -2055,6 +2096,7 @@ static const CRPCCommand vRPCCommands[] =
61 { "listsinceblock", &listsinceblock, false },
62 { "dumpprivkey", &dumpprivkey, false },
63 { "importprivkey", &importprivkey, false },
64 + { "importtransaction", &importtransaction, false },
67 CRPCTable::CRPCTable()
68 diff --git a/src/main.cpp b/src/main.cpp
69 index 427e435..19236ac 100644
72 @@ -3222,18 +3222,21 @@ CBlock* CreateNewBlock(CReserveKey& reservekey)
75 unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
76 - if (nBlockSize + nTxSize >= MAX_BLOCK_SIZE_GEN)
78 + //if (nBlockSize + nTxSize >= MAX_BLOCK_SIZE_GEN)
81 // Legacy limits on sigOps:
82 unsigned int nTxSigOps = tx.GetLegacySigOpCount();
83 - if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
85 + //if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
88 // Transaction fee required depends on block size
89 bool fAllowFree = (nBlockSize + nTxSize < 4000 || CTransaction::AllowFree(dPriority));
90 int64 nMinFee = tx.GetMinFee(nBlockSize, fAllowFree, GMF_BLOCK);
92 + // Electrum server: do not check fees
95 // Connecting shouldn't fail due to dependency on other memory pool transactions
96 // because we're already processing them in order of dependency
97 map<uint256, CTxIndex> mapTestPoolTmp(mapTestPool);
98 diff --git a/src/main.h b/src/main.h
99 index 262e77e..4cc9319 100644
102 @@ -395,6 +395,16 @@ public:
104 bool DoS(int nDoSIn, bool fIn) const { nDoS += nDoSIn; return fIn; }
106 + bool electrum_flag;
108 + void set_electrum_flag(bool x){
112 + bool get_electrum_flag(){
113 + return electrum_flag;
119 @@ -416,6 +426,7 @@ public:
122 nDoS = 0; // Denial-of-service prevention
123 + set_electrum_flag(false);