Commit graph

3525 commits

Author SHA1 Message Date
Dave Collins
e5ba199eed Add example to BlockLocator comments. 2013-10-13 02:06:42 -05:00
Dave Collins
44aafcf742 Return on file error in address manager save.
This commit modifies the address manager save code to exit when there is
an error creating the file used to store addresses.  Previously the error
was only logged leaving the invalid file handle to be used later.
2013-10-12 11:49:10 -05:00
Dave Collins
1f87ee217a Move testdata to root btcd directory.
Rather than duplicating the same data, just put it under testsdata at the
root and access it from the modules from the parent directory.
2013-10-12 01:49:57 -05:00
Dale Rahn
b680d3539f Revive old validate Tx in parallel code, faster...
requested by davec, cleanup/polish in-tree.
2013-10-11 18:31:54 -04:00
John C. Vernaleo
6212a7daff Improve rpcserver.
Add getdifficulty command to rpcserver.

Add missing error check in an old bit of rpcserver.

Add getbestblockhash command.
2013-10-11 17:04:18 -04:00
Dave Collins
2a8122ffde Actually check orphan pool for IsOrphanInPool. 2013-10-11 15:46:24 -05:00
Dave Collins
6368d5b170 Respond to getdata requests for transactions.
This commit adds code to properly respond to getdata requests for
transactions by fetching them from the transaction pool.  Previously, we
advertised newly available transactions, but the code to respond with the
actual transaction was not written yet.

Also, fix a couple of comments and make the pushTxMsg and pushBlockMsg
functions consistent.
2013-10-11 14:14:55 -05:00
John C. Vernaleo
7ad6d73416 Add support for recent commands:
getrawchangeaddress and getbestblockhash.
2013-10-11 15:12:27 -04:00
Dave Collins
8be23c89ae Cleanup a few comments. 2013-10-11 10:24:13 -05:00
Dave Collins
39e7e5c4a1 Add minor optimization to transaction store fetch.
This commit adds a quick check to the transaction store fetch code which
simply returns an empty store if no hashes were requested rather than
bothering the db with an empty list.
2013-10-11 10:22:40 -05:00
Dale Rahn
6260dc959d When creating database, set version 1 so the correct options are set. 2013-10-11 09:44:09 -04:00
Dave Collins
10907027b7 Change failure to talk to DNS seeders to debug.
This is just a temporary failure and shouldn't be a warning.  Also,
remove redundant prefix on profile server log print while here.
2013-10-10 20:30:55 -05:00
Dave Collins
24aba3189e Update DISC subsystem log out for consistency. 2013-10-10 18:33:38 -05:00
Dave Collins
3d62b24fe1 Reformat periodic block height ouput and add time.
Closes #9.
2013-10-10 18:24:23 -05:00
Dave Collins
9772626dd8 Improve logging.
This commit is a first pass at improving the logging.  It changes a number
of things to improve the readability of the output.  The biggest addition
is message summaries for each message type when using the debug logging
level.

There is sitll more to do here such as allowing the level of each
subsystem to be independently specified, syslog support, and allowing the
logging level to be changed run-time.
2013-10-10 17:22:19 -05:00
Dave Collins
54b5cb56e7 Move logger code into its own file.
This cleans up btcd.go a bit and consolidates the logging related
functions.  It also paves the way for upcoming message summaries.
2013-10-10 14:36:05 -05:00
David Hill
55b300b6c2 improve addblock 2013-10-10 14:05:54 -04:00
David Hill
8a2299c1e1 improve dropafter as with showblock 2013-10-10 13:58:11 -04:00
David Hill
2231e04e2b improve showblock by setting default datadir and requiring -s 2013-10-10 13:51:20 -04:00
David Hill
c4d7b2d2c6 Improve showblock options, add --testnet and change default db to leveldb
to match btcd
2013-10-10 13:42:21 -04:00
Dave Collins
e888372019 Optimize transaction lookups.
This commit modifies the transaction lookup code to use a set instead of a
slice (list).  This allows the lookup to automatically prevent duplicate
requests to the database.

Previously, the code simply added every referenced transaction to a list
without checking for duplicates, which led to multiple requests against
the database for the same transaction.  It also meant the request list
could grow quite large with all of the duplicates using far more memory
than required.

While the end result was accurate, operating that way is not as efficient
as only requesting unique transactions.
2013-10-10 12:23:46 -05:00
Josh Rickmar
486907c441 Add -testnet flag to showblock. 2013-10-10 13:22:55 -04:00
Dave Collins
a275687f3f Make peer load message consistent and fix spello. 2013-10-10 10:06:58 -05:00
Dave Collins
e04986528c Add --nocheckpoints option.
This commit provides a new flag, --nocheckpoints, to disable built-in
checkpoints.

Checkpoints are used for a number of things such a ensuring
the block chain being downloaded matches various known good blocks,
allowing quicker verification on old blocks since scripts don't have to be
executed, and preventing forks from old blocks, etc.
2013-10-09 19:34:02 -05:00
Dave Collins
32790d52d8 Add tests for HaveBlock.
This commit adds tests to ensure HaveBlock works properly with blocks on
the main chain, a side chain, orphans, and missing blocks.
2013-10-09 18:43:22 -05:00
Dale Rahn
003a41f66f Slightly cleaner fix. 2013-10-10 00:33:09 +01:00
Dave Collins
6d078d8115 Implement chain setup infrastructure in the tests.
This commit implents a basic infrastructure to be used throughout the
tests for creating a new chain instance that is ready to have tests run
against it.  It also returns a teardown function the caller can use to
clean up after it is done testing.  This paves the way for adding more
tests.
2013-10-09 18:29:53 -05:00
Owain G. Ainsworth
53ca29efad fix multi-byte bug in previous.
Use the right offset when working out if we should mask off the sign bit.
Add more tests that would have caught this case.
2013-10-10 00:20:14 +01:00
Owain G. Ainsworth
4e608c115f Prevent asInt() from modifying stack data.
The stack data is normally sliced from the actual script and btcscript is not
supposed to ever change the tx passed into it.

Add a test (and fix the other leading zeros tests) to stop this happening again.
2013-10-09 23:59:23 +01:00
Owain G. Ainsworth
cdc3002c85 Fix previous. We care if we have the block OR it is an orphan, not both. 2013-10-09 16:35:33 +01:00
Dave Collins
c1f0d9b1ad Make leveldb the default db for findcheckpoint.
This mirrors the change in btcd.
2013-10-08 20:50:15 -05:00
Dave Collins
a0119b056e Move transaction handling into block manager.
The block manager handles inventory messges to know which inventory should
be requested based on what is already known and what is already in flight.
So, this commit adds logic to ask the transaction memory pool if the
transaction is already known before requesting it and tracks pending
requests into an in-flight transaction map owned by the block manager.

It also moves the transaction processing into the block manager so the
in-flight map can be properly cleaned.
2013-10-08 20:46:59 -05:00
David Hill
e8d73d83ef Add btcctl; currently a barebones utility to send commands
to btcd.
2013-10-08 21:18:49 -04:00
Owain G. Ainsworth
093ddbe193 *sigh*, accidentally commited a wrong chunk as well as the right chunk.
Fix length check back to what it should be.
2013-10-09 01:27:19 +01:00
Dave Collins
cd68e3060f Remove extra msg in log message. 2013-10-08 17:45:05 -05:00
Owain G. Ainsworth
7ff3d5f871 Handle sign extended numbers in parsing variable length opcodes. 2013-10-08 23:24:19 +01:00
Dave Collins
f4dac3abf0 Update to use latest btcwire invtype constants. 2013-10-08 15:55:07 -05:00
Dave Collins
5c8fddf4b4 Add deprecated comments to legacy InvVect_* consts.
This makes it a little more obvious in the documentation that they are
deprecated.
2013-10-08 15:51:34 -05:00
Dave Collins
93d86305a2 Deprecate InvVect_* constants in favor of InvType*.
This commit changes the InvVect_* constants, which are not standard Go
style, to the InvType*. In order to preserve backwards compatibility, it
also adds a legacy.go file which maps the old public constant names to the
new ones.

Closes #1.
2013-10-08 15:44:48 -05:00
Dave Collins
c8160a57aa Switch to leveldb by default.
Also, add a warning if multiple block databases are detected.
2013-10-08 15:00:34 -05:00
Dave Collins
67838afb20 Go fmt and comments. 2013-10-08 13:34:04 -05:00
Dave Collins
2ad0d34d27 Add updating instruction to README.md. 2013-10-08 13:31:01 -05:00
Dave Collins
b911e7e455 Replace HaveInventory with HaveBlock.
The original thought was that chain would also house the transaction
memory pool, but that ultimately was decided against.  As a result,
it only makes sense to query chain for blocks rather than generic
inventory.
2013-10-08 12:32:15 -05:00
Josh Rickmar
8a743c344a Update all comments and test coverage with new func name 2013-10-08 13:12:24 -04:00
Josh Rickmar
83a19b239d Replace ScriptToAddress with ScriptToAddrHash to return an address hash. 2013-10-08 13:01:51 -04:00
Josh Rickmar
21a2158eca Fixes for btcutil and btcscript api changes 2013-10-08 12:37:06 -04:00
Dave Collins
697532bd68 Add handling for mempool command. 2013-10-08 00:04:51 -05:00
Dave Collins
d4e006e515 Update findcheckpoint to support testnet and dbtype. 2013-10-07 20:53:25 -05:00
Dave Collins
1d2c48555b Misc cleanup. 2013-10-07 19:24:44 -05:00
Dave Collins
19d28f90e6 Log transactions rejected from mempool as debug.
Most users won't care if a freestanding transaction is rejected from due
to a rule violation, but the information should still be available to
debug.
2013-10-07 18:45:53 -05:00