Commit graph

2070 commits

Author SHA1 Message Date
Dave Collins
6af9302374 More false positive prevention in new time tests.
This commit extends the same logic in the previous commit to the
comparison of offsets returned from the median time source in the tests.

In particular it modifies the tests to allow for the offsets to differ by
a second due to a boundary condition to prevent false positives.
2014-10-11 18:06:41 -05:00
Jonathan Gillham
37ad7042b6 Made hashType typed as SigHashType. 2014-10-11 20:55:28 +01:00
Dave Collins
b4c55aee28 Update new time tests to prevent false positives.
The new median time tests perform a comparsion of the adjusted time
returned from the median time source to the expected value.  However,
since time is always moving, it is possible the current time between the
call to the adjusted time function and the current time taken in the tests
for comparison just after the call differ by a second due to a boundary
condition.  So, this commit modifies the tests to allow for this
condition.
2014-10-11 14:53:27 -05:00
Dave Collins
e1c622c4cf Modify the time sorter tests to make golint happy.
This commit changes the internal testing mechanism from returning the
unexported timeSorter type directly to insted returning sort.Interface.
This has been done because the latest version of golint complains about
return unexported types.
2014-10-11 13:30:08 -05:00
Dave Collins
d078deb4a7 Update addblock util for recent chain API changes. 2014-10-11 13:16:32 -05:00
Jonathan Gillham
9f47e9369c Fixed SignTxOutput doc spelling error. 2014-10-10 20:17:20 -05:00
Dave Collins
208d4d79d7 Add 100% test coverage for new median time code. 2014-10-10 01:23:39 -05:00
Dave Collins
df065eee19 Provide a new median time source API.
This commit provides a new interface, MedianTimeSource, along with a
concrete implementation which allows improved accuracy of time by making
use of the median network time as calculated from multiple time samples.

The time samples are to be provided by callers and are intended to come
from remote clients.

The calculations performed in this implementation exactly mirror those in
Bitcoin Core because time calculations are part of the consensus rules and
hence need to match exactly.
2014-10-10 01:12:39 -05:00
Dave Collins
c3065d32f4 Make use of the new btcchain MedianTimeSource.
This commit uses the new MedianTimeSource API in btcchain to create a
median time source which is stored in the server and is fed time samples
from all remote nodes that are connected.  It also modifies all call sites
which now require the the time source to pass it in.
2014-10-09 10:44:22 -05:00
kac-
b89cabfb29 comment:script.go: ScriptDB->KeyDB 2014-10-05 10:19:29 +02:00
Jonathan Gillham
a0fe3822fc Fixed minTxInPayload documentation. 2014-10-01 18:14:42 +01:00
Jonathan Gillham
1bbd1e9cba Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 16:34:30 +01:00
Jonathan Gillham
edb006c11c Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:57:27 +01:00
Jonathan Gillham
f60e503308 Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:53:47 +01:00
Jonathan Gillham
968b6da5db Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:52:19 +01:00
Jonathan Gillham
3eeb51ab54 Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:48:07 +01:00
Jonathan Gillham
ccee51a0be Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint for consistency. 2014-10-01 13:43:37 +01:00
Jimmy Song
d312d47298 RecoverCompact and SignCompact now use the btcec.PrivateKey and btcec.PublicKey types.
btcwallet/rpcserver.go needs a corresponding change or else that will break.

This closes #6
2014-09-27 13:37:27 -05:00
Jimmy Song
d69442834c Optimize ScalarBaseMult
Code uses a windowing/precomputing strategy to minimize ECC math.
Every 8-bit window of the 256 bits that compose a possible scalar multiple has a complete map that's pre-computed.
The precomputed data is in secp256k1.go and the generator for that file is in gensecp256k1.go

Also fixed a spelling error in a benchmark test.

Results so far seem to indicate the time taken is about 35% of what it was before.

