Commit graph

797 commits

Author SHA1 Message Date
David Hill
e5a825324c Limit the number of addresses announced.
Additionally, add the addresses being sent to the peer
to the known addresses map.
2015-01-02 13:04:28 -05:00
Dave Collins
04d47de262 Allow disabling RPC server TLS for localhost only.
This commit introduces a new flag, --notls, which can be used to disable
TLS for the RPC server.  However, the flag can only be used when the RPC
server is bound to localhost interfaces.  This is intended to prevent the
situation where someone decides they want to expose the RPC server to the
web for remote management/access, but forgot they have TLS disabled.
2015-01-02 11:17:23 -06:00
Beldur
e0fce5fe50 Fixed DeletePortMapping documentation typo 2015-01-01 21:59:57 +01:00
Ben Holden-Crowther
08257ac529 Updated license date
Changed 2014 to 2015 in preparation for new year
2014-12-29 20:46:11 +00:00
Dave Collins
33546047e3 Use correct error name in handleGetRawTransaction.
This commit corrects the error check from the createTxRawResult call in
handleGetRawTransaction.  It was previously given a different name which
resulted in the wrong error being checked.

Fixes #196.
2014-12-21 21:49:21 -06:00
Dave Collins
f1cbd40713 Improve handling of the home directory creation.
This commit improves a couple of issues surrounding the creation of the
btcd home directory.

First, the code was previously attempting to log any errors that occurred
while creating the directory using the logging system which is not
initialized at that point.  Thus, nothing was displayed to the user.

Second, if any component of btcd home directory path already exists, but
is not a directory, such as in the case of symlinks, the error returned
from the os.MkDirAll call indicates the directory can't be created.  While
this is true, it's not always the most helpful error to display to the
user.  So, this commit adds logic to detect when the failure case is due
to an existing symlink and displays a nicer error message suggesting the
user check if the destination of the link is mounted.

Fixes #193.
2014-12-21 17:01:56 -06:00
David Hill
bc46f8273c Add more reserved IP space to address manager. 2014-12-16 13:02:39 -05:00
Josh Rickmar
1d0c09a852 Require TLS 1.2 minimum.
This prevents a downgrade attack to the vulnerable SSLv3.  While here,
go ahead and require at least TLS 1.2 since TLS 1.0 and 1.1 have their
own set of issues and it's only a matter of time before those would
need to be completely avoided as well.

ok @davecgh
2014-12-15 13:53:14 -05:00
Josh Rickmar
1c4ac4426c Switch to new subrepo import paths. 2014-12-11 10:33:05 -05:00
Dave Collins
9c0db2f7fd Ensure all tickers are explicitly stopped.
As pointed out in #189, according to the Go documentation, a ticker must
be stopped to release associated resources.  This commit adds a defer call
to stop two tickers there were previously not being stopped as well as
changes two others that were being stopped over to use defer so it's more
consistent.

The other ticker in ScheduleShutdown is replaced and already calls Stop
before replacing it, so it has not been modified.

Closes #189.

ok @jrick
2014-12-03 18:43:31 -06:00
Dave Collins
888884a399 Use .haveTransaction in new getmempool RPC code.
The mempool is already locked and the exported version locks it, so the
unexported version is needed.
2014-11-17 15:46:42 -06:00
Dave Collins
1973aa5fd5 A few nitpicks with recent getrawmempool updates.
This commit addresses a few nitpicks in the recent getrawmppol update
which populates the starting and current priority fields.

In particular:

- Move the new calcInputValueAge function before the function which
  invokes it so it is consistent with the rest of the mempool code
- Double space after periods for consistency
- Correct the comments for calcInputValueAge to indiciate that inputs
  which are in the the memory pool count as zero toward the value age
  rather than the incorrect claim that that the overal input value age is
  zero when one of them does
- Rename endingPriority to currentPriority to match the RPC field and its
  actual function
- Make the comment about using zero when input transactions can't be found
  for some reason more accurate since there can be (and frequently is)
  more than one input transaction
