From 4fa237315e6815c12c78f39d42543c15cad470c1 Mon Sep 17 00:00:00 2001 From: Ovidiu Constantin Date: Thu, 16 Feb 2012 13:31:05 +0200 Subject: [PATCH] * Update server HOWTO to Bitcoin 0.5.2 --- server/HOWTO | 10 ++-- server/patches/bitcoin-0.5.2.diff | 82 +++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 server/patches/bitcoin-0.5.2.diff diff --git a/server/HOWTO b/server/HOWTO index 842c87b6..f72f598d 100644 --- a/server/HOWTO +++ b/server/HOWTO @@ -55,11 +55,11 @@ Step 2. Install a patched version of bitcoind Electrum server requires some small modifications to the bitcoind daemon. The patch is included in the Electrum sources we just downloaded, now we will download the Bitcoin sources, patch, compile and install the binary to our ~/bin directory. $ cd ~/src -$ wget https://github.com/bitcoin/bitcoin/tarball/v0.5.1 -O bitcoin-0.5.1.tgz -$ tar xvzf bitcoin-0.5.1.tgz -$ mv bitcoin-bitcoin-5623ee7 bitcoin-0.5.1 -$ cd bitcoin-0.5.1/src -$ patch -p 2 < ~/src/electrum/server/patches/bitcoin-0.5.1.diff +$ wget https://github.com/bitcoin/bitcoin/tarball/v0.5.2 -O bitcoin-0.5.2.tgz +$ tar xvzf bitcoin-0.5.2.tgz +$ mv bitcoin-bitcoin-fb24b05 bitcoin-0.5.2 +$ cd bitcoin-0.5.2/src +$ patch -p 2 < ~/src/electrum/server/patches/bitcoin-0.5.2.diff $ make -f makefile.unix $ strip bitcoind $ mv bitcoind ~/bin diff --git a/server/patches/bitcoin-0.5.2.diff b/server/patches/bitcoin-0.5.2.diff new file mode 100644 index 00000000..bb2d438a --- /dev/null +++ b/server/patches/bitcoin-0.5.2.diff @@ -0,0 +1,82 @@ +diff -ur bitcoin-0.5.2/src/bitcoinrpc.cpp bitcoin-0.5.2-electrum/src/bitcoinrpc.cpp +--- bitcoin-0.5.2/src/bitcoinrpc.cpp 2012-01-06 01:19:29.000000000 +0200 ++++ bitcoin-0.5.2-electrum/src/bitcoinrpc.cpp 2012-02-16 12:59:03.000000000 +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.2/src/main.cpp bitcoin-0.5.2-electrum/src/main.cpp +--- bitcoin-0.5.2/src/main.cpp 2012-01-06 01:19:29.000000000 +0200 ++++ bitcoin-0.5.2-electrum/src/main.cpp 2012-02-16 13:02:55.000000000 +0200 +@@ -2819,16 +2819,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); + ++ // 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);