From edb7865646830f15fd694931654b566ce8e20ef4 Mon Sep 17 00:00:00 2001 From: Ovidiu Constantin Date: Tue, 27 Dec 2011 23:59:54 +0200 Subject: [PATCH] * Single-file diff that applies cleanly to Bitcoin 0.5.1. --- patches/bitcoin-0.5.1.diff | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+), 0 deletions(-) create mode 100644 patches/bitcoin-0.5.1.diff diff --git a/patches/bitcoin-0.5.1.diff b/patches/bitcoin-0.5.1.diff new file mode 100644 index 0000000..4ed8468 --- /dev/null +++ b/patches/bitcoin-0.5.1.diff @@ -0,0 +1,82 @@ +diff -ur bitcoin-0.5.1/src/bitcoinrpc.cpp bitcoin-0.5.1-electrum/src/bitcoinrpc.cpp +--- bitcoin-0.5.1/src/bitcoinrpc.cpp 2011-12-13 22:56:26.000000000 +0200 ++++ bitcoin-0.5.1-electrum/src/bitcoinrpc.cpp 2011-12-27 22:44:06.494789148 +0200 +@@ -1362,7 +1362,43 @@ + 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) + { + if (fHelp || params.size() != 1) +@@ -1846,6 +1882,7 @@ + make_pair("settxfee", &settxfee), + make_pair("getmemorypool", &getmemorypool), + make_pair("listsinceblock", &listsinceblock), ++ make_pair("importtransaction", &importtransaction), + }; + map mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0])); + +diff -ur bitcoin-0.5.1/src/main.cpp bitcoin-0.5.1-electrum/src/main.cpp +--- bitcoin-0.5.1/src/main.cpp 2011-12-13 22:56:26.000000000 +0200 ++++ bitcoin-0.5.1-electrum/src/main.cpp 2011-12-27 22:44:18.714789152 +0200 +@@ -2820,16 +2820,19 @@ + + // Size limits + unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK); +- if (nBlockSize + nTxSize >= MAX_BLOCK_SIZE_GEN) +- continue; ++ //if (nBlockSize + nTxSize >= MAX_BLOCK_SIZE_GEN) ++ // continue; + int nTxSigOps = tx.GetSigOpCount(); +- if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS) +- continue; ++ //if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS) ++ // continue; + + // Transaction fee required depends on block size + bool fAllowFree = (nBlockSize + nTxSize < 4000 || CTransaction::AllowFree(dPriority)); + int64 nMinFee = tx.GetMinFee(nBlockSize, fAllowFree, true); + ++ // electrum server: do not check fees ++ nMinFee = 0; ++ + // Connecting shouldn't fail due to dependency on other memory pool transactions + // because we're already processing them in order of dependency + map mapTestPoolTmp(mapTestPool); -- 1.7.1