2014-11-17 00:31:14 -06:00
Olaoluwa Osuntokun
a49b0d05b3 Add the starting+current priority to getrawmempool. 2014-11-16 23:58:33 -06:00
Dave Collins
c36b00c078 Add space in handleHeadersMessage log message. 2014-11-14 11:04:34 -06:00
Dave Collins
d078deb4a7 Update addblock util for recent chain API changes. 2014-10-11 13:16:32 -05:00
Dave Collins
c3065d32f4 Make use of the new btcchain MedianTimeSource.
This commit uses the new MedianTimeSource API in btcchain to create a
median time source which is stored in the server and is fed time samples
from all remote nodes that are connected.  It also modifies all call sites
which now require the the time source to pass it in.
2014-10-09 10:44:22 -05:00
Jonathan Gillham
1bbd1e9cba Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 16:34:30 +01:00
Dave Collins
02647404fa Prepare for release 0.9.0. 2014-09-20 13:00:02 -05:00
David Hill
4ad8622af9 Remove transactions from orphan pool.
This change removes transactions from a newly connected block
from the orphan pool if they exist.  Additionally, any orphan
transactions that are no longer orphan transactions are moved
to the mempool and inv'd to the currently connected peers.
2014-09-19 22:58:06 -05:00
Dave Collins
7452e51976 Update sample config file.
This commit adds a couple of options which were not details in the sample
config file.  It also fixes a couple of typos and makes the example default
maxpeers setting in the config file match the actual default used in btcd.
2014-09-18 15:28:39 -05:00
David Hill
efcf90d83d Use Warnf when processing directives. 2014-09-17 09:37:37 -04:00
John C. Vernaleo
2480cb3a87 Match error names to btcdb updates. 2014-09-16 15:09:32 -04:00
David Hill
41fbb87c86 Reject transactions with too many signature operations.
This matches recent changes in bitcoin core.
2014-09-10 19:28:03 -05:00
Olaoluwa Osuntokun
b97083f882 Fix some typos throughout repo. 2014-09-08 14:54:52 -05:00
Josh Rickmar
790f652d06 btcctl: Fix createrawtransaction amounts.
These were being counted in satoshis, when the JSON object should be
containing JSON numbers, counted in BTC.
2014-09-08 11:57:57 -05:00
Dave Collins
cf4f19dd4c Make btcctl errcheck clean.
This commit explicitly ignores errors that were already intentionally
ignored in btcctl by using an _ to make the errcheck utility happy.  It is
also nice to make it explicit that the error is being ignored
intentionally rather than leave questions of whether it was accidentally
forgotten.
2014-08-31 18:14:15 -05:00
David Hill
a429bebbba Pass the correct types for signrawtransaction. 2014-08-31 17:37:49 -05:00
David Hill
9cecf1dc2e Use the new bloom Reload API.
This fixes a race caught by the go race detector.
ok @jrick
2014-08-30 12:14:56 -04:00
David Hill
8f375ba391 Add getnetworkinfo support to btcctl.
ok @jrick
2014-08-29 09:39:37 -04:00
David Hill
8774a77d33 Use Errorf when using formatting directives.
Found by go vet.
2014-08-28 11:49:49 -04:00
David Hill
8f748615d4 Add testnet3 dnsseed testnet-seed.bitcoin.schildbach.de 2014-08-26 20:41:36 -04:00
ortutay
139d9cb447 Implement verifymessage RPC. 2014-08-22 16:58:02 -07:00
David Hill
6793bb23ac Display JSON when using btcctl's signrawtransaction. 2014-08-20 11:32:17 -04:00
David Hill
6d739c5a9e Add signrawtransaction to btcctl. 2014-08-20 11:27:27 -04:00
Dave Collins
ca13333d25 Always show help on help flag.
This commit resolves a minor issue where an error in the config file would
prevent the help from being shown until the config file error was
resolved.

This results in the following behavior:

- With a malformed header:
  $ ./btcd
  Error parsing config file: ~/btcd/btcd.conf:14: malformed section header
  Use btcd -h to show usage
- With an invalid option:
  $ ./btcd
  Error parsing config file: unknown option: bogus
  Use btcd -h to show usage
- Invoking help with an error in the config file:
  $ ./btcd -h
  Usage:
  ...
