* Previously both searchrawtransaction and getrawtransaction would omit
the 'Confirmations' field by default if the transaction was found in
the mempool.
* By removing `omitempty`, a mempool transaction will now have
'Confirmations:0'
The addition of the pre-computed values for the ScalarBaseMult
optimizations added a benign race condition since a pointer to each
pre-computed Jacobian point was being used in the call to addJacobian
instead of a local stack copy.
This resulted in the code which normalizes the field values to check for
further optimization conditions such as equal Z values to race against the
IsZero checks when multiple goroutines were performing EC operations since
they were all operating on the same point in memory.
In practice this was benign since the value was being replaced with the
same thing and thus it was the same before and after the race, but it's
never a good idea to have races.
The writeElement function provides faster serialization for primitives.
This commit modifies all instances that call writeElement with a
pointer to a primitive or a byte slice to instead use the primitive /
writeVarBytes function so the faster serialization paths are used.
The benchmarks are still only compiled when running 'go test' so this has
no effect on regular usage. This is being done because benchmarks often
need access to internal state.
Normal tests are kept in a separate package since they also serve to
exercise the public API, and by intentionally making it more difficult to
reach into the internals, it helps ensure the public API is sanely usable.
Since the benchmarks can now access the internals directly, this commit
also removes the functions which exposed the internals to the test package
from internal_test.go which were only used by the benchmarks.
The comment for the RPC listen section in the sample-btcd.conf incorrectly
claimed that the default for the RPC server listener is to listen on all
interfaces by default. In reality, it only listens on localhost for IPv4
and IPv6 by default.
Closes#208.
The mempool's MaybeAcceptTransaction methods have also been modified
to return a slice of transaction hashes referenced by the transaction
inputs which are unknown (totally spent or never seen). While this is
currently used to include the first hash in a ProcessTransaction error
message if inserting orphans is not allowed, it may also be used in
the future to request orphan transactions from peers.
This commit adds a test for checking known good block scripts in a block
are valid. As a part of this, it adds the infastructure needed to load a
saved transaction store from a file which contains all of the input
transactions needed.
It also contains some changes from running goimports as well as some other
cleanup.
This commit modifies the getblocktemplate RPC to correctly handle the
curtime field.
Currently, the RPC server will refuse to serve a block template if the
current time is before the minimum allowed time for a block even though
the real generated block template already accounted for it.
This consists of three changes:
- Remove the unnecessary and incorrect check in the RPC invocation for the
current time against the min required time since it is already handled
properly by the block template generation.
- Expose the network time source to the RPC work state and use the
adjusted time for checking against the maximum allowed time instead of
the current time.
- Set the returned RPC result curtime field to the time of the generated
block header.
Fixes#209.
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.