Commit graph

299 commits

Author SHA1 Message Date
Mawuli Adzoe
03f6069579 Update docs for NewAmount
- Documentation update to NewAmount.
  Call out the fact it's specifically for converting BTC to Satoshi.
  The caller should perform a simple type cast to an Amount when dealing
  with int64 values which denote a quantity of Satoshi.
2015-08-12 07:01:50 +00:00
Dave Collins
1c7f05922f Convert block heights to int32.
This commit converts all block height references to int32 instead of
int64.  The current target block production rate is 10 mins per block
which means it will take roughly 40,800 years to reach the maximum
height an int32 affords.  Even if the target rate were lowered to one
block per minute, it would still take roughly another 4,080 years to
reach the maximum.

In the mean time, there is no reason to use a larger type which results
in higher memory usage.
2015-08-07 22:30:27 -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
f3db5cf7e5 Use container-based builds on TravisCI.
Also, import the goclean.sh script directly into this repository and
call it directly instead of using a remote gist.
2015-07-28 03:45:19 -05:00
Mawuli Adzoe
deba3d6436 Fix tiny typo in docs. 2015-07-24 06:59:43 +00:00
Mawuli Adzoe
ee7c40a181 Add testable example for UnitConversions
Fix imports, fix output pretty print

Use btcutil.Amount() instead of btcutil.NewAmount()

Trim off unnecessary .String()

Testable example for Amount

Improve example for btcutil.Amount
2015-07-22 21:20:10 +00:00
Mawuli Adzoe
7501aee141 Improve godocs. Add testable example for NewAmount
This is consistent with the rest of the code base.
i.e.: base58/bloom/hash160/hdkeychain.
2015-07-21 03:50:16 +00:00
Mawuli Adzoe
3c3f9360f4 Fix tiny typo
I think the intent is: https://en.wiktionary.org/wiki/producible
2015-07-20 11:20:46 +00:00
Josh Rickmar
9ffb1ecd80 Add Common Name to certificate.
Some applications fail to parse the certificate if the CN is not set,
even if they (correctly) check SANs before the CN when validating a
hostname.  Even though the CN should be ignored if a matching SAN
hostname was found, we can prevent the parse from failing by also
including the hostname as the CN.

Additionally, switch from maps to slices to prevent DNS names and IP
addresses from being reordered when added to the certificate template.
2015-06-15 16:14:08 -04:00
Josh Rickmar
53b0b8cd09 Fix typo in test. 2015-06-11 16:39:44 -04:00
Dave Collins
1b73e9828d Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
Dave Collins
9556412b01 Update for recent wire API hash error changes. 2015-04-17 01:13:40 -05:00
Dave Collins
e330838900 Remove error return from Block.Sha function.
This commit remove the error return from the Block.Sha function since it
can never fail and ends up causing a lot of unneeded error checking
throughout the code base.
2015-04-17 00:42:08 -05:00
Dave Collins
ff58d6571d Update golang.org/x/crypto import paths to new location. 2015-03-03 21:09:03 -06:00
Dave Collins
499e9e0daa Update btcec path import paths to new location. 2015-02-06 10:35:18 -06:00
Dave Collins
1324fa1fad Update btcnet path import paths to new location. 2015-02-05 23:30:03 -06:00
Josh Rickmar
56fe089f4e Update Go versions for Travis. 2015-02-05 17:56:03 -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
Josh Rickmar
dca623d4ef Optimize base58 decoding.
This change introduces an autogenerated base58 digit table to remove
the need to find the index of a character in the modified base58
alphabet each time.  Additionally, it removes some unnecessary big
integer allocations to cut down on the GC churn.

Before:
BenchmarkBase58Encode         20          64998995 ns/op           0.08 MB/s
BenchmarkBase58Decode         50          35965928 ns/op           0.19 MB/s

