Commit graph

314 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
e14ee486e6 gcs: fix constant overflow for 32-bit systems 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
18097a52c4 gcs: explicitly optimize inner loop of gcs filter computation 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
c26776fe48 gcs: add an extra benchmark for a filter with 100k items 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
e87fef40f3 gcs: ensure benchmarks aren't optimized away by the compiler
This commit modifies the benchmarks a bit to ensure that the
computations themselves aren’t optimized away. We do this by binding
each variable to a local variable, and them ultimately a variable at
the package level scope.
2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
5a770ec85e gcs/builder: an empty filter has a zero-hash 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
65172ea539 gcs/builder: ignore scripts with no data pushes 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
b3d8578868 gcs: add witness stack items to filter, update tests 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
c01c00e8b4 gcs: check to see if sigScript exists before adding it 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
0830c7046f gcs: fix slight typo in docs, 2^-n not 2^-1 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
c59d7e8fba gcs: pre-allocate capacity of slice for uncompressed filter values
This change will reduce the total number of allocations required to
create/store the allocated filter as we’ll now perform a _single_
allocation, rather than one each time the the dynamically size slice
reaches capacity.
2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
0f2eb80fdb gcs: add some line spacing, wrap comments to 80 characters 2018-05-15 19:14:18 -07:00
Alex
e3c79234e6 gcs/builder: Add pre-BIP block filter and header calculations. 2018-05-15 19:14:18 -07:00
Alex
f74edf2c4d gcs: allow optional de/serialization of N and P parameters 2018-05-15 19:14:18 -07:00
Alex
ca65f28ca1 Ignore error from txscript.PushedData 2018-05-15 19:14:18 -07:00
Alex
12e95e2790 gcs: improve test coverage for builder 2018-05-15 19:14:18 -07:00
Alex
197462ade8 README.md fixes 2018-05-15 19:14:18 -07:00
Alex
856e3a320d Change OutPoint index encoding to little-endian to match Bitcoin 2018-05-15 19:14:18 -07:00
Alex
119a03a3ca Add comment to DefaultP to fix lint issue with exported constant. 2018-05-15 19:14:18 -07:00
Alex
6654eb61e4 Add filter builder and some tests 2018-05-15 19:14:18 -07:00
Alex
53c8e22157 Change tests to use gcs.Filter instead of custom interface 2018-05-15 19:14:18 -07:00
Alex
b21739c0e2 Fix issues found by golint without changing API. 2018-05-15 19:14:18 -07:00
Alex
684cf07725 Rename gcsFilter type to GCSFilter to export it. 2018-05-15 19:14:18 -07:00
Alex
3069dcf175 gcs: add package for building and using Golomb-coded set filters 2018-05-15 19:14:18 -07:00
Olaoluwa Osuntokun
06f32abe07
hdkeychain: address go vet warnings 2018-05-14 19:59:48 -07:00
Olaoluwa Osuntokun
a5016344ef
bloom: update due to latest wire updates 2018-05-14 19:59:31 -07:00
Olaoluwa Osuntokun
672f737332
build: use go 1.9.4 and 1.10 for travis builds 2018-05-14 19:51:39 -07:00
Olaoluwa Osuntokun
501929d3d0
add cached version of HasWitness 2017-07-26 11:36:19 -07:00
Olaoluwa Osuntokun
9c01665307
add new WitnessHash method to Tx
This commit adds a new method to btcutil.Tx which implements a memoized
equivalent to the `Hash` method but for the newly defined `wtxid.
2017-07-26 11:36:13 -07:00
Olaoluwa Osuntokun
6950f39a70
add new BytesNoWitness method to Block
This commit adds a new method to btcutil.Block for obtaining the
serialization of a Block *without* any witness data (if any).
2017-07-26 11:36:09 -07:00
Johan T. Halseth
fd898ec77a bech32 encoded segwit addresses.
This commit adds support for bech32 encoded segwit
addresses, namely AddressWitnessPubKeyHash and
AddressWitnessScriptHash. These are both specified
in BIP 173.
2017-07-25 22:14:01 -05:00
Johan T. Halseth
38c25ef9cd bech32: Add bech32 encoding package.
The bech32 format is used to encode base32 data
in a string format specified in BIP 173. This is
among other things used to encode native segwit
addresses, also specified in the same BIP.

This commit adds the package bech32, which
contains the necessary utility methods to create
bech32 encoded strings from arbitrary data.
2017-07-25 22:14:01 -05:00
Thomas Kerin
5ffa719c38
Expose hdkeychain.Depth() - returning number of derivations since the root 2017-06-12 02:02:13 +02:00
Chris Pacia
61ec18f9c8 Export NewExtendedKey
Allow users to create custom ExtendedKeys by exporting the newExtendedKey function.
The comment is updated to reflect that this function is only intended to be used
by custom applications.
2017-06-05 14:41:43 -04:00
Dave Collins
fac8a9a582
multi: Update markdown files for GFM changes.
The github markdown interpreter has been changed such that it no longer
allows spaces in between the brackets and parenthesis of links.  This
updates all of the markdown files accordingly.

While here, it also corrects a couple of inconsistencies in regards to
other README.md files in the project.
2017-05-25 13:01:10 -05:00
Dave Collins
66871daeb1 hdkeychain: Add new test vector 3 tests.
This adds the new test vectors added to BIP32 on 2017-02-24 which test
hardened derivation with leading zeros.
2017-05-10 00:19:46 -05:00
Dave Collins
1fb0120cc6
hdkeychain: Consolidate tests into package.
Putting the test code in the same package makes it easier for forks
since they don't have to change the import paths as much.

Also, address a few style and consistent nits while here:
- Prefer t.Fatalf over t.Errorf followed by a return
- Use the consistent style of starting a test function comments with the
  test name
- Prefix test errors by the function being called instead of the one
  doing the calling since the caller itself is already logged by the
  test framework
- Check err in max depth test before checking the returned key is nil
2017-05-09 12:09:02 -05:00
Thomas Kerin
4f8b4dbcb2 hdkeychain: BIP32 maximum depth is 255.
BIP32 keys serialize the depth as a uint8 over the wire. I noticed
uint16 was being used and that the depth was being taken modulo 256
during serialization.

This seems like a bug, as the behaviour is not described in the BIP,
and also introduces incompatibilities which can be hard to make sense
of. For example, the parent fingerprint should be 0x00000000 for a key
of depth zero, whereas with the existing code if depth=256, then the
serialization will set 0 but still set a parent fingerprint.
2017-05-09 11:40:57 -05:00
David Hill
dcd4997b06 Switch to upstream golang.org/x/crypto 2017-05-08 23:05:27 -05:00
David Hill
a5ecb5d954 travis: +go 1.8.x -go 1.6.x (#94) 2017-04-19 10:14:49 -04:00
David Hill
86346b5a95 build: Add gosimple linter to goclean.sh 2017-01-11 15:38:44 -05:00
David Hill
bca6409ade Drop fastsha256 in favor of crypto/sha256 2017-01-10 17:09:00 -05:00
John C. Vernaleo
96e858f48e Remove -v from go test.
This caused unhelpful clutter in travis output.

Closes #89
2016-12-07 10:12:35 -05:00
David Hill
2d8020d311 build: Add unconvert linter to goclean.sh 2016-12-01 18:02:50 -05:00
John C. Vernaleo
1425c4327e Modify goclean to use gometalint like btcd 2016-12-01 11:23:38 -06:00
Dave Collins
183acb4ad9
Correct LICENSE to the btcsuite developers.
This appears to have been missed during the relicense
2016-11-16 15:37:28 -06:00
David Hill
f6a0d000db Reduce allocs in Block.Bytes() 2016-11-16 12:40:24 -05:00
Dave Collins
9b9ce80a2e coinset: Add missing import in wire. 2016-10-27 15:27:44 -05:00
Dave Collins
aa9087a7ef
coinset: Update for wire.NewMsgTx API change. 2016-10-26 22:49:46 -05:00
David Hill
68e5965458 Update travis to test against golang 1.7 (#80) 2016-08-17 13:13:29 -05:00
Waldir Pimenta
6906ba090e add license title (#79)
background: https://github.com/btcsuite/btcd/pull/717
2016-08-11 20:46:26 -05:00