Commit graph

3531 commits

Author SHA1 Message Date
David Hill
c3abafc7eb Println -> Printf when using formatting directives.
This makes go vet happy.
2014-08-28 10:23:46 -04:00
David Hill
8f748615d4 Add testnet3 dnsseed testnet-seed.bitcoin.schildbach.de 2014-08-26 20:41:36 -04:00
Jonathan Gillham
516db23576 Replaced privkey in entire codebase. 2014-08-25 21:14:19 +01:00
Jonathan Gillham
da080e1598 Changed privkey to privKey for consistency. 2014-08-25 21:09:23 +01: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
Dave Collins
95cd1b97fa Make the OP_FALSE constant untyped.
This makes it consistent with the rest of the opcode constants.
2014-08-13 00:32:16 -05:00
Dave Collins
0932dfeb12 WIP coin type 2014-08-12 10:37:58 -05: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
Dave Collins
4ca0daacc1 Add test for private key serialization.
Also move private key tests to their own file while here.
2014-08-10 16:46:46 -05:00
Dave Collins
ff095cfa8e Correct verify signature example doco link. 2014-08-10 15:16:14 -05:00
Dave Collins
c949e04246 Use testable examples and update doc.go README.md.
This commit adds an example test file so it integrates nicely with Go's
example tooling.

This allows the example output to be tested as a part of running the
normal Go tests to help ensure it doesn't get out of date with the code.
It is also nice to have the examples in one place rather than repeating it
in doc.go and README.md.

Links and information about the examples have been included in README.md in
place of the examples and doc.go has been updated accordingly.
2014-08-10 15:14:36 -05:00
Dave Collins
c4fa69d490 Use a more specific license adjective. 2014-08-10 15:12:28 -05:00
Dave Collins
a51b5f98bf Remove test coverage report refs from README.md.
This is no longer needed since the repository is now configured to work
with coveralls.io for test coverage reporting.
2014-08-10 15:10:55 -05:00
Dave Collins
cf69fbec0a Move test coverage badge to top of README.md. 2014-08-10 14:07:45 -05:00
Dave Collins
d043cea490 Add test coverage badge to README.md. 2014-08-10 14:06:28 -05:00
Dave Collins
cdc91dd9ba Setup TravisCI to report cov stats to coveralls.io. 2014-08-10 14:02:54 -05:00
Dave Collins
e6011eaa49 Add godoc reference badge to README.md. 2014-08-10 13:58:10 -05:00
Michalis Kargakis
6ae916bd37 More tests
Tests for IsPushOnlyScript, HasCanonicalPushes, and CalcMultiSigStats
2014-08-08 14:53:55 +03:00
Michalis Kargakis
55ad967b4d Complete SetLogWriter testing 2014-08-03 23:30:37 +03:00
David Hill
ef0ca7dff5 sync bitcoind script tests 2014-08-01 13:40:56 -04:00
Michalis Kargakis
24c3873956 Add log testing
8/10 of SetLogWriter tested
2014-07-31 23:42:09 +03:00
Yurii Rashkovskii
b19d0a0232 Enforce low S values, by negating the value (modulo the order) if above order/2.
Reference implementation: b7bba43a14/src/key.cpp (L235-L238)

ht @oleganza
2014-07-31 22:04:14 +02:00
Josh Rickmar
85cc323e34 Remove GetAddressBalanceCmd.
Support for this extension request has been removed from btcwallet and
will not be returning.
2014-07-26 17:53:35 -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
Dale Rahn
f373ba3583 Introduce new error to indicate that block is not found vs db error.
ok @davecgh
2014-07-25 13:55:20 -05:00
Josh Rickmar
de236d5395 Use hashes for rescan, add hash+time to ntfns.
ok @davecgh
2014-07-25 13:28:37 -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
160a843171 Allow websocket conns to be established after New.
ok @davecgh
2014-07-25 13:17:43 -05:00
Josh Rickmar
6b8ff7f52f Use block shas for rescan begin/end.
Also send block sha and block time for rescanprogress/finished.

ok @davecgh
2014-07-25 13:17:30 -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
John C. Vernaleo
766d571317 Replace common error with defined value. 2014-07-24 10:06:25 -04: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
Dave Collins
0994bcf4b2 Add priv and public key bytes for HD wallet keys.
This commit introduces an HDPrivateKeyID and HDPublicKeyID field to the
params struct which are used by hierarchical deterministic extended keys
as defined by BIP0032.

In addition, a new function named HDPrivateKeyToPublicKeyID has been added
to allow the caller to get the associated public key ID given a private
key ID.

The tests have also been updated to maintain 100% test coverage.

ok @jrick
2014-07-19 03:19:19 -05:00
Josh Rickmar
8a7b73e62b Fix logging: Warn -> Warnf.
ok @davecgh
2014-07-17 11:45:58 -05:00
John C. Vernaleo
6aea36c550 Various changes to make golint happier. 2014-07-15 10:09:35 -04:00
Olaoluwa Osuntokun
033b00dd1c Properly set reply.Result to output of unmarshalled GetTxOutResult JSON.
Fix panic caused by nil pointer dereference.

Create new error type for invalid tx vout (gettxout).
2014-07-15 09:46:25 -04: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
Dave Collins
4deb922c9d Export command constants.
Although it is possible to get the command name for each msg type by
creating an instances of the type and calling the Command method against
it, it's slightly more efficient to simply allows callers to have direct
access to the exported constants.

This is currently really useful for the reject message since callers need
to be able to examine the command type to determine whether or not the
hash field needs to be included.
2014-07-14 10:38:29 -05:00
David Hill
2f0cab1a48 Log accepted blocks via submitblock.
ok @davecgh
2014-07-14 11:08:07 -04:00