Commit graph

2255 commits

Author SHA1 Message Date
Dave Collins
0550bbbdc5 Add tests for new RuleError and ErrorCode types. 2014-06-24 19:14:30 -05:00
Dave Collins
6e0aab52df Improve the RuleError type to include error codes.
This commit changes the RuleError type to a struct which consists of an
error code and human-readable description.

From a usage perspective, existing code should not break since type
asserting an error to a RuleError still works in the same manner.  The
difference is the caller can now take that type asserted RuleError and
access the .ErrorCode field on it to programmatically identify the
specific rule that was violated.

ok @jrick
2014-06-24 19:14:24 -05:00
Josh Rickmar
35d555d541 Do not log warning for filtered block inv types.
ok @davecgh
2014-06-24 18:44:28 -05:00
Josh Rickmar
d2d518a8e4 btcctl: Add lockunspent support.
ok @davecgh
2014-06-24 18:36:05 -05:00
Josh Rickmar
00874b6ec2 Unmarshal correct lockunspent outpoints parameter. 2014-06-23 16:51:21 -05:00
Dave Collins
5f444ce000 Wait for conection to peer before mining with CPU. 2014-06-19 09:44:12 -05:00
Dave Collins
370899e1fc Change RawTxInput.Vout to uint32 as well.
This was missed by the previous commit.
2014-06-16 15:49:40 -05:00
Josh Rickmar
6dc257b8c8 Notify websocket clients of finished rescans.
ok @davecgh
2014-06-16 14:48:52 -05:00
Josh Rickmar
385201f9da Update test coverage report. 2014-06-16 14:47:11 -05:00
Josh Rickmar
160113d612 Add rescanfinished notification. 2014-06-16 14:46:25 -05:00
Dave Collins
289efbdea9 Update for recent btcjson API changes. 2014-06-16 14:44:36 -05:00
Dave Collins
b585d4e3a0 Make params which reference txout indices uint32.
This reasons for this change follow:

- All instances of the same key should be consistent amongst the commands
  and returns
- Output indices can't be negative, so rather than adding more code to
  check for a negative after unmarshal, just allow the unmarshal to weed
  out negatives

ok @jcvernaleo
2014-06-16 14:44:04 -05:00
Dave Collins
1997d73c65 Alphabetize result type declarations. 2014-06-13 17:06:41 -05:00
David Hill
7d228846bd sync tx_valid.json test data. 2014-06-13 11:34:47 -04:00
Josh Rickmar
6d79aa5ff1 Test panic for converting invalid sha strings.
ok @davecgh
2014-06-13 09:49:08 -05:00
Josh Rickmar
4bbcede9e0 Add tests for network registration.
While here, fix a bug found through testing.  Register will now return
ErrDuplicateNet if the caller attempts to register any of the standard
network parameters provided by this package.

ok @davecgh
2014-06-13 09:49:02 -05:00
Dave Collins
41dce5796d Update to coveralls.io for test coverage reporting.
Also add a test coverage badge to the README.md.
2014-06-12 18:44:34 -05:00
Dave Collins
acda2044a0 Add godoc reference badge to README.md. 2014-06-12 18:40:44 -05:00
Dave Collins
3cbba55822 Add support for TravisCI.
Also add TravisCI build status badge to README.md.
2014-06-12 18:37:35 -05:00
Dave Collins
0f23236f43 Make subsidy halving interval for simnet 210000.
This value matches testnet and mainnet and makes more sense because it
allows way more coins to be generated which is useful during simulation
testing.

NOTE: this will invalidate existing simnet chains, but since they
are only intended to be short lived for the duration of a simulation test,
this is a non-issue.
2014-06-12 18:20:51 -05:00
Dave Collins
c71988f668 Add comments for prefixes the encoding IDs map to. 2014-06-12 18:14:46 -05:00
GeertJohan
a3091847b3 Fix adding wrong HashAddrID to pubKeyHashAddrIDs 2014-06-13 01:00:59 +02:00
John C. Vernaleo
6a69acef21 Fix typo. 2014-06-12 15:41:57 -04:00
John C. Vernaleo
cd3d832551 Switch pingtime and pingwait to float64.
Needed to match bitcoin-core and btcjson.

ok @davec
2014-06-12 15:39:20 -04:00
John C. Vernaleo
3d7749fcea Change PingTime and PingWait to float64.
This is to match bitcoin-core.  Caught by Skelsey.

Closes #24
2014-06-12 15:36:57 -04:00
Dave Collins
ac5cc1d64e Use default genproclimit of -1 on setgenerate RPC.
The correct default for the genproclimit on the setgenerate RPC is -1.

ok @jcvernaleo.
2014-06-12 14:23:38 -05:00
David Hill
e9211bd01a Fix log message. 2014-06-12 14:04:05 -04:00
Dave Collins
eee338cbe3 Update mining-related RPC handlers for new code.
Now that btcd support CPU mining, update the getgenerate, setgenerate,
gethashespersec, and getmininginfo RPC handlers to return the appropriate
information.