Now:
BenchmarkBase58Encode         20          64644351 ns/op           0.08 MB/s
BenchmarkBase58Decode        200           7914748 ns/op           0.86 MB/s
2015-01-24 14:59:51 -05: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
9e2037d6db Update btcec import paths to new location. 2015-01-16 18:04:23 -06:00
Dave Collins
7ac9b42a52 Update btcnet import paths to new location. 2015-01-16 17:36:18 -06:00
Dave Collins
fdc00f8eff Update btcwire import paths to new location. 2015-01-16 15:26:50 -06:00
Dave Collins
5dada8b184 Update fastsha256 import paths to new location. 2015-01-16 09:20:22 -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
Josh Rickmar
40ba1daf69 Add Amount.ToBTC convenience method.
Closes #26.
2015-01-02 09:19:16 -05:00
Dave Collins
8180321217 Add quick overview about addresses to doc.go.
Closes #4.
2014-12-22 13:39:51 -06:00
Dave Collins
97fea16721 Add package documentation for base58 package.
This commit adds a doc.go file in the base58 package which provides
package documentation for godoc.
2014-12-22 12:36:34 -06:00
Dave Collins
ff8cbd1786 Add testable examples for base58 package.
This commit creates and an example test file for the baes58 package 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-12-22 11:58:06 -06:00
Dave Collins
cef307c87e Complete base58 migration to new package. 2014-12-22 10:56:00 -06:00
Dave Collins
fffd6a2e87 Add benchmarks to base58 package. 2014-12-22 10:45:21 -06:00
Dave Collins
a630ef8247 A few minor modifications to new base58 package.
- Call out in README.md that this is modified base58 (it's not the same as
  normal base58)
- Remove the blurb about test_coverage.txt since it is no longer needed
  now that the repo now has coveralls integrated
- Rename base58_check[_test].go -> basecheck[_test].go.  Since Go treats
  _<ext> special in some cases like for tests and conditional OS and
  architecture compilation, it's a good idea to avoid naming files with
  them to ensure a new special meaning doesn't break builds in the future
2014-12-22 10:29:07 -06:00
benma
07db1b5a70 Integrate the new base58 package. 2014-12-22 12:01:50 +01:00
benma
a72a54be16 Create a new sub-package base58.
It consists of the previous base58 implementation and new
base58 check encoding/decoding functions.
2014-12-22 11:43:07 +01:00
Dave Collins
a3d5cbad22 Add basic tests for NewTLSCertPair. 2014-12-20 15:30:08 -06:00
Dave Collins
5509c323a4 Add test coverage badge to README.md. 2014-12-20 05:19:47 -06:00
Dave Collins
cd83976947 Update TravisCI to use goclean script. 2014-12-20 05:01:59 -06:00
David Hill
c64741f903 Add PEM encode error checking 2014-12-13 10:29:36 -05:00
Josh Rickmar
f9cc0f47b4 Switch to new subrepo import paths. 2014-12-11 10:28:43 -05:00
Jonathan Gillham
a5298a643e Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:54:42 +01:00
Dave Collins
ea27722dac Export the hdkeychain min and max seed byte lens. 2014-09-25 22:13:42 -05:00
Dave Collins
2539ca9860 Fix hdkeychain to avoid zeroing net version bytes.
This commit corrects the Zero function in hdkeychain to nil the version
instead of zeroing the bytes.  This is necessary because the keys are
holding onto a reference into the specific version bytes for the network
as provided by the btcnet package.  Zeroing them causes the bytes in the
btcnet package to be zeroed which then leads to issues later when trying
to use them.

Also, to prevent regressions, new tests have been added to exercise this
scenario.

Pointed out by @jimmysong.
2014-09-08 14:30:56 -05: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
Jonathan Gillham
47c887338f Made App Engine runtime compatible. 2014-08-30 15:10:29 -05:00
David Hill
24a92fd581 Add bloom filter Reload method. 2014-08-29 22:45:35 -04:00