Commit graph

3510 commits

Author SHA1 Message Date
Dave Collins
fb8ab4200f Add more chain-related fields and checkpoints.
This commit adds more chain-related fields to the parameters as a part of
converting btcchain to work with btcnet parameters instead of coding the
network-specific knowledge into the package itself.

It also moves the checkpoints from btcchain since checkpoints are a
network parameter and make more sense here.

ok @jrick
2014-05-27 10:07:19 -05:00
Dave Collins
009c4bcd76 Update findcheckpoint utility to use btcnet. 2014-05-27 00:56:54 -05:00
Dave Collins
dd8265c22c Convert addblock utility to use btcnet. 2014-05-27 00:48:00 -05:00
Dave Collins
7b0116dfd0 Prepare for release 0.8.0. 2014-05-25 15:52:47 -05:00
Dave Collins
aa1d722dd6 Update pre-release and README.me to beta.
This is part of the changes for #130.
2014-05-23 15:51:45 -05:00
Dave Collins
d4082e4f24 Add checkpoint at block height 300255. 2014-05-23 13:44:23 -05:00
Dave Collins
6d8b873923 Raise maxStandardSigScriptSize to 1650.
This commit raises the maximum allowed size for a standard signature
script to cover a 15-of-15 multi-signature pay-to-script-hash with
compressed pubkeys.

This mirrors a recent change to remain compatible with Bitcoin Core.

ok @owinga who also helped verify and correct the script math.

Closes #128.
2014-05-23 12:23:36 -05:00
Josh Rickmar
bcc78565fd Initial pass at updating to btcnet.
This change modifies the params struct to embed a *btcnet.Params,
removing the old parameter fields that are handled by the btcnet
package.

Hardcoded network checks have also been removed in favor of modifying
behavior based on the current active net's parameters.

Not all library packages, notable btcutil and btcchain, have been
updated to use btcnet yet, but with this change, each package can be
updated one at a time since the active net's btcnet.Params are
available at each callsite.

ok @davecgh
2014-05-23 01:02:14 -05:00
Josh Rickmar
536c1e3c29 Add parameters used by btcd.
This change adds two parameters to the Params struct which are used by
btcd to alter behavior based on the active network, rather than
hardcoding checks for a particular network.

The first, ResetMinDifficulty, specifies whether the target difficulty
can change between the retarget intervals.

The second, RelayNonStdTxs, specifies whether standard transaction
checks should not be performed when accepting mempool transactions.

The zero values (false) for both of these bools are the correct
parameter values for mainnet.

While here, rename the test network version 3 to "testnet3", as both
btcd and btcwallet will include additional handling to rename this to
"testnet" for directory names, and a switch to "testnet3" is planned
in the future.
2014-05-23 00:55:21 -05:00
Dave Collins
342d0a536f Correct error message in handleGetWorkSubmission.
Found by go vet.
2014-05-22 23:48:02 -05:00
Dave Collins
b6af0a7a53 Remove extra return statement found by go vet.
The return statement was unreachable and thus this change has no
effect on functionality.
2014-05-22 23:46:41 -05:00
Josh Rickmar
55ef07ca61 Initial commit. 2014-05-22 13:08:32 -05:00
David Hill
0cdaefd4cc export HashMerkleBranches
ok @davecgh
2014-05-22 13:29:39 -04:00
Dave Collins
6af13826ae Convert {Dump,Import}PrivKey to use new WIF type.
The btcutil package recently exposed a WIF type to provide more
functionality and simplify working with WIF strings.  This commit changes
the DumpPrivKey and ImportPrivKey RPCs to use the new WIF type.
2014-05-21 20:00:11 -05:00
Dave Collins
9d9c343247 Make nil pointer handling consistent across RPCs.
There are several RPCs which accept a pointer to a hash, transaction,
block, etc.  Previously not all RPCs handled being passed a nil pointer
consistently.

Closes #4.
2014-05-21 19:53:46 -05:00
Dave Collins
57738b1920 gofmt 2014-05-21 19:24:45 -05:00
Josh Rickmar
cea5e44f2d Add Serialize method to PrivateKey.
ok @davecgh
2014-05-21 17:04:28 -05:00
Josh Rickmar
82e79619a5 Add missing redeemScript to ListUnspentResult.
ok @jcvernaleo
2014-05-21 16:08:19 -05:00
David Hill
27e1ad758b Add new function PushedData.
PushedData returns an array of byte slices containing any pushed data
found in the passed script.  This includes OP_0, but not OP_1 - OP_16.

help from and ok @owainga
2014-05-20 12:24:23 -04:00
Dave Collins
77c02f36ee Cleanup new code introduced by Pull Request #4.
- Keep comments to 80 cols for consistency with the rest of the code base
- Made verify a method off of Signature instead of PublicKey since one
  verifies a signature with a public key as opposed to the other way
  around
- Return new signature from Sign function directly rather than creating a
  local temporary variable
- Modify a couple of comments as recommended by @owainga
- Update sample usage in doc.go for both signing messages and verifying
  signatures

ok @owainga
2014-05-20 10:36:15 -05:00
Geert-Johan Riemer
af82a73fe4 Add tests for sign and verify. 2014-05-20 10:01:40 -05:00
Geert-Johan Riemer
ac7a367950 Add type PrivateKey, (*PrivateKey).Sign() and (*PublicKey).Verify(). 2014-05-20 09:59:29 -05:00
Josh Rickmar
1dbf389ceb Optimize public key serialization.
This change removes the internal pad function in favor a more opimized
paddedAppend function.  Unlike pad, which would always alloate a new
slice of the desired size and copy the bytes into it, paddedAppend
only appends the leading padding when necesary, and uses the builtin
append to copy the remaining source bytes.  pad was also used in
combination with another call to the builtin copy func to copy into a
zeroed byte slice.  As the slice is now created using make with an
initial length of zero, this copy can also be removed.

