Commit graph

1599 commits

Author SHA1 Message Date
Dave Collins
4b727d2035 Ignore error in script disassembly for RPC results.
This commit modifies the creation of RPC results to ignore errors in
script disassembly since they already contain the error string inline and
the RPC results must still be generated regardless.

This was already done in the decodescript RPC, however the same thing was
not being done in the higher level verbose transaction results.  This
applies to both the createrawtransaction and decoderawtransaction RPCs.

Also, since this was the only thing that could error within those
functions, the error returns and caller checking of now non-existent
errors have been removed.

Fixes #210.
2015-01-07 16:23:23 -06:00
Josh Rickmar
8945620a84 Improve double spend error strings.
The error message now includes both the previous tx hash and output
index, rather than simply the transaction with the already spent
output.
2015-01-06 20:11:42 -05:00
Josh Rickmar
0d01bb9cb9 Optimize NewShaHashFromStr. 2015-01-06 20:04:33 -05:00
Josh Rickmar
a9e05a3030 Implement String for OutPoint. 2015-01-05 18:40:32 -05:00
Josh Rickmar
df3469a792 Improve ShaHash.String comment and implementation.
The hash is not displayed big endian, but rather as a byte-reversed
hash as a hexidecimal string, so document it as such.

While here, speed up the function.  Some benchmarks:

BenchmarkShaHashString   2000000               996 ns/op
BenchmarkShaHashStringOld         100000             22701 ns/op
2015-01-05 17:18:25 -05:00
David Hill
e5a825324c Limit the number of addresses announced.
Additionally, add the addresses being sent to the peer
to the known addresses map.
2015-01-02 13:04:28 -05:00
Dave Collins
04d47de262 Allow disabling RPC server TLS for localhost only.
This commit introduces a new flag, --notls, which can be used to disable
TLS for the RPC server.  However, the flag can only be used when the RPC
server is bound to localhost interfaces.  This is intended to prevent the
situation where someone decides they want to expose the RPC server to the
web for remote management/access, but forgot they have TLS disabled.
2015-01-02 11:17:23 -06:00
Beldur
e0fce5fe50 Fixed DeletePortMapping documentation typo 2015-01-01 21:59:57 +01:00
Ben Holden-Crowther
08257ac529 Updated license date
Changed 2014 to 2015 in preparation for new year
2014-12-29 20:46:11 +00:00
Dave Collins
a680fb6f25 Update badges in README.md to SVG.
Also add a license badge while here.
2014-12-22 23:13:10 -06:00
Dave Collins
90e8b84c8b Update TravisCI to goclean script.
- Also update to use the new container-based builds
- Modify the tests slightly to make golint happy
2014-12-22 23:10:16 -06:00
Dave Collins
b2186ae5ec Update README.md. 2014-12-22 22:50:17 -06:00
Dave Collins
f1f12a3f2f Update all badges in README.md to SVG.
Also, add a license badge.
2014-12-22 22:46:39 -06:00
Dave Collins
e49bf14993 Update build status badge in README.md to SVG. 2014-12-22 20:23:42 -06:00
Dave Collins
e6fe5877c4 Add test coverage badge to README.md.
Also, remove the test_coverage.txt file since coverage is now reported by
coveralls.io.
2014-12-22 20:14:22 -06:00
Dave Collins
9c8ee93b5c Update TravisCI to goclean script.
Also, correct a couple of issues found by running the script.
2014-12-22 20:05:11 -06:00
Dave Collins
33546047e3 Use correct error name in handleGetRawTransaction.
This commit corrects the error check from the createTxRawResult call in
handleGetRawTransaction.  It was previously given a different name which
resulted in the wrong error being checked.

Fixes #196.
2014-12-21 21:49:21 -06:00
Dave Collins
f1cbd40713 Improve handling of the home directory creation.
This commit improves a couple of issues surrounding the creation of the
btcd home directory.

First, the code was previously attempting to log any errors that occurred
while creating the directory using the logging system which is not
initialized at that point.  Thus, nothing was displayed to the user.

Second, if any component of btcd home directory path already exists, but
is not a directory, such as in the case of symlinks, the error returned
from the os.MkDirAll call indicates the directory can't be created.  While
this is true, it's not always the most helpful error to display to the
user.  So, this commit adds logic to detect when the failure case is due
to an existing symlink and displays a nicer error message suggesting the
user check if the destination of the link is mounted.

Fixes #193.
2014-12-21 17:01:56 -06:00
Dave Collins
8e1973d865 Correct a couple of typos spotted while reviewing. 2014-12-20 01:55:27 -06:00
Guilherme Salgado
2f902a5880 Rename signTxOutput to RawTxInSignature 2014-12-20 01:51:54 -06:00
David Hill
45e7fe103f Sync TX tests with Bitcoin Core. 2014-12-19 15:20:48 -05:00
David Hill
bc46f8273c Add more reserved IP space to address manager. 2014-12-16 13:02:39 -05:00
Josh Rickmar
1d0c09a852 Require TLS 1.2 minimum.
This prevents a downgrade attack to the vulnerable SSLv3.  While here,
go ahead and require at least TLS 1.2 since TLS 1.0 and 1.1 have their
own set of issues and it's only a matter of time before those would
need to be completely avoided as well.

ok @davecgh
2014-12-15 13:53:14 -05:00
Dave Collins
5a477c332b Update TravisCI for Go 1.4 release.
Now that Go 1.4 has been released, this commit reverts the recent changes
which dealt with allowing TravisCI to work with go tip in between the Go
1.3 and Go 1.4 release cycle and updates the .travis.yml to invoke test
coverage tool from the new path in Go 1.4.
2014-12-11 10:43:17 -06:00
Josh Rickmar
1c4ac4426c Switch to new subrepo import paths. 2014-12-11 10:33:05 -05:00
Josh Rickmar
bca3d5ba7b Switch to new subrepo import paths. 2014-12-11 10:31:17 -05:00
David Hill
def35f2cd4 Sync Bitcoin Core tests. 2014-12-08 17:34:03 -05:00
Dave Collins
9c0db2f7fd Ensure all tickers are explicitly stopped.
As pointed out in #189, according to the Go documentation, a ticker must
be stopped to release associated resources.  This commit adds a defer call
to stop two tickers there were previously not being stopped as well as
changes two others that were being stopped over to use defer so it's more
consistent.

The other ticker in ScheduleShutdown is replaced and already calls Stop
before replacing it, so it has not been modified.

Closes #189.

ok @jrick
2014-12-03 18:43:31 -06:00
Dave Collins
888884a399 Use .haveTransaction in new getmempool RPC code.
The mempool is already locked and the exported version locks it, so the
unexported version is needed.
2014-11-17 15:46:42 -06:00
Dave Collins
1973aa5fd5 A few nitpicks with recent getrawmempool updates.
This commit addresses a few nitpicks in the recent getrawmppol update
which populates the starting and current priority fields.

In particular:

- Move the new calcInputValueAge function before the function which
  invokes it so it is consistent with the rest of the mempool code
- Double space after periods for consistency
- Correct the comments for calcInputValueAge to indiciate that inputs
  which are in the the memory pool count as zero toward the value age
  rather than the incorrect claim that that the overal input value age is
  zero when one of them does
- Rename endingPriority to currentPriority to match the RPC field and its
  actual function
- Make the comment about using zero when input transactions can't be found
  for some reason more accurate since there can be (and frequently is)
  more than one input transaction
2014-11-17 00:31:14 -06:00
Olaoluwa Osuntokun
a49b0d05b3 Add the starting+current priority to getrawmempool. 2014-11-16 23:58:33 -06:00
Dave Collins
7a1a260b78 Update TravisCI to work with go tip.
This commit modifies the .travis.yml to invoke a new script which has also
been added that gets the test coverage tool from the new path needed by go
tip.
2014-11-14 21:20:44 -06:00
Dave Collins
4b6cd17561 Make RandomUint64 block until entropy is available.
This commit modifies the RandomUint64 function so that rather than
returning an io.ErrShortBuffer when the system does not have enough
entropy available, it now blocks until it does have enough.  This means
that RandomUint64 will now always eventually succeed unless the entropy
source is closed (which only really ever happens when the operating system
is shutting down).

The tests have also been updated for the change in semantics to maintain
100% coverage.

Closes #23.
2014-11-14 12:17:18 -06:00
Dave Collins
c36b00c078 Add space in handleHeadersMessage log message. 2014-11-14 11:04:34 -06:00
Jonathan Gillham
a61c0f06cf Removed unnecessary signTxOutputCustomReader. 2014-10-13 13:47:44 +01:00
Jimmy Song
d5cc72dc27 use btcec structs instead of ecdsa structs 2014-10-12 23:47:09 -05:00
Dave Collins
ce0a334329 Comment ScriptInfo struct according to standards.
Found by golint.
2014-10-12 19:39:01 -05:00
Dave Collins
c0c3d860d6 Convert all StackErrX to ErrStackX.
This commit changes all stack errors from the form of StackErrX to
ErrStackX which is the expected form for standard Go code.
2014-10-12 17:24:00 -05:00
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