Commit Graph

48 Commits

Author SHA1 Message Date
Markus Richter
1cd9b6805d docs: document packages and fix typo 2018-01-08 16:04:45 -06:00
David Hill
b13f5dfbda travis: add ineffassign linter 2017-12-01 09:14:04 -05:00
Samarth Hattangady
4f023d7260 bloom: Fix link in README.
The link in the dcrd/bloom/README.md page led to a 'Not Found' page on
GoDoc. The link has now been changed.
2017-11-21 00:40:56 +05:30
David Hill
f586e66427 bloom: workaround go vet issue in example (#895) 2017-10-12 14:43:22 -04:00
Nicola Larosa
29616d9d28 bloom: Add missing import to examples. 2017-10-12 07:06:55 -05:00
Josh Rickmar
6842aa006d Merge remaining dcrutil code into a dcrd package.
This merge commit adds the following code from the
github.com/decred/dcrutil package into a new
github.com/decred/dcrd/dcrutil package:

* Address handling
* Amount type
* AppDataDir func
* bitflags functions
* Block wrapper type
* Hash160 func
* Tx wrapper type
* WIF type

as well as all tests for this code.

The old github.com/decred/dcrutil/hdkeychain package has also been
merged and moved to github.com/decred/dcrd/dcrutil/hdkeychain.

dcrd packages have been updated to use the new packages and the dep
files have been updated for this change.
2017-10-11 22:06:36 -04:00
Josh Rickmar
8564843206 Import dcrutil repo under dcrutil directory. 2017-10-11 21:29:08 -04:00
Josh Rickmar
c394c7bd19 Copy github.com/decred/dcrutil/bloom to bloom package.
Use this new bloom package rather than relying on the bloom package
from the dcrutil repo.

Some minor source code changes have been made to conform to the dcrd
linter requirements.
2017-10-11 15:36:57 -04:00
John C. Vernaleo
0598b59926 Update README.md files for new github md parser 2017-05-26 11:52:21 -04:00
Dave Collins
883bcecb86
Update for recent chainhash-related API changes.
Upstream commit 22c91fa80a.

Also, in keeping with the spirit of the upstream commits, the merge
commit also renames all other instances of variables and function names
that have sha in their names to include hash instead.  This is
particularly beneficial for Decred because decred uses blake for hashing
instead of sha.
2016-11-16 12:22:20 -06:00
Dave Collins
ad458fda2e
bloom: Avoid a few unnecessary hash copies.
Contains the following upstream commits:

- 52bb44a147
  - Reverted because Travis is already on more recent versions
- e0dbb5b535
  - Reverted because txsort needs a decred-specific spec
- bdf4400eca
  - Reverted because it has already previously been cherry-picked
- 2c26dd81a5
2016-11-15 13:57:53 -06:00
Dave Collins
171af170c2
Fix range check in bloom filter false positive rate
Contains the following upstream commits:

- ff82dacded
  - This is a NOOP since it was previously cherry-picked
- 2d190f72ff
  - This is a NOOP since it was previously cherry-picked
- 44e3030885
2016-11-15 13:38:32 -06:00
Dave Collins
e47deda418
docs: Make various README.md files consistent.
Contains the following upstream commits:
- 5fd45e8085
  - Reverted because txsort needs a decred-specific spec
- 98fd0a0661
  - Reverted because txsort needs a decred-specific spec
- e0e9257790
  - Reverted because txsort needs a decred-specific spec
- 0df67ee064
  - Reverted because txsort needs a decred-specific spec
- d6989ebc71
  - Reverted because txsort needs a decred-specific spec
- e8bab6bc19

As noted, the merge commit reverts all of the txsort-related commits in
between.  It also modifies the paths in the README updates to
decred-specific paths.
2016-11-15 13:02:05 -06:00
Dave Collins
e8f6c8f7ce Remove TxTree definitions in favor of wire defs. (#18)
This removes the TxTree definitions and updates the code to make use of
the definitions from wire.
2016-11-14 15:00:06 -06:00
Dave Collins
22c91fa80a Update for recent chainhash-related API changes. (#78)
This updates all code in the main package and subpackages to make use of
the new chainhash package since the old wire.ShaHash type and functions
have been removed in favor of the abstracted package.

Also, since this required API changes anyways and the hash algorithm is
no longer tied specifically to SHA, all other functions throughout the
code base which had "Sha" in their name have been changed to Hash so
they are not incorrectly implying the hash algorithm.

The following is an overview of the changes:

- Update all references to wire.ShaHash to the new chainhash.Hash type
- Rename the following functions and update all references:
  - Block.Sha -> Hash
  - Block.TxSha -> TxHash
  - Tx.Sha -> Hash
  - bloom.Filter.AddShaHash -> AddHash
- Rename all variables that included sha in their name to include hash
  instead
- Add license headers to coinset package files
2016-08-08 12:38:16 -05:00
Dave Collins
b1f27b6ab9 Return matched tx indices from NewMerkleBlock. (#10)
This commit modifies the NewMerkleBlock function to return the matched
transaction indices instead of their hashes.  This is being done because
it is much easier for the caller to lookup the matched transactions from
the original passed block based on their transaction index within the
block versus their hashes.
2016-05-12 13:44:43 -05:00
Dave Collins
2c26dd81a5 bloom: Avoid a few unnecessary hash copies. (#76)
This changes several places which call the Bytes method of a ShaHash to
simply use a slice of it in order to avoid the extra unnecessary copies.
2016-04-23 03:34:57 -05:00
John C. Vernaleo
36d88d9ebc Fix a test output for go1.6. 2016-03-25 09:27:01 -04:00
Alex Yocom-Piatt
5f2e3d6f9c Fix filter_test TestFilterInsertP2PubKeyOnly with correct info 2016-03-22 15:53:50 -05:00
Alex Yocom-Piatt
9d5a582ca2 Update to all dcrutil tests so they successfully pass.
I have commented out 1 test in bloom/filter_test.go for
TestFilterInsertP2PubKeyOnly since we don't currently have
a good tx to test that with

Also commented out Hybrid and Uncompressed pubkey testing
since they are not working correctly with our structure.
ScriptAddresses aren't returning properly from them.
2016-03-22 14:51:52 -05:00
Dave Collins
ae78918521 bloom: Correct merkle block test error print.
The test would have erroneously printed the function address instead of
the received bytes if it failed.
2016-03-22 12:33:12 -05:00
Alex Yocom-Piatt
ae0e66b98e Revert sync commit 2016-03-09 15:18:18 +00:00
Alex Yocom-Piatt
88f3eef60e Sync with upstream 1c7f05922f
Conflicts:
	.travis.yml
	amount.go
	block.go
	bloom/merkleblock.go
2016-03-01 22:31:25 +00:00
Tadge Dryja
44e3030885 Fix range check in bloom filter false positive rate
Interpreting a 0 as the lower limit of 1e-9 seems more intuitive behavior when receiving an out-of-bounds argument.

davecgh's fixes to TestFilterFPRange
2016-02-26 22:20:35 -08:00
John C. Vernaleo
4b161c3870 Initial Decred Commit.
Includes work by cjepson, ay-p, and jcv.
2016-02-07 13:54:36 -05:00
Dave Collins
e8bab6bc19 docs: Make various README.md files consistent.
First, it removes the documentation section from all the README.md files
and instead puts a web-based godoc badge and link at the top with the
other badges. This is being done since the local godoc tool no longer
ships with Go by default, so the instructions no longer work without
first installing godoc. Due to this, pretty much everyone uses the
web-based godoc these days anyways. Anyone who has manually installed
godoc won't need instructions.

Second, it makes sure the ISC license badge is at the top with the other
badges and removes the textual reference in the overview section.

Third, it's modifies the Installation section to Installation and
Updating and adds a -u to the go get command since it works for both and
thus is simpler.

Finally, it replaces the badges with SVG versions from shields.io so
they are consistent.
2015-10-23 17:17:38 -05:00
Dave Collins
d39a255dbc Return matched tx indices from NewMerkleBlock.
This commit modifies the NewMerkleBlock function to return the matched
transaction indices instead of their hashes.  This is being done because
it is much easier for the caller to lookup the matched transactions from
the original passed block based on their transaction index within the
block versus their hashes.
2015-07-28 04:02:49 -05:00
Dave Collins
1b73e9828d Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
Dave Collins
80b97479bd Update btcwire path import paths to new location. 2015-02-05 14:48:38 -06:00
Dave Collins
d71631b41f Update btcchain import paths to new location. 2015-01-30 16:15:57 -06:00
Dave Collins
b29aad9f09 Update btcscript import paths to new location. 2015-01-30 12:11:32 -06:00
Dave Collins
9dcef5b30f Update btcscript import paths to new location. 2015-01-16 19:35:54 -06:00
Dave Collins
b2c2b14526 Update btcchain import paths to new location. 2015-01-16 18:45:21 -06:00
Dave Collins
fdc00f8eff Update btcwire import paths to new location. 2015-01-16 15:26:50 -06:00
Dave Collins
f80c4d718d Update btcutil import paths in README.md files. 2015-01-15 21:35:29 -06:00
Dave Collins
506d333934 Update btcutil import paths to new location. 2015-01-15 15:13:38 -06:00
Jonathan Gillham
a5298a643e Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:54:42 +01:00
Josh Rickmar
d4a2dd199b Update test coverage report. 2014-09-01 21:16:08 -05:00
Josh Rickmar
3fd010412c Remove embedded bloom.Filter mutex.
This prevents the caller from being able to accidentally lock or
unlock access to the filter internal state.

While here, remove several defers that do not gain us any readability,
and only hurt our performance.
2014-09-01 21:16:08 -05:00
David Hill
24a92fd581 Add bloom filter Reload method. 2014-08-29 22:45:35 -04:00
David Hill
00f245b959 Fix formatting directives in tests.
Found by 'go vet'
2014-08-28 10:32:49 -04:00
David Hill
4a3482182f update comment. 2014-07-10 11:10:44 -04:00
Dave Collins
6de97e738d Add TravisCI build status badge to subpackages. 2014-07-09 20:47:32 -05:00
Dave Collins
17dc3fb3b6 Really add READEME.md for bloom package. 2014-07-09 20:43:24 -05:00
Dave Collins
c78a40ab21 Add READEME.md for bloom package. 2014-07-09 20:41:22 -05:00
Dave Collins
1caa150b5c Add a testable example.
This commit creates and an example test file that 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.
2014-07-09 20:25:28 -05:00
Dave Collins
bde2b44320 Add license header to all bloom package files. 2014-07-09 20:01:45 -05:00
Dave Collins
ad004c0534 Cleanup and finish BIP0037 bloom filter API.
This commit finishes the work started by @dajohi on bloom filters.

- Rename the package from bloomfilter to bloom
- Rename New function to NewFiler
- Rename Load function to LoadFilter
- Rename BloomFilter type to Filter
- Rename Contains to Matches
- Correct tx match handling to match all inputs and outputs instead of
  only the first one
- Optimize murmur hash function by using constants
- Optimize the merkle block creation and reduce num of memory allocations
  required
- Make MsgFilterLoad concurrent safe as intended
- Update various code consistency issues
- Add a lot of comments
- Improve tests
- Make the code golint clean
2014-07-09 13:28:58 -05:00