As confirmed by poking the bytes with the unsafe package, gc does not
zero array elements between the len and cap when allocating slices
with make().  In combination with the paddedAppend func, this results
in only a single copy of each byte, with no unnecssary zeroing, when
creating the serialized pubkeys.  This has not been tested with other
Go compilers (namely, gccgo and llgo), but the new behavior is still
functionally correct regardless of compiler optimizations.

The TestPad function has been removed as the pad func it tested has
likewise been removed.

ok @davecgh
2014-05-19 23:13:48 -05:00
David Hill
225f6d3d06 Add setgenerate to btcctl 2014-05-16 12:06:09 -04:00
David Hill
529036ec2b Implement getnetworkinfo 2014-05-14 11:45:13 -04:00
Dave Collins
d6f7adeba8 Improve btcctl handling of empty RPC data returns.
There are several RPCs which do not return any data on success.  btcctl
was improperly treating this as an error condition.
2014-05-13 15:25:36 -05:00
David Hill
ce142e8ca2 add getblockchaininfo to btcctl 2014-05-13 11:35:59 -04:00
Josh Rickmar
85886913b8 Implement Client methods for listunspent requests. 2014-05-12 16:43:30 -05:00
David Hill
4f0eb662c8 Support getblockchaininfo 2014-05-12 12:53:34 -04:00
Dave Collins
267cf94edc Correct typo in example log statement. 2014-05-11 13:30:25 -05:00
Dave Collins
e230b54427 Correct FutureGetBestBlockResult.Receive type.
Also correct the error message while here.
2014-05-11 02:35:07 -05:00
Dave Collins
c24be8b7bf Add reply parser for GetBestBlockCmd. 2014-05-11 02:32:24 -05:00
Dave Collins
5b376b3b5e Expose getcurrentnet and getbestblock to HTTP POST.
This commit makes the getcurrentnet and getbestblock RPCs available to
clients making HTTP POST requests.

Closes #127.
2014-05-11 02:21:27 -05:00
Dave Collins
e2ba50eee1 Fix a couple of typos in README.md. 2014-05-10 15:48:14 -05:00
Dave Collins
0fc9504da4 Improve overview in doc.go. 2014-05-10 02:50:19 -05:00
Dave Collins
9bb16e208d Update README.md.
This commit adds a description, status, and major features to the README.
2014-05-10 02:48:11 -05:00
Dave Collins
a35c1e8ede Auto recreate notification state on reconnect.
This commit adds logic to track all registered notifications that have
been registered by the client in a notification state when the default
automatic reconnect is enabled.

The notification state is then used to reregister for all previously
registered notifications on reconnect.  This allows the caller to
continue receiving notifications across reconnect cycles.
2014-05-10 02:15:09 -05:00
Dave Collins
7cc356d4c7 Convert CreateRawTransaction to higher-level types.
Closes #2.
2014-05-09 21:24:25 -05:00
Dave Collins
f666eddf75 Add README.md for bitcoincorehttp example.
Also, change the port in the example to the mainnet RPC port.
2014-05-09 21:09:51 -05:00
Dave Collins
315d85fa4e Add README.md for btcdwebsockets example. 2014-05-09 21:05:01 -05:00
Dave Collins
9b0d311826 Update README.md. 2014-05-09 20:48:05 -05:00
Dave Collins
f54e05c8fe Initial package overview documentation. 2014-05-09 20:12:47 -05:00
Dave Collins
8700eeaeb6 Convert to use gorilla websockets package.
Also, since the new package exposes more connection related error
information, add a new ErrInvalidEndpoint which is returned if the
specified enpoint does not appear to be a valid websocket provider and
only return the ErrInvalidAuth error when HTTP authorization failure
status codes are detected.

Closes #1.
2014-05-09 19:57:58 -05:00
Josh Rickmar
2e126ef597 Rename ListUnspentResult, use correct integer types. 2014-05-09 15:53:50 -05:00
Dave Collins
4921282646 Add example descriptions to README.md. 2014-05-09 01:35:27 -05:00
Dave Collins
2f84189676 Add godoc reference badge to README.md. 2014-05-09 01:26:37 -05:00
Dave Collins
73ecb412e9 Add support for TravisCI.
Also add TravisCI build status badge to README.md.
2014-05-09 01:16:47 -05:00
Dave Collins
eb82f35aac Improve btcdwebsockets example.
Since the example illustrates callbacks for the OnBlockConnected and
OnBlockDisconnected callbacks, also register for the notifications with
NotifyBlocks.

While here, document the fact that most of the callbacks require
registration.
2014-05-09 00:45:09 -05:00
Dave Collins
6a325f4c6a Improve getwork interaction with regtest mode.
Ordinarily, getwork will return an error if btcd is not connected to any
other peers.  This commit relaxes that requirement when running in
regression test mode since it is useful for development purposes.

While here, also improve check which returns an error from getwork is not
current to exclude the check when the best chain height is zero since the
code never believes it is current when at height 0.
2014-05-08 19:47:50 -05:00
Dave Collins
80f9a8e5e2 Fix FutureWalletPassphraseChange.Receive comment. 2014-05-08 13:12:56 -05:00