- Invoking with an invalid command line option:
  $ ./btcd --bogus=bogus
  unknown flag `bogus'
  Use btcd -h to show usage

ok @jrick
2014-08-19 20:29:59 -05:00
Dave Collins
3dc3fefc9b Improve readability of recent rate limiter changes.
This commit builds on the recent limiter updates.  The recent changes
introduced a new function named calcTxFee which could easily be confused
with calculating the fees of the transaction rather than its intended
purpose of calculating the minimum transaciton relay fee.

Rather than taking that approach, this commit instead renames the existing
function to calcMinRequiredTxRelayFee and uses a consistent variable name
for the serialized size of a transaction.  It then moves the check for
whether or not the check should be applied based on the serialized size of
the transcation and block priority to the call site.

This approach also has the benefit of avoiding two calls to the
calculation function since it's a local at the call site.

ok @jrick, @dajohi
2014-08-19 11:39:30 -05:00
David Hill
61a53adccd Fix the mempool rate limiter.
Before, btcd was rate limiting all transactions that had a minimum
fee of zero.  Now, btcd only rate limits transactions that contain
a fee less than the calculated fee based on size.

Closes #163
2014-08-19 10:22:22 -04:00
David Hill
e720e398a1 Mark getchaintips RPC command as unimplemented. 2014-08-12 11:33:07 -04:00
Dave Collins
74386998be Correct the addblock utility import.
This commit corrects the check in the addblock utility to check each block
links the previous hash as intended versus the current block.

Fixes #162.
2014-08-11 01:52:34 -05:00
Guilherme Salgado
ece3ed8443 Incrementally backoff when reconnecting to peers
This ensures we backoff when reconnecting to peers for which we don't
understand the replies, just like we do for peers we fail to connect to.

Closes #103
2014-07-25 14:05:56 -05:00
Josh Rickmar
8e74343747 Detect chain reorgs that happen during a rescan.
While here, switch rescan method to use hashes, not heights, to refer
to starting and ending blocks.

Closes #151.

ok @davecgh
2014-07-25 13:21:03 -05:00
Josh Rickmar
da993eb034 Fix sending of next item in notification queue.
The notification queue used for websocket client notifications had a
bug which caused the next queued item in some situations to not be
sent, but instead send a previously sent item.  This change fixes this
by setting the 'next' variable to the next item which must be
dequeued, if the queue length is non-zero.

This bug did not always manifest itself as if the receiving goroutine
was ready, a queued item could be sent directly to it rather than
waiting in the queue to be sent at a later time.
2014-07-25 08:20:58 -05:00
Josh Rickmar
790a4f5a6e Return nil for some spent gettxout outputs.
This change modifies the behavior of the gettxout RPC to match the
behavior of the reference client.  If a transaction output is spent by
a mined transaction, the handler will now return nil (JSON null).

While here, avoid indexing some slices multiple times, by creating a
local variable instead.
2014-07-24 15:02:07 -05:00
Dave Collins
764893c400 Ensure vars used atomically in peer are aligned.
The sync.atomic requires alignment of variables used atomically on ARM.
This commit moves the connected and disconnect variables in the peer
struct up so they are aligned.

Fixes #157.
2014-07-23 14:12:49 -05:00
Javed Khan
458a996ae6 updated utils to handle regtest, simnet
handle active network assignment in the same if-else
instead of having another switch-case
2014-07-22 08:28:33 -05:00
Dave Collins
1184a4d8d1 Prevent hang on shutdown race.
This commit prevents a race that could happen on shutdown if a sigint was
received between adding the first the interrupt handler and and future
handlers.  This code is loosely based on initial pull request #154 which
was not accepted due to introducing a race of its own.

Thanks to @tuxcanfly for the intial pull request and finding the issue.
2014-07-22 08:21:58 -05:00
Olaoluwa Osuntokun
293d71e9c3 Implement gettxout rpc.
Use new error type defined in Roasbeef/btcjson@4dc9db809
2014-07-19 13:01:59 -05:00
Josh Rickmar
8a7b73e62b Fix logging: Warn -> Warnf.
ok @davecgh
2014-07-17 11:45:58 -05:00
Dave Collins
08c01f08b1 Only show parse errors and command to invoke usage.
Rather than showing the usage when an error is encounted during options
parsing, show a message that describes how to invoke help instead.  This
is useful because the help is long enough now that the error is often
overlooked since it scrolls out of view.

ok @jrick
2014-07-14 20:43:54 -05:00
Dave Collins
000691dc9e Implement BIP0061 reject handling (pver 70002).
This commit implements reject handling as defined by BIP0061 and bumps the
maximum supported protocol version to 70002 accordingly.

As a part of supporting this a new error type named RuleError has been
introduced which encapsulates and underlying error which could be one of
the existing TxRuleError or btcchain.RuleError types.

This allows a single high level type assertion to be used to determine if
the block or transaction was rejected due to a rule error or due to an
unexpected error.  Meanwhile, an appropriate reject error can be created
from the error by pulling the underlying error out and using it.

Also, a check for minimum protocol version of 209 has been added.

Closes #133.
2014-07-14 12:25:11 -05:00