Closes #2
2014-09-24 19:07:58 -05:00
Dave Collins
a5b1a31e07 Use the net package function for credentials.
This change ensures any usernames or passwords which contain symbols that
would confuse the URL parser are properly escaped.
2014-09-20 19:05:38 -05:00
Dave Collins
02647404fa Prepare for release 0.9.0. 2014-09-20 13:00:02 -05:00
Dave Collins
8733b9c8df Bump default user agent to 0.2.0. 2014-09-20 12:45:18 -05:00
Dave Collins
2a688a70b2 Update ldb tests for latest API error changes. 2014-09-20 00:47:20 -05:00
David Hill
4ad8622af9 Remove transactions from orphan pool.
This change removes transactions from a newly connected block
from the orphan pool if they exist.  Additionally, any orphan
transactions that are no longer orphan transactions are moved
to the mempool and inv'd to the currently connected peers.
2014-09-19 22:58:06 -05:00
Dave Collins
3bbe8ff0ca Add checkpoint at block height 319400. 2014-09-18 19:04:01 -05:00
Dave Collins
7452e51976 Update sample config file.
This commit adds a couple of options which were not details in the sample
config file.  It also fixes a couple of typos and makes the example default
maxpeers setting in the config file match the actual default used in btcd.
2014-09-18 15:28:39 -05:00
David Hill
efcf90d83d Use Warnf when processing directives. 2014-09-17 09:37:37 -04:00
John C. Vernaleo
d6945f94e6 Fix tests. 2014-09-16 15:13:31 -04:00
John C. Vernaleo
2480cb3a87 Match error names to btcdb updates. 2014-09-16 15:09:32 -04:00
John C. Vernaleo
f5f03e8172 Match error names to btcdb updates. 2014-09-16 15:08:53 -04:00
John C. Vernaleo
a7ac93f5b6 Error improvements for lint.
Rename errors to Err*.
Lowercase error text.

Add golint for top level package

ok @davecgh
2014-09-16 15:07:11 -04:00
Javed Khan
1caddd4a37 handle http errors
ok @jrick, @jcvernaleo
2014-09-16 12:45:47 -04:00
John C. Vernaleo
372bbe5c49 Add vet and lint where possible to travis. 2014-09-16 11:31:51 -04:00
John C. Vernaleo
68d10f4dc8 Add some missing comments.
ok @davecgh
2014-09-16 11:23:49 -04:00
Josh Rickmar
26802c7ecc Fix JSONGetMethod to prevent panics on bad input.
ok @jcvernaleo
2014-09-16 10:13:07 -05:00
John C. Vernaleo
351a2a5f5e Add vet, lint, and 1.2 builds to travis. 2014-09-16 08:21:34 -04:00
John C. Vernaleo
3e465b2012 Remove extra go vet 2014-09-16 08:14:49 -04:00
John C. Vernaleo
036daa5817 Bring .travis.yml in line with others.
Add tip too.
2014-09-16 08:02:03 -04:00
John C. Vernaleo
8e96f2cf55 Add go vet back and cleanup travis file. 2014-09-12 15:11:48 -04:00
Dave Collins
41c981348e Use byte literals to make go vet happy.
The go vet command complains about untagged struct initializers when
defining a ShaHash directly.  This seems to be a limitation where go vet
does not exclude the warning for types which are a constant size byte
array like it does for normal constant size byte array definition.

This commit simply modifies the code to use a constant definition cast to
a ShaHash to overcome the limitation of go vet.
2014-09-12 14:04:55 -05:00
Josh Rickmar
0127b3aafe Make ErrHashStrSize slightly more descriptive.
Add the word 'string' to the error string so if this is printed, it
will be clearer that it was a hash string decode that failed (as
opposed to other errors creating a ShaHash from a byte slice) and
change 'chars' to 'bytes', since the string length is measured in
bytes, not UTF-8 code points.

ok @davecgh
2014-09-12 08:44:15 -05:00
David Hill
41fbb87c86 Reject transactions with too many signature operations.
This matches recent changes in bitcoin core.
2014-09-10 19:28:03 -05:00
Olaoluwa Osuntokun
b97083f882 Fix some typos throughout repo. 2014-09-08 14:54:52 -05:00
Josh Rickmar
790f652d06 btcctl: Fix createrawtransaction amounts.
These were being counted in satoshis, when the JSON object should be
containing JSON numbers, counted in BTC.
2014-09-08 11:57:57 -05:00
John C. Vernaleo
0631a00d91 Hold off on go vet for now. 2014-09-08 09:16:09 -04:00
John C. Vernaleo
ecacc006cd Add go vet and golint to TravisCI. 2014-09-08 09:08:19 -04:00
John C. Vernaleo
4bc2c7f04f Slight siplification in .travis.yml 2014-09-08 08:41:26 -04:00
John C. Vernaleo
8f4643df14 Add go vet and golint to travis-ci config.
For golint, min_confidence is set to 0.9 since things aren't totally
golint clean yet.
2014-09-08 08:29:06 -04:00
Dave Collins
225248d283 Use byte literals in tests to make go vet happy.
The go vet command complains about untagged struct initializers when
defining a ShaHash directly.  This seems to be a limitation where go vet
does not exclude the warning for types which are a constant size byte array
like it does for normal constant size byte array definition.

This commit simply modifies the tests to use a constant definition cast to a
ShaHash to overcome the limitation of go vet.
2014-09-05 13:58:40 -05:00
John C. Vernaleo
c630b6ca1f Minor golint cleanups. 2014-09-05 13:45:01 -04:00