30 Commits

Author SHA1 Message Date
Warren Togami
cdd76fa878 Litecoin: getworkex: CreateNewBlock() scriptPubKey argument instead of key 2013-11-14 00:44:49 -10:00
Jeff Garzik
a288878a00 Support absence of wallet (pwalletMain==NULL) in several locations,
notably RPC.

Conflicts:
	src/init.cpp
	src/rpcmining.cpp
	src/rpcwallet.cpp
	src/bitcoinrpc.cpp

Rebased-from: 541a7fcd515a27ebaa3ae5f1a9a698dab3db6ead
2013-11-14 00:44:49 -10:00
Jeff Garzik
6333bf9629 RPC: getblocktemplate does not require a key, to create a block template
getblocktemplate only uses certain portions of the coinbase transaction,
notably ignoring the coinbase TX output entirely.

Use CreateNewBlock() rather than CreateNewBlockWithKey(), eliminating
the needless key passing.

Should be zero behavior changes.
2013-11-14 00:44:49 -10:00
Jeff Garzik
b3060a26d0 CreateNewBlock() now takes scriptPubKey argument,
rather than a key.

CreateNewBlockWithKey() helper is added to restore existing functionality,
making this an equivalent-transformation change.

Conflicts:
	src/miner.cpp
	src/miner.h

Rebased-from: fcc32b7b9ce5bc310cbad677da7e7bca3a01459a
2013-11-14 00:44:49 -10:00
Wladimir J. van der Laan
5edaa52176 Move pMiningKey init out of StartRPCThreads
This commit decouples the pMiningKey initialization and shutdown from the RPC
threads.

`getwork` and `getblocktemplate` rely on pMiningKey, and can also be ran
from the debug window in the UI even when the RPC server is not running.

Solves issue #2706.

Conflicts:
	src/rpcmining.cpp
2013-11-14 00:44:48 -10:00
Warren Togami
d4c56161ae Revert "Litecoin: Remove native coin generation."
This reverts commit 94bf538131a5eb5c837044b14789a29981b7e0e6.

Conflicts:
	src/init.cpp
2013-11-14 00:44:48 -10:00
Charlie Lee
3100416cb1 Fix compiler warning for getnetworkhashps. 2013-09-17 11:13:07 +08:00
Charlie Lee
08ed7a26a9 For getnetworkhashps, use min/max to calculate the block times. 2013-09-14 02:06:24 +08:00
pooler
bfb4d29fa9 Use nChainWork in GetNetworkHashPS() 2013-08-29 18:21:44 +02:00
pooler
7446c4adc9 Update description of GetNetworkHashPS() 2013-08-06 11:34:14 +02:00
pooler
de5250f938 Add a height parameter to getnetworkhashps 2013-08-04 23:09:05 +02:00
Warren Togami
25cf33b01d Litecoin: User-visible strings s/bitcoin/litecoin/
Source filenames, comments and other aspects hidden to end-users are not renamed in an effort to minimize the diff.
2013-07-13 02:13:35 -10:00
Adrian Gallagher
94bf538131 Litecoin: Remove native coin generation. 2013-07-06 21:05:07 -10:00
Warren Togami
267715362c Litecoin: getworkex DEPRECATED - will be removed in TBD future version
Who wrote this?  Earliest reference is from litecoin-0.5.x
638f9b1b src/bitcoinrpc.cpp (Alex                     2012-02-15 22:53:27 +0400
2013-07-06 21:05:07 -10:00
coblee
3da6dc7302 Litecoin: getnetworkhashps 2013-07-06 21:05:06 -10:00
Gavin Andresen
36e826cea1 Clean up mining CReserveKey to prevent crash at shutdown
Fixes issue#2687
2013-05-23 14:17:15 -04:00
Gavin Andresen
ba1d08008e Do not use C++11 std::vector.data()
std::vector.data() is a C++11 feature that makes my OSX build machine unhappy.
2013-02-07 18:54:22 -05:00
Pieter Wuille
ef3988ca36 CValidationState framework 2013-01-30 03:56:44 +01:00
Forrest Voight
f3d872d1ea moved "index_in_template" to a separate variable to clarify what it is 2013-01-03 23:58:40 -05:00
Forrest Voight
0f927ceb5b use fee/sigop data in BlockTemplate struct instead of (not always correctly) calculating it ourselves 2012-12-19 16:12:58 -05:00
Forrest Voight
03cac0bb8e changed CreateNewBlock to return a CBlockTemplate object, which includes per-tx fee and sigop count data 2012-12-19 16:12:58 -05:00
Gregory Maxwell
3beac9837f Don't force getblocktemplate to have a parameter.
This looks like it was just a munged merge when ultraprune
was committed.
2012-10-24 12:39:46 -04:00
Pieter Wuille
ae8bfd12da Batch block connection during IBD
During the initial block download (or -loadblock), delay connection
of new blocks a bit, and perform them in a single action. This reduces
the load on the database engine, as subsequent blocks often update an
earlier block's transaction already.
2012-10-20 23:08:57 +02:00
Pieter Wuille
450cbb0944 Ultraprune
This switches bitcoin's transaction/block verification logic to use a
"coin database", which contains all unredeemed transaction output scripts,
amounts and heights.

The name ultraprune comes from the fact that instead of a full transaction
index, we only (need to) keep an index with unspent outputs. For now, the
blocks themselves are kept as usual, although they are only necessary for
serving, rescanning and reorganizing.

The basic datastructures are CCoins (representing the coins of a single
transaction), and CCoinsView (representing a state of the coins database).
There are several implementations for CCoinsView. A dummy, one backed by
the coins database (coins.dat), one backed by the memory pool, and one
that adds a cache on top of it. FetchInputs, ConnectInputs, ConnectBlock,
DisconnectBlock, ... now operate on a generic CCoinsView.

The block switching logic now builds a single cached CCoinsView with
changes to be committed to the database before any changes are made.
This means no uncommitted changes are ever read from the database, and
should ease the transition to another database layer which does not
support transactions (but does support atomic writes), like LevelDB.

For the getrawtransaction() RPC call, access to a txid-to-disk index
would be preferable. As this index is not necessary or even useful
for any other part of the implementation, it is not provided. Instead,
getrawtransaction() uses the coin database to find the block height,
and then scans that block to find the requested transaction. This is
slow, but should suffice for debug purposes.
2012-10-20 23:08:57 +02:00
Wladimir J. van der Laan
738835d7b8 Document RPC error codes
Replace all "magic values" in RPCError(...) by constants.
2012-10-04 15:49:15 +02:00
Jeff Garzik
0e1be81a4a Merge pull request #1771 from luke-jr/bugfix_bip22_mode
Bugfix: getblocktemplate: Accept optional "mode" parameter not being provided
2012-09-01 12:30:13 -07:00
Luke Dashjr
0689a7eb9c Bugfix: getblocktemplate: Accept optional "mode" parameter not being provided 2012-09-01 07:12:56 +00:00
Jeff Garzik
c625ae04d2 RPC, cosmetic: move more RPC code to new rpcblockchain.cpp module 2012-08-21 11:03:38 -04:00
Jeff Garzik
a2168d94c0 RPC: submitblock returns null on success, string on error 2012-08-21 02:41:46 -04:00
Jeff Garzik
7600e7fc39 RPC, cosmetic: Create rpcmining.cpp as new home for mining-related RPC code 2012-08-21 02:21:33 -04:00