Commit graph

2255 commits

Author SHA1 Message Date
David Hill
06d2707744 We only care about the peers.json file... 2014-07-10 19:28:30 -05:00
David Hill
d269887c56 Put mutexes in exported functions. 2014-07-10 19:23:31 -05:00
David Hill
36e8b4c82e organize.
no objections from @davecgh
2014-07-10 19:03:34 -05:00
David Hill
ba937630d0 each goroutine needs its own random source.
caught by the race detector.
2014-07-10 14:52:02 -04:00
Dave Collins
bd7a100ebb Address a few more comments. 2014-07-10 09:43:03 -05:00
Dave Collins
ffe0b09890 Seed random generator in RPC server during init.
Rather than reseeding the PRNG used throughout the RPC server on each
call, do it once during init.

Suggested by @jrick
2014-07-10 09:43:02 -05:00
Dave Collins
180f4ac0a2 Implement some BIP0023 getblocktemplate mutations.
This commit implements a portion of the mutations section of BIP0023.
In particular, it adds the mutable, mintime, maxtime, and noncerange keys
to the returned block template along with indicating support for the time,
transactions/add, prevblock, and coinbase/append mutations.  Also, the
addition of the mintime and maxtime fields imply support for the
time/decrement and time/increment mutations.  Further, if the caller
indicates the coinbasevalue capability, the coinbasetxn field will be
omitted thereby implying support for the coinbase and generation
mutations.

Closes #124.
2014-07-10 09:43:01 -05:00
Dave Collins
21050b4751 Implement BIP0023 getblocktemplate block proposals.
This commit implements block proposals as defined by BIP0023.

This is work towards #124.
2014-07-10 09:43:00 -05:00
Dave Collins
db20f25ff7 Implement BIP0023 basic pool extensions support.
This commit implements the basic pool extension portion of the getblocktemplate
RPC as defined by BIP0023.

This is work towards #124.
2014-07-10 09:42:59 -05:00
Dave Collins
fc5656894d Implement getblocktemplate long poll support.
This commit implements the long polling portion of the getblocktemplate
RPC as defined by BIP0022.  Per the specification, each block template is
returned with a longpollid which can be used in a subsequent
getblocktemplate request to keep the connection open until the server
determines the block template associated with the longpollid should be
replaced with a new one.

This is work towards #124.
2014-07-10 09:42:58 -05:00
Dave Collins
eb7ecdcc22 Implement basic getblocktemplate BIP0022 support.
This commit implements the non-optional and template tweaking support for
the getblocktemplate RPC as defined by BIP0022.  This implementation does
not yet include long polling support.

This is work towards #124.
2014-07-10 09:42:57 -05:00
David Hill
3a45ec1058 Change AddAddressByIP to return an error. 2014-07-09 21:24:06 -04:00
David Hill
f7ce37f8c1 Switch btcctl to use btcutil.Amount. 2014-07-09 16:28:45 -04:00
David Hill
e68d46f556 Add full support for BIP0037 bloom filters.
This commit implements full support for filtering based on the filterload,
filteradd, filterclear, and merkleblock messages introduced by BIP0037.

This allows btcd to work seamlessly with SPV wallets such as BitcoinJ.

Original code by @dajohi.  Cleanup, bug fixes, and polish by @davecgh.
2014-07-09 13:33:42 -05:00
Dave Collins
307c52f25b Add new DNS seed for seeds.bitcoin.open-nodes.org. 2014-07-09 09:20:40 -05:00
Dave Collins
6a8b806a20 Correct QueueNotification comment.
This comment incorrectly said QueueMessage instead of QueueNotification.
2014-07-09 01:37:55 -05:00
Dave Collins
6248dd5e5d Don't return a double pointer.
This commit has no effect on the effective functionality since Go
automatically deferences pointers, but there is no reason to have a
double indirection when returning the reply for getmininginfo.
2014-07-09 01:34:56 -05:00
Dave Collins
95167204d9 Add ExtractPkScriptAddrs examples. 2014-07-08 14:59:57 -05:00
Dave Collins
631c7850ec Correct example link in README.md. 2014-07-08 14:43:50 -05:00
Dave Collins
abafe9678b Use testable example 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 example in one place rather than repeating it
in doc.go and README.md.

Links and information about the example have been included in README.md in
place of the example.
2014-07-08 14:42:39 -05:00
Dave Collins
3c2ae358b4 Add godoc reference badge to README.md. 2014-07-08 14:13:08 -05:00
Josh Rickmar
9e60210f18 Update for untyped btcutil consts.
ok @davecgh
2014-07-08 11:14:46 -05:00
Dave Collins
cc315d045e Use a more specific license adjective in README.md. 2014-07-08 10:32:29 -05:00
Dave Collins
d9ee066af6 Example link godoc web don't match local godoc. 2014-07-08 10:05:58 -05:00
Dave Collins
1c877b33ea Use magic syntax for godoc NewestSha example. 2014-07-08 10:04:03 -05:00
Dave Collins
4422b14f63 Categorize NewestSha example under Db interface.
It seems the godoc example extraction does not recognize the same syntax
used for functions with receivers when working with interfaces.

So, instead, categorize the example on the interface.
2014-07-08 09:27:13 -05:00
Dave Collins
05ff5bd8ec Add NewestSha example. 2014-07-08 09:10:14 -05:00
Dave Collins
329c0bf094 Update overview documentation to more recent stats. 2014-07-08 08:54:55 -05:00
Dave Collins
a12b62c24c Add commented imports to the example. 2014-07-08 08:50:12 -05:00
Dave Collins
9ed908f44a Use testable example and update README.md.
This commit moves the example to a 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 example in one place rather than repeating it
in doc.go and README.md.

Links and information about the example have been included in README.md in
place of the example.
2014-07-08 08:47:18 -05:00
Dave Collins
7354ecefe8 Add godoc reference badge to README.md. 2014-07-08 08:26:17 -05:00
Dave Collins
01fa7fa069 Add BigToCompact example. 2014-07-08 07:57:22 -05:00
Dave Collins
1a2baa3099 Add CompactToBig example. 2014-07-08 02:15:41 -05:00
Dave Collins
62c14b7001 Name new example so it shows up properly on godoc. 2014-07-08 01:49:48 -05:00
Dave Collins
94845326b5 Use testable example and update doc.go README.md.
This commit moves the ProcessBlock example to a 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 example in one place rather than repeating it
in doc.go and README.md.

Links and information about the example have been incldued in doc.go and
README.md in place of the example.
2014-07-08 01:45:28 -05:00
Dave Collins
7e875e7952 Add godoc reference badge to README.md. 2014-07-07 23:00:13 -05:00
Dave Collins
5a4242cb03 Update doc.go and README.md examples to use memdb.
Since the code is only intended to be example code, there is no reason to
use a database which actually writes to disk.
2014-07-07 22:52:36 -05:00
Dave Collins
8005d2e455 Update TODO list in README.
This package has supported https for quite some time.
2014-07-07 22:40:32 -05:00
Tomás Senart
2afc5a0af2 Use lighter atomic counters instead of mutexes
Where appropriate, it makes sense to use lighter weight atomic counters
instead of mutexes.
2014-07-07 13:04:39 -05:00
Dave Collins
16dc2cf2d0 Add errors to all interface methods.
This commit adds error returns to all of the Db interface methods except
for FetchTxByShaList and FetchUnSpentTxByShaList since they expose the
errors on each individual transaction.

It also updates all tests and code for both the leveldb and memdb drivers
for the changes.

Closes #5.

ok @drahn
2014-07-07 12:55:46 -05:00
Dave Collins
07bdbd9e3d Update for recent btcdb API changes. 2014-07-07 12:37:30 -05:00
Dave Collins
73228aaebe Update for recent btcdb API changes.
Since the underlying database driver can now return an error when looking
up if blocks and transactions exist, the HaveBlock function now includes
an error return to allow any underlying errors to be exposed.
2014-07-07 11:48:41 -05:00
David Hill
d31183ff19 go fmt 2014-07-07 11:07:30 -04:00
David Hill
879d69d040 use strconv.FormatInt which is much faster than fmt.Sprintf 2014-07-07 11:07:07 -04:00
David Hill
0dd81ad003 Use NewReader instead of NewBuffer.
NewReader is slightly faster than NewBuffer, but more importantly,
ensures the data is read-only.
2014-07-07 11:05:02 -04:00
David Hill
e2628dfc0d convert binary Read/Write to Uint/PutUint and copy 2014-07-07 11:05:00 -04:00
Dave Collins
fbb17fd35a Update TODO section of README.md.
This ability for multiple database backends has been available for a long,
long time.  Looks like this was simply not updated when the interface was
added.
2014-07-07 09:34:41 -05:00
David Hill
6f5a43d6c8 First round of address manager package refactor
These changes are a joint effort between myself and @dajohi.

- Separate IP address range/network code into its own file
- Group all of the RFC range declarations together
- Introduces a new unexported function to simplify the range declarations
- Add comments for all exported functions
- Use consistent variable casing in refactored code
- Add initial doc.go package overview
- Bump serialize interval to 10 minutes
- Correct GroupKey to perform as intended
- Make AddLocalAddress return error instead of just a debug message
- Add tests for AddLocalAddress
- Add tests for GroupKey
- Add tests for GetBestLocalAddress
- Use time.Time to improve readability
- Make address manager code golint clean
- Misc cleanup
- Add test coverage reporting
2014-07-07 09:04:22 -05:00
Dave Collins
dd41a4a233 Remove unneeded functions from memdb.
This commit removes some functions from memdb which only existed to satify
the btcdb.Db interface, but have since been removed from the interface.
2014-07-06 21:11:44 -05:00
Dave Collins
62f21d3600 Move address manager to its own package.
This commit does just enough to move the address manager into its own
package.  Since it was not originally written as a package, it will
require a bit of refactoring and cleanup to turn it into a robust
package with a friendly API.
2014-07-06 01:06:38 -05:00