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.
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.
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.
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
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
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.
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
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.
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.
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
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.
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.
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.
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.
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