Commit graph

2177 commits

Author SHA1 Message Date
Dave Collins
5135fd3203 Allow getwork result to be a bool or JSON object.
The getwork command alters the output depending on whether or not the
optional data parameter was specified.  It is a JSON object when no data
was provided, and a boolean indicating whether a solution was found
when data was provided.
2014-02-11 17:44:48 -06:00
Dave Collins
db87b9e85f Update btcctl getwork for latest btcjson changes. 2014-02-11 16:47:25 -06:00
Dave Collins
a733633685 Correct GetWorkCmd.
The getwork RPC now only accepts a single optional parameter which, if
present, is a string containing the hex-encoded block data to solve.

Also update the tests for the new correct parameters.

ok @jcvernaleo
2014-02-11 16:45:48 -06:00
Francis Lam
1d60e5dba5 Fixed data races in rpcwebsocket Notify functions
Access to connections map and associated notification maps in rpcServer
need to be protected with s.ws.Lock to prevent race with add/remove new
clients.

This closes #88.
2014-02-10 10:34:26 -05:00
Josh Rickmar
5c66641735 Make tests build again. 2014-02-10 09:11:25 -05:00
Dave Collins
cace9187d7 Correct typo in CmdGenerator comment. 2014-02-09 22:30:22 -06:00
Francis Lam
0821c583e5 Added explicit json key names to new tx notifications
Also added check for nil ID on AllVerboseTxNtfn.UnmarshalJSON to make it
consistent with other notification handling.
2014-02-09 13:43:02 -05:00
Dave Collins
149d8176b0 Fix an issue causing excessive memory consumption.
This commit resolves an issue where the block node index was forcing
entire blocks to be kept in memory thereby forcing excessive memory usage.
For example, prior to this change, the memory usage could consume upwards
of 1.5GB while importing bootstrap.dat via the addblock utility.  With
this change the entire import takes <150MB.  This also has the same memory
reduction to btcd since it uses the same code path.
2014-02-09 01:36:56 -06:00
Francis Lam
bb9d3696b4 Changed NewNotifyAllNewTXsCmd to optionally accept verbose arg 2014-02-08 18:26:06 -05:00
Francis Lam
354cc38d2d Added comments for new AddAllNewTxRequest method 2014-02-08 18:01:27 -05:00
Francis Lam
bfe374e735 Added comments for CmdGenerator and RegisterCustomCmdGenerator 2014-02-08 17:55:11 -05:00
Francis Lam
b89e93e52f Added notifyallnewtxs custom websocket command
Changed mempool.MaybeAcceptTransaction to accept an additional parameter
to differentiate betwee new transactions and those added from
disconnected blocks.

Added new fields to requestContexts to indicate which clients want to
receive all new transaction notifications.

Added NotifyForNewTx to rpcServer to deliver approriate transaction
notification.
2014-02-08 17:15:17 -05:00
Francis Lam
07c403efd0 Added commands to support notifyallnewtxs
Sending NotifyAllNewTXsCmd will register websocket client to receive
notifications on all new transactions.

Once registered the client will receive either AllTxNtfn or
AllVerboseTxNtfn based on the required verbose field in the
NotifyAllNewTXsCmd.
2014-02-08 17:03:22 -05:00
Francis Lam
773efd633d Added RegisterCustomCmdGenerator to btcjson package
Allows for addition of custom Cmd classes that implement UnmarshalJSON
directly as opposed to via RawCmd object and RawCmdParser
2014-02-08 16:41:36 -05:00
David Hill
642c834ada move Connection header so it is applied to failed authentication
attempts as well.

ok @davecgh
2014-02-07 20:59:20 -05:00
Dave Collins
476000193f Implement getnetworkhashps RPC.
Closes #87.
2014-02-07 16:32:11 -06:00
Dave Collins
190ef70ace Export CalcWork and BlocksPerRetarget.
This commit makes the CalcWork function and BlocksPerRetarget variable
available to external packages.
2014-02-07 16:29:19 -06:00
Dave Collins
7623d13c37 Make getnetworkhashps result an int64. 2014-02-07 12:10:10 -06:00
Dave Collins
02e594f826 Add getnetworkhashps to btcctl. 2014-02-05 15:33:32 -06:00
Dave Collins
bc6ff038e3 Fix a race in the amgr found by the race detector. 2014-02-05 12:37:35 -06:00
Dave Collins
6f063e0c1b Update byte counts unconditionally.
Rather than updating the byte counts in the error path and after the error
path, do it unconditionally before checking the error.
2014-02-05 11:50:40 -06:00
Dave Collins
c51df0ca3c Don't assign result from atomic.AddUint64. 2014-02-05 11:44:07 -06:00
Owain G. Ainsworth
75b59ef6e4 Add gettransaction to btcctl. 2014-02-05 17:39:25 +00:00
Dave Collins
1716136f62 Return milliseconds in getnettotals RPC.
This was returning microsecond instead of milliseconds.
2014-02-05 11:26:03 -06:00
Dave Collins
a39f4a0698 Correct total byte counters for server.
Previously the getnettotals was just looping through all of the currently
connected peers to sum the byte counts and returning that.  However, the
intention of the getnettotals RPC is to get all bytes since the server was
started, so this logic was not correct.

This commit modifies the code to keep an atomic counter on the server for
bytes read/written and has each peer update the server counters as well as
the per-peer counters.
2014-02-05 11:15:41 -06:00
Dave Collins
397c4caefe Correct getnettotals help message. 2014-02-05 10:51:59 -06:00
Dave Collins
5d70935b04 Convert getnettotals TimeMillis field to UTC.
This matches the reference implementation.
2014-02-05 09:54:16 -06:00
Dave Collins
4661be8758 Add support for GetNetTotalsResult.
ok @jcvernaleo
2014-02-05 09:43:25 -06:00
Dave Collins
6f5f582c42 Implement getnettotals RPC.
Also, change the display handler for getnettotals in btcctl to the JSON
display handler for better display.

Closes #84.
2014-02-05 09:39:03 -06:00
Dave Collins
f8c843e2e3 Rename bytesRead/Written to bytesReceived/Sent.
This makes it a little more clear the variables reprsent bytes sent across
the network as opposed to from disk.
2014-02-04 22:37:13 -06:00
Dave Collins
7cfef69f23 Prepare for release 0.6.0. 2014-02-04 17:38:24 -06:00
John C. Vernaleo
0d1539118b Add some missing comments on exported items. 2014-02-04 17:10:37 -05:00
Josh Rickmar
3cba42282e Fill in missing comment; found by golint. 2014-02-04 17:04:05 -05:00
Josh Rickmar
f6c7cf92fd Make go vet happy. 2014-02-04 17:00:27 -05:00
Dave Collins
bcb5a21b37 Add comment to ErrBadAuth to make go lint happy. 2014-02-04 15:37:34 -06:00
Dave Collins
238d942a69 Make go vet happy. 2014-02-04 15:34:44 -06:00
David Hill
971fbf8b28 gofmt 2014-02-04 16:18:37 -05:00
David Hill
d991c18d16 gofmt 2014-02-04 16:17:45 -05:00
David Hill
e1f66f6103 gofmt 2014-02-04 16:16:53 -05:00
David Hill
f6b03bf8a8 gofmt 2014-02-04 16:14:08 -05:00
David Hill
ae21689a57 gofmt 2014-02-04 16:13:24 -05:00
David Hill
463029df76 gofmt 2014-02-04 16:02:45 -05:00
David Hill
c1df0bfce6 get rid of redundant &handlerData 2014-02-04 15:49:31 -05:00
David Hill
25bb31ebd5 use bytes.Equal instead. 2014-02-04 15:40:16 -05:00
David Hill
d0dfff8292 fix typo in test: use %s for strings 2014-02-04 14:35:38 -05:00
David Hill
9f044fb946 use %d for int32 2014-02-04 13:55:23 -05:00
Josh Rickmar
0e8cbf71e8 Replace Error with Errorf, found by go vet. 2014-02-04 13:52:15 -05:00
Josh Rickmar
979357c5f1 Add sendtoaddress support to btcctl. 2014-02-04 13:18:58 -05:00
Dave Collins
13ba8607f7 Gofmt. 2014-02-04 11:22:51 -06:00
Dave Collins
038c8fb278 Add wiki link to README.md.
T#	util/loadheaders/
2014-02-04 11:06:39 -06:00