Also, remove the various extra help addenda about btcd not supporting
mining since it is no longer true.
2014-06-12 12:06:26 -05:00
Dave Collins
e25b644d3b Implement a built-in concurrent CPU miner.
This commit implements a built-in concurrent CPU miner that can be enabled
with the combination of the --generate and --miningaddr options.  The
--blockminsize, --blockmaxsize, and --blockprioritysize configuration
options wich already existed prior to this commit control the block
template generation and hence affect blocks mined via the new CPU miner.

The following is a quick overview of the changes and design:

- Starting btcd with --generate and no addresses specified via
  --miningaddr will give an error and exit immediately
- Makes use of multiple worker goroutines which independently create block
  templates, solve them, and submit the solved blocks
- The default number of worker threads are based on the number of
  processor cores in the system and can be dynamically changed at
  run-time
- There is a separate speed monitor goroutine used to collate periodic
  updates from the workers to calculate overall hashing speed
- The current mining state, number of workers, and hashes per second can
  be queried
- Updated sample-btcd.conf file has been updated to include the coin
  generation (mining) settings
- Updated doc.go for the new command line options

In addition the old --getworkkey option is now deprecated in favor of the
new --miningaddr option.  This was changed for a few reasons:

- There is no reason to have a separate list of keys for getwork and CPU
  mining
- getwork is deprecated and will be going away in the future so that means
  the --getworkkey flag will also be going away
- Having the work 'key' in the option can be confused with wanting a
  private key while --miningaddr make it a little more clear it is an
  address that is required

Closes #137.

Reviewed by @jrick.
2014-06-12 12:05:32 -05:00
David Hill
8ce9c21148 Add new testnet seed testnet-seed.alexykot.me 2014-06-12 11:55:43 -04:00
Dave Collins
f0c05c76d3 Add getmininginfo to btcctl. 2014-06-11 22:41:22 -05:00
Dave Collins
c379061d6f Correct comment type for newInboundPeer. 2014-06-11 20:14:10 -05:00
Josh Rickmar
5a01ac2ed8 Update test coverage report. 2014-06-11 12:05:15 -05:00
Josh Rickmar
b873e70c95 Remove SetId. 2014-06-11 12:04:51 -05:00
Josh Rickmar
93f5aab0db Update test coverage report. 2014-06-11 12:02:35 -05:00
Josh Rickmar
65c0570234 Remove SetId from Cmd interface. 2014-06-11 12:01:05 -05:00
David Hill
f67358d4db Add estimatefee and estimatepriority to btcctl. 2014-06-11 11:12:27 -04:00
David Hill
39b09f7be1 Add support for estimatefee and estimatepriority. 2014-06-11 11:05:13 -04:00
David Hill
a992b48705 Add missing rpc commands and mark as unimplemented. 2014-06-11 10:46:19 -04:00
John C. Vernaleo
92c7716dd4 Update coverage report. 2014-06-10 16:29:56 -04:00
Nicola 'tekNico' Larosa
1723db03c5 Add type and handling for listreceivedbyaddress. 2014-06-10 16:25:53 -04:00
Brian Deery
ddc773535a Remove comments interpreted as settings
in go-flags/ini_private.go in function readIni there is no mechanism for
adding inline comments.  Only comments that have a semicolon as the first
non-whitespace character are ignored.

According to Wikipedia http://en.wikipedia.org/wiki/INI_file#Comments
inline comments are not universally supported.

This change adds some white space for readability, but
name := strings.TrimSpace(line[1 : len(line)-1]) removes accidental whitespace
left in later.

Closes #135.
2014-06-09 14:36:07 -05:00
Dave Collins
cc3e49fabb Make loadConfig function name a variable.
The errors in the loadConfig function had the function name hardcoded in
each error.  This commit assigns the function name to a variable instead.
2014-06-07 14:42:54 -05:00
Dave Collins
3266bf6a8d Convert to use gorilla websockets package.
Also, since the new websoscket package allows the message type to be set
independently from the type of the variable, remove the casts between
strings and []byte in the websocket read/write paths.  This avoids extra
copies thereby reducing the garbage generated.

Closes #134.
2014-06-07 01:34:33 -05:00
Josh Rickmar
7dcb68275f Make MaxMessagePayload an exported constant.
ok @davecgh
2014-06-06 22:33:39 -05:00
David Hill
bf48a97b0d Use NewReader instead of NewBuffer.
NewReader is slightly faster, but more importantly, ensures that the
data is read-only.
2014-06-05 14:00:22 -04:00
David Hill
8bce0ef3f8 Convert binary Write()'s to PutUint64()'s.
PutUint64 is faster than a generic binary write, and also removes
the 'bytes' package from the import list.
2014-06-05 14:00:22 -04:00
David Hill
66afd1dbc9 Use NewReader instead of NewBuffer. 2014-06-05 13:52:37 -04:00
Dave Collins
ee46a0b108 Use bytes.NewReader for deserialize when possible.
Rather than using bytes.NewBuffer, which is a read/write entity
(io.ReadWriter), use bytes.NewReader which is only a read entitiy
(io.Reader) in all cases where it is possible.  Benchmarking shows it's
slightly faster and it's also technically more accurate since it ensures
the data is read-only.

There are a few cases where bytes.NewBuffer must still be used since a
buffer with a known length is required for those instances.
2014-06-04 23:39:03 -05:00
David Hill
7f825fd9bc Remove unneeded usage of fmt.Sprintf 2014-06-04 20:24:48 -04:00