Commit graph

427 commits

Author SHA1 Message Date
Dave Collins
2bb8c5d5cc Bring back default redirect for profiling.
Now that the RPC server uses its own mux, bring back the code which does
the automatic 303 redirect for the root of the profile server.
2013-10-23 10:48:17 -05:00
Dave Collins
5a4772bdc6 Change the RPC server to use it's own Muxer.
Rather than relying on the http package's DefaultServeMux for the RPC
server, create a unique mux specifically for the RPC server.  This ensures
things, such as the http profiling handlers, do not commingle.
2013-10-23 10:45:43 -05:00
Dave Collins
8970d4bf99 Revert "Add default redirect for profiling when enabled."
This reverts commit cc6cfdad9e.
2013-10-23 10:25:09 -05:00
Dave Collins
cc6cfdad9e Add default redirect for profiling when enabled.
This commit adds a simple 303 redirect for the root of profile server so
launching it without a path automatically goes to the debug profiling
page.
2013-10-23 09:39:02 -05:00
Dave Collins
7846b2f4e2 Update README.md TODO to remove 32-bit MSI.
32-bit MSIs will now be available for all future releases.
2013-10-22 17:05:43 -05:00
Dave Collins
1e93cdad6e Add 0.3.2 deps to deps.txt. 2013-10-22 16:45:19 -05:00
Dave Collins
3b025b2352 Prepare for release 0.3.2. 2013-10-22 16:40:51 -05:00
Dave Collins
8f75a09479 Remove sqlite as an available db type. 2013-10-22 15:01:51 -05:00
John C. Vernaleo
1420eccf73 Use rpc errors defined in btcjson. 2013-10-22 12:28:00 -04:00
Dave Collins
9ded3fa2cf Generate usage from handler data in btcctl.
Rather than having to keep the usage in sync with the supported commands,
simply include the usage as a field in the command handlers map and
dynamically generate the usage from there.
2013-10-22 10:56:56 -05:00
Dave Collins
d4f980c71f Show usage on no params to btcctl. 2013-10-22 10:15:46 -05:00
Dave Collins
c55152ef7e Always return non-zero code from btcctl on error. 2013-10-22 10:01:13 -05:00
Dave Collins
629168b7ae Perform display handler check before issues RPC.
This commit modifies the command handler in btcctl to check the existence
of a display handler before issues an RPC command.  This prevents a round
trip to the server if there is no display handler.

Also, fix a couple of comments while here.
2013-10-22 00:40:17 -05:00
Dave Collins
4e5cd1a326 Allow nil conversion handlers in btcctl. 2013-10-21 23:03:11 -05:00
Dave Collins
2ea4239f5e Improve btcctl.
This commit significantly reworks btcctl to use a map based approach to
command handling.  This reduces the number of lines of code needed,
simplifies adding new commands, improves the error handling, and removes
several cases where unexpected data was not handled properly (it could
panic).

This commit also adds the ability to specify the optional parameter on
getrawtransaction.

Discussed with dhill@.
2013-10-21 22:58:47 -05:00
Dave Collins
102fc5f513 Rework the mempool locking code.
It was previously possible for the unprotected iteration of the mempool
orphans to lead to undefined results.  This commit remedies that by
reworking the locking code a bit.  It also embeds the mutex directly into
the mempool struct rather than having a separate field for it so the
syntax is a slightly cleaner.
2013-10-21 18:22:59 -05:00
David Hill
27abb0eb3e add "addnode" to btcctl 2013-10-21 14:09:05 -04:00
David Hill
e1a02d71b3 add getpeerinfo to btcctl 2013-10-21 13:26:40 -04:00
David Hill
a975b60a0a add getconnectioncount skeleton to rpc 2013-10-21 13:00:13 -04:00
David Hill
3130659cdf add getconnectioncount to btcctl 2013-10-21 12:59:07 -04:00
Josh Rickmar
5bfc9c7eed Remove possible nil pointer dereferences.
Results from FetchTxByShaList must each be checked for a nil Err and a
non-nil Tx.  Fix this issue in two places where these conditions were
not being checked.
2013-10-20 13:02:34 -04:00
Dave Collins
d44d253dff Make quit channel with RPC server.
The latest websockets code added a quit channel to the RPC server, but did
not initialize it.  This commit corrects that so shutdown works properly
again.
2013-10-20 11:06:36 -05:00
David Hill
0abfdcc88b fix reversed variables in a warning message. 2013-10-17 16:58:57 -04:00
Dave Collins
e5620d6387 Correct reply for getrawmempool RPC command.
The RPC command needs to return a slice of hash strings, not the
underlying *btcwire.ShaHash bytes.
2013-10-17 12:11:04 -05:00
David Hill
ff20c420a2 add decoderawtransaction, getbestblockhash, getdifficulty, and
getrawmempool to btcctl.
2013-10-17 12:35:27 -04:00
David Hill
4c50ff541f fix getbestblockhash 2013-10-17 12:33:46 -04:00
David Hill
ffed6599ce add getrawmempool to rpcserver 2013-10-17 12:23:53 -04:00
Owain G. Ainsworth
5a9cc91e62 Add an idle timer for peers.
If we don't hear from a peer for 5 minutes, we disconnect them. To keep
traffic flowing we send a ping every 2 minutes if we have not send any
other message that should get a reply.
2013-10-17 17:06:47 +01:00
Owain G. Ainsworth
bc89dedf9a Remove prevGetBlocksMutex.
This is only ever accessed from one place (blockmanager) which is single
threaded.
2013-10-17 17:06:47 +01:00
Owain G. Ainsworth
a41c874837 Remove stale comment. 2013-10-17 17:06:47 +01:00
Owain G. Ainsworth
2231456c23 Make it possible to get a notification when a message has been sent.
If a channel is passed in then true will be sent on the provided channel
after the message has successfully sent.
2013-10-17 17:06:41 +01:00
Owain G. Ainsworth
178d9dc7b0 Peer: use QueueMessage instead of directly using the channel. 2013-10-17 17:05:21 +01:00
Owain G. Ainsworth
163b32887b Add blockmanager.current with extra checks for whether we are up to date.
This uses peer state to confirm if we are up to date, as well as what
chain thinks.
2013-10-17 17:05:18 +01:00
Josh Rickmar
bbcfdcf5aa Clean up notification contexts and goroutines after ws disconnect.
This refactors the wallet notification code to reverse the order of
how notification contexts are stored.  Before, watched addresses and
outpoints were used as keys, with a special reply channel as the
value.  This channel was read from and replies were marshalled and
sent to the main wallet notification chan, but the goroutine handling
this marshalling never exited because the reply channel was never
closed (and couldn't have been, because there was no way to tell it
was handling notifications for any particular wallet).

Notification contexts are now primarily mapped by wallet notification
channels, and code to send the notifications send directly to the
wallet channel, with the previous goroutine reading the reply chan
properly closing.

The RPC code is also refactored with this change as well, to separate
it more from websocket code.  Websocket JSON extensions are no longer
available to RPC clients.

While here, unbreak RPC.  Previously, replies were never sent back.
This broke when I merged in my websocket code, as sends for the reply
channel in jsonRead blocked before a reader for the channel was
opened.  A 3 liner could have fixed this, but doing a proper fix
(changing jsonRead so it did not use the reply channel as it is
unneeded for the standard RPC API) is preferred.
2013-10-17 09:11:55 -04:00
David Hill
90fbae1781 give btcctl some options instead of using hardcoded values 2013-10-16 19:19:26 -04:00
mischief
f346c36a0d add setLimits stub for plan 9 2013-10-16 15:19:21 -05:00
Dave Collins
ae5810bc50 Change default RPC port to 8334 (18334 testnet).
This change paves the way for running btcwallet on the same system without
having to change any settings.  The well-known ports used by the
reference implementation (8332 mainnet, 18332 testnet) will be exposed by
the separate wallet process, which will in turn forward unknown requests
to btcd via websockets (on 8334/18334).  This allows the wallet process to
ultimately provide a unified interface that exposes the same RPC-JSON API
as the reference implementation will maintaining wallet and chain
separation.
2013-10-16 15:01:43 -05:00
Dave Collins
ccfcbebbdc Add config file information to command doc. 2013-10-16 10:16:11 -05:00
Dave Collins
dd6b71300f Add basic btcd command documentation.
This will be expanded upon in future commits.
2013-10-16 10:04:12 -05:00
Dave Collins
f10d2c9449 Add sample relnotes format release script expects. 2013-10-15 18:16:18 -05:00
Dave Collins
b03817c0d8 Add script to help prepare releases. 2013-10-15 18:05:24 -05:00
Dave Collins
f40181615e Unix line endings on CHANGES file. 2013-10-15 17:53:16 -05:00
Dave Collins
5a71ba04a9 Add CHANGES file. 2013-10-15 17:11:43 -05:00
Dave Collins
7eb9deee35 Show the version on server startup. 2013-10-15 15:54:00 -05:00
Dave Collins
b4cbbb1f8b Add 0.3.1 deps to deps.txt. 2013-10-15 12:03:09 -05:00
Dave Collins
8f4a34e4f1 Bump version to 0.3.1. 2013-10-15 12:02:14 -05:00
David Hill
d402cb4196 combine two log statements into one 2013-10-15 12:17:23 -04:00
David Hill
d6adef91f8 Announce our mailing lists 2013-10-15 12:16:17 -04:00
Dave Collins
14f81aa479 Add handler for notfound messages.
For now, these are ignored, but ultimately they should be used to
re-request the missing inventory from another peer.
2013-10-15 10:35:42 -05:00
Owain G. Ainsworth
0536e3104c Don't send messages before handshake.
If we haven't handshaken with a peer don't send messages that are not
the handshake. Additionally don't queue up invs for sending, they'll
find out soon enough when they ask us what we know.
2013-10-14 22:27:48 +01:00