Commit graph

1637 commits

Author SHA1 Message Date
Dave Collins 76d84d4b40 Merge btcnet repo into chaincfg directory. 2015-02-05 21:54:45 -06:00
Dave Collins 40df138193 Import btcnet repo into chaincfg directory.
This commit contains the entire btcnet repository along with several
changes needed to move all of the files into the chaincfg directory in
order to prepare it for merging.  This does NOT update btcd or any of the
other packages to use the new location as that will be done separately.

- All import paths in the old btcnet test files have been changed to the
  new location
- All references to btcnet as the package name have been changed to
  chaincfg
- The coveralls badge has been removed since it unfortunately doesn't
  support coverage of sub-packages

This is ongoing work toward #214.
2015-02-05 21:53:44 -06:00
Dave Collins 2e5bb96eea Correct a few instances of missed pkg name changes. 2015-02-05 17:54:04 -06:00
Olaoluwa Osuntokun ecdffda748 Add support for an optional address-based transaction index.
* Address index is built up concurrently with the `--addrindex` flag.
* Entire index can be deleted with `--dropaddrindex`.
* New RPC call: `searchrawtransaction`
  * Returns all transacitons related to a particular address
  * Includes mempool transactions
  * Requires `--addrindex` to be activated and fully caught up.
* New `blockLogger` struct has been added to factor our common logging
  code
* Wiki and docs updated with new features.
2015-02-05 14:48:19 -08:00
Olaoluwa Osuntokun 86cbf27f58 Correct duplicated 'blockMsg' comment. 2015-02-05 14:30:43 -08:00
Dave Collins 03433dad6a Update btcwire path import paths to new location. 2015-02-05 15:16:39 -06:00
Dave Collins 979d67627f Update for recent TravisCI changes.
Also, override the struct tag checking which is broken in the latest go
vet.
2015-02-05 14:07:27 -06:00
Dave Collins 116736ee73 Run gofmt on wire directory. 2015-02-05 13:07:51 -06:00
Dave Collins 4dd7c939ed Update btcwire path import paths to new location. 2015-02-05 12:58:30 -06:00
Dave Collins cf6fc57f27 Merge btcwire repo into wire directory. 2015-02-05 12:39:50 -06:00
Dave Collins 2eef3720a9 Import btcwire repo into wire directory.
This commit contains the entire btcwire repository along with several
changes needed to move all of the files into the wire directory in
order to prepare it for merging.  This does NOT update btcd or any of the
other packages to use the new location as that will be done separately.

- All import paths in the old btcwire test files have been changed to the
  new location
- All references to btcwire as the package name have been chagned to
  wire
- The coveralls badge has been removed since it unfortunately doesn't
  support coverage of sub-packages

This is ongoing work toward #214.
2015-01-31 14:59:57 -06:00
Dave Collins 642e3c741a Update TravisCI to goclean script.
This commit causes TravisCI to run several tools on each pull request and
commit to help ensure the code quality remains high.  This includes gofmt,
goimports, golint, go vet, the race detector, and coverage stats.

Also, it instructs TravisCI to use nicer container-based builds.
2015-01-30 22:21:39 -06:00
David Hill 0247ddff18 Use the goleveldb Has() API.
This change converts the leveldb database's ExistsSha() and
ExistsTxSha to use the goleveldb API.  Has() only returns if
the key exists and does not need to read the entire value into
memory resulting in less disk i/o and much less GC.
2015-01-30 19:44:38 -05:00
Dave Collins 624bbb3216 Update btcchain import paths to new location. 2015-01-30 16:25:42 -06:00
Dave Collins 612ff7f813 Update btcchain import paths to new location. 2015-01-30 16:04:26 -06:00
Dave Collins 74ae61f048 Merge btcchain repo into blockchain directory. 2015-01-30 15:54:07 -06:00
Dave Collins b69a849114 Import btcchain repo into blockchain directory.
This commit contains the entire btcchain repository along with several
changes needed to move all of the files into the blockchain directory in
order to prepare it for merging.  This does NOT update btcd or any of the
other packages to use the new location as that will be done separately.

- All import paths in the old btcchain test files have been changed to
  the new location
- All references to btcchain as the package name have been changed to
  blockchain
2015-01-30 15:49:59 -06:00
Olaoluwa Osuntokun c01d175fde Relay inv msgs now include underlying data object
* When an inv is to be sent to the server for relaying, the sender
already has access to the underlying data. So
instead of requiring the relay to look up the data by
hash, the data is now coupled in the request message.
2015-01-30 10:52:07 -08:00
Dave Collins 3b1a15d0d5 Update btcscript import paths to new location. 2015-01-30 12:14:33 -06:00
Dave Collins 3f177c9895 Update btcscript import paths to new location. 2015-01-30 12:08:47 -06:00
Dave Collins be11f23e14 Merge btcscript repo into txscript directory. 2015-01-30 10:36:49 -06:00
Dave Collins cbda064842 Import btcscript repo into txscript directory.
This commit contains the entire btcscript repository along with several
changes needed to move all of the files into the txscript directory in
order to prepare it for merging.  This does NOT update btcd or any of the
other packages to use the new location as that will be done separately.

- All import paths in the old btcscript test files have been changed to the
  new location
- All references to btcscript as the package name have been chagned to
  txscript

This is ongoing work toward #214.
2015-01-30 10:30:16 -06:00
David Hill 115cea2109 Add new flag ScriptVerifySigPushOnly.
The ScriptVerifySigPushOnly flag enforces signature scripts to
only contain pushed data.  This is rule 2 of BIP0062.

Mimics Bitcoin Core commit d752ba86c1872f64a4641cf77008826d32bde65f
2015-01-29 23:57:15 -05:00
Dave Collins d7dbe25d97 Fix test error verbs found by go vet in the tests. 2015-01-29 16:26:49 -06:00
Dave Collins 7180e2a92b Make NOP1-NOP10 opcode execution non-standard.
This commit makes use of the new ScriptDiscourageUpgradableNops flag to
reject execution of NOP1 through NOP10 for transactions that are
considered standard.

This mirrors the behavior added to Bitcoin Core via pull request 5000.
2015-01-29 15:55:59 -06:00
d 8ebbd3a38e typo:using_bootrap_dat.md -> using_bootstrap_dat.md 2015-01-29 16:14:27 -05:00
Dave Collins 8e6abdb125 Make several of the reg tests more consistent.
This commit modifies various regression tests to make them more consistent
with other tests throughout the code base.

Also, it allows of all the tests to run in parallel.
2015-01-29 14:41:18 -06:00
David Hill f513518b4f Discourage NOPs reserved for soft-fork upgrades
NOP1 through NOP10 are reserved for future soft-fork upgrades.  When
such an upgrade occurs, the NOP argument will then require verification.
Rejecting transactions that contain these NOPs into the mempool will
discourage those transactions from being mined elsewhere and ensure
btcd will never mine such transactions.  This prevents now
invalid scripts (according to the majority of hashing power) even if the
client has not yet upgraded.

Non-executed upgradable NOPs are still allowed as they will still be
valid post-upgrade.

Mimics Bitcoin Core commit 03914234b3c9c35d66b51d580fe727a0707394ca
2015-01-29 11:36:03 -05:00
Dave Collins d67a0e207c Update for recent ScriptBuilder API change. 2015-01-29 00:11:19 -06:00
Dave Collins af5cbe4b4f Update script builder for BIP0062 and enforce limits.
BIP0062 defines specific rules and canonical encodings for data pushes.

The existing script builder code already conformed to all but one of the
canonical data push rules that was added after it was originally
implemented (adding a single byte of 0x81 must be converted to
OP_1NEGATE).  This commit implements that case and expands the existing
tests to explicitly cover all cases mentioned in BIP0062.

In addition, as a part of this change, the AddData function has been
modified so that any attempt to push more than the maximum script element
size bytes (520) in one push or any pushes the would cause the script to
exceed the maximum script bytes allowed by the script engine (10000) will
result in the final call to the Script function to only return the script
up to the point of the first error along with the error. This change
should have little effect on existing callers since they are almost
positively not creating scripts which violate these rules as they could
never be executed, however it does mean they need to check the new error
return.

Since the regression tests intentionally need to be able to exceed that
limit, a new function named AddFullData has been added which does not
enforce the limits, but still provides canonical encoding of the pushed
data.

Note that this commit does not affect consensus rules nor modify the
script engine.

Also, the tests have been marked so they can run in parallel.
2015-01-28 23:30:35 -06:00
Dave Collins ee403e2abd Address a few things found by golint. 2015-01-28 09:52:53 -06:00
Dave Collins 188cf2555f Remove the showblock utility.
This utility is a relic from initial development before it was possible to
request blocks and transactions via RPC.  The correct way to do this now
is by using RPC since that works while btcd is operating unlike the
utility which requires an exclusive lock on the database.
2015-01-28 09:52:02 -06:00
David Hill 741797c601 Intentionally ignore alert messages.
Currently, the reference client bans peers that send alerts not signed
with its key.  We could verify against their key, but since the
reference client developers are currently unwilling to support other
implementations' alert messages, we will not relay theirs.
2015-01-28 10:49:47 -05:00
Dave Collins 6a6e8dddf0 Correct a couple of descriptions in docs/README.md. 2015-01-27 19:17:54 -06:00
Dave Collins dd64dd96e9 Clarify how the database package is used. 2015-01-27 18:58:27 -06:00
Dave Collins 309a9ea31d Update database import paths to new location. 2015-01-27 15:38:23 -06:00
Dave Collins dd512e7315 Update database import paths to new location. 2015-01-27 15:00:49 -06:00
Dave Collins 8d7780e0ab Merge btcdb repo into database directory. 2015-01-27 13:32:36 -06:00
Dave Collins d574a3af6d Import btcdb repo into database directory.
This commit contains the entire btcdb repository along with several
changes needed to move all of the files into the database directory in
order to prepare it for merging.  This does NOT update btcd or any of the
other packages to use the new location as that will be done separately.

- All import paths in the old btcdb test files have been changed to the
  new location
- All references to btcdb as the package name have been chagned to
  database
- The coveralls badge has been removed since it unfortunately doesn't
  support coverage of sub-packages

This is ongoing work toward #214.
2015-01-27 13:15:15 -06:00
Olaoluwa Osuntokun b284bf0f90 Implement ldb database functionality for optional addrindex. 2015-01-26 14:02:15 -08:00
Dave Collins 66a17f8a47 Return time offset in getinfo RPC.
This was previously hard-coded to zero instead of using the offset
provided by the median time source which takes time samples from the other
connected nodes.
2015-01-24 11:24:53 -06:00
Michael Ford 03fa5ea7fd AddMac OSX to install instructions in README.md 2015-01-24 09:45:50 +08:00
Javed Khan 45158f8b8f Updated to add createnewaccount, renameaccount 2015-01-20 10:34:48 +05:30
Josh Rickmar 869363a210 Switch peer.requestQueue from linked list to slice.
Only two operations are performed with this data structure: adding to
the back and removing from the front.  Because middle inserts and
deletions are never needed, a linked list results in overall worse
performance due to an extra allocation for each element's node, worse
cache locality, and the runtime cost of boxing/unboxing each item
during accesses.

On top of the performance gains, a slice is more type safe as it is a
true generic data structure making it is impossible to insert or
access an element with the wrong type.
2015-01-19 17:44:44 -05:00
Dave Collins 11bf021ced Move all utilities into the cmd directory.
This is part of the migration and reorganization as discussed in #214.
2015-01-19 09:58:01 -06:00
Dave Collins 8a50187bf1 Move all wiki docs into docs folder of the repo.
This allows the docs to be updated via pull requests and makes it easier
to keep it in sync as a part of normal code updates.
2015-01-18 12:19:23 -06:00
Dave Collins f9f4d37976 Update btcd import paths to new location. 2015-01-17 00:48:13 -06:00
Dave Collins 7c4217cd54 Update btcwallet import paths to new location. 2015-01-17 00:27:28 -06:00
Dave Collins 9d03bf3a67 Update btcgui import paths to new location. 2015-01-17 00:17:38 -06:00
Dave Collins 919109f12c Update btcjson import paths to new location. 2015-01-16 23:58:09 -06:00