Commit graph

3455 commits

Author SHA1 Message Date
John C. Vernaleo
5ced990c22 Add test for listsinceblock.
Fix bug in listsinceblock found by test.
2014-01-06 11:02:32 -05:00
John C. Vernaleo
0ef1452247 Improve test coverage a bit.
Fix bug in a json command caught by new test.
2014-01-06 10:40:23 -05:00
David Hill
ae347a6f67 Add new DNS seed seed.bitcoinstats.com 2014-01-04 23:20:06 -05:00
Dave Collins
2005fae908 Change OP_CHECK_MULTISIG -> OP_CHECKMULTISIG.
This change was made to match the reference implementation.
2014-01-04 15:23:51 -06:00
Dave Collins
8a73f9b245 Correct p2sh field of decodescript RPC result.
The p2sh field in the result should be the encoded address which includes
the network (human-readable address) instead of just the raw hash.
2014-01-04 12:44:14 -06:00
Dave Collins
92eee5cb96 Populate p2sh field in decodescript RPC result. 2014-01-04 11:55:09 -06:00
Dave Collins
e1053b4a95 Add P2sh field to DecodeScriptResult. 2014-01-04 11:54:39 -06:00
Dave Collins
b713590902 Group the StackErrX definitions.
This improves the godoc display and provides a cleaner separation of the
error definitions from other variables.
2014-01-04 09:58:22 -06:00
Dave Collins
4cb1500a0b Add decodescript support to btcctl. 2014-01-03 23:30:08 -06:00
Dave Collins
47a78ea5c2 Add support for decodescript RPC command. 2014-01-03 23:29:24 -06:00
Dave Collins
eb4fc19b95 Modify DisasmString to return partial disassembly.
Rather than returning an empty string from DisasmString if a script fails
to parse, return the disassembly up to the point of the failure along with
[error] appended.  The error is still returned in case the caller wants
more information about the script parse failure.
2014-01-03 18:47:00 -06:00
Dave Collins
f78d054700 Add struct for DecodeScriptResult. 2014-01-03 18:20:06 -06:00
John C. Vernaleo
258e9ef4c6 Add test for the Cmd.Id() functions. 2014-01-03 17:50:17 -05:00
Dave Collins
a8ff7fecb4 Add createrawtransaction support to btcctl. 2014-01-03 13:45:12 -06:00
Dave Collins
814c920c96 Add tests for new payment script creation funcs. 2014-01-03 13:42:22 -06:00
Dave Collins
3d60bac238 Add new funcs for creating payment scripts.
This commit adds two new functions named PayToScriptHashScript and
PayToAddrScript.  The first one creates and returns a public-key script
which pays to the provided script hash and conforms to BIP0016.

The second function takes the new btcutil.Address interface type and
returns an appropriate script to pay to the address type in the interface.
It currently works for btcutil.AddressPubKeyHash and
btcutil.AddressScriptHash.
2014-01-03 13:35:51 -06:00
Dave Collins
b6b2fd15b3 Add support for createrawtransaction RPC command. 2014-01-03 12:43:13 -06:00
Josh Rickmar
405eca4a44 Remove usage of deprecated address encode/decode API. 2014-01-03 13:22:28 -05:00
John C. Vernaleo
2944ccb86b Update coverage report. 2014-01-03 12:02:41 -05:00
Dave Collins
84cb4c7130 Export new function ConvertCreateRawTxParams.
The inputs to the createrawtransaction command are JSON strings, however
the NewCreateRawTransactionCmd function takes concrete types.  Thus,
callers which deal with the raw JSON need a method to perform the
validation and conversion.  This logic is the same as what needs to happen
when unmashalling a full JSON-RPC command, so this commit factors that
logic out into a separate function and exports it.
2014-01-03 10:25:06 -06:00
Dave Collins
8d7354f45b Gofmt. 2014-01-03 10:22:07 -06:00
Dave Collins
e64e6f0757 Add tests for new BitcoinNet Stringer. 2014-01-03 08:36:11 -06:00
Dave Collins
626662fb5f Add Stringer to BitcoinNet. 2014-01-03 08:32:43 -06:00
Francis Lam
082ad7caf2 Updated createVoutList to support scripthash/multisig outputs
Used updates in btcscript/btcutil to support decoding scripthash and
multisig outputs for display in getrawtransactions/decoderawtransaction
2014-01-02 13:48:50 -06:00
Francis Lam
3a8ec0078b Added another multisig test with compressed pubkey 2014-01-02 13:50:22 -05:00
Francis Lam
3f52f559eb Added tests for multisig scripts and fixed comments
Fixed up bad function comment headers

Added a small set of tests for the ScriptToAddrHashes function to test
functionality of a couple real multisig cases as well as error checking
2014-01-02 13:31:00 -05:00
Francis Lam
a5aaf90687 Added support to decode scripthash/multisig from pkscripts 2014-01-02 00:28:16 -05:00
Dave Collins
aeec39c1ff Add 2014 to copyright dates. 2014-01-01 10:16:15 -06:00
Dave Collins
30802fdd52 Rename RPC handlers map to rpcHandlers.
The name handlers for a package level is a bit too generic and could
easily cause a name collision.  Even though the compiler would catch it,
use something a bit more descriptive.
2013-12-31 15:53:19 -06:00
Dave Collins
835cee229a Move RPC handler maps near the top of file.
Since the command to handler mappings are the most often modified and
referenced code in rpcserver.go and rpcwebsocket.go, move them near the
top of their respective files.
2013-12-31 14:48:50 -06:00
Dave Collins
9b166b3876 Remove wallet notifications chan from std commands.
This commit cleans up the standard RPC command hanlding a bit by removing
the websocket specific notification channel from the handlers.  This was
previously required because the sendrawtransaction, when called from a
websocket enabled connection, needs to add a notification for when the
transaction is mined.

This commit modifies that to instead implement a websocket extended
version of sendrawtransaction which invokes the standard handler and adds
the notification.  In addition, the main send was modified to first look
if the command has a websocket specific handler first, and then falls back
to standard commands, rather than the previous approach of first checking
for a standard command and falling through to websocket commands.  This
essentially allows websockets connections to extend commands with the same
name with additional functionality such as what was done in this commit.
2013-12-31 14:42:15 -06:00
Dave Collins
5ad6d543d6 Move RPC websocket code to its own file.
The rpcserver.go file is starting to get a bit unwieldy.  This commit
moves the separable websocket specific bits into a separate file named
rpcwebsocket.go.
2013-12-31 13:19:07 -06:00
Josh Rickmar
426db5ae21 Add getaccountaddress support to btcctl. 2013-12-31 13:11:01 -05:00
Francis Lam
5d91e16e7c Added MarshalJSON to Vin and changed Vout.ScriptPubKey
Added MarshalJSON method to Vin which properly omits the Vout field
from coinbase Vin's by using anonymous structs with the proper
subsets of fields outputted by bitcoind

Changed Vout.ScriptPubKey to add omitempty for ReqSigs and Addresses:
both fields are not shown when there is an error identifying to
scriptType or parsing addresses in bitcoind
2013-12-30 20:36:46 -06:00
Dave Collins
f2a2744bec Correct error handling from the previous commit. 2013-12-30 20:27:36 -06:00
Francis Lam
28d08f8b16 Small changes to createVinList/createVoutList
Added error checking for script disassembley

Changed vout to handle errors in processing the way bitcoind does: the
type displayed is "nonstandard" when the calculated type is nonstandard
or nulltype and also when there is an error getting the address.

Still doesn't properly support multisig addresses, but now it should
return "nonstandard" since since address lookup fails for those cases.
2013-12-30 20:06:13 -05:00
Dave Collins
c0236b5a2f Change LockTime in TxRawDecodeResult to uint32. 2013-12-30 18:42:46 -06:00
Dave Collins
eb624acfd4 Add support for decoderawtransaction RPC command.
Since the decoderawtransaction result makes use of the same vin and vout
lists, this commit also factors the logic for those out into separate
functions.
2013-12-30 18:33:13 -06:00
Josh Rickmar
bf7c5fa062 Fix a typo. 2013-12-30 16:32:25 -05:00
Josh Rickmar
13868e76ec Add getaccount support to btcctl. 2013-12-30 16:31:47 -05:00
Josh Rickmar
87b7352008 Add getunconfirmedbalance extension. 2013-12-30 15:09:16 -05:00
Dave Collins
d17a97b485 Correct verifychain RPC call return.
The return value should be a boolean for compatibility.
2013-12-30 10:59:14 -06:00
Dave Collins
3bfeabb47a Improve btcctl verifychain usage.
Also, add a comment for makeVerifyChain while here.
2013-12-30 10:35:33 -06:00
Josh Rickmar
86575afa91 Add listaddresstransactions extension. 2013-12-30 11:03:05 -05:00
Josh Rickmar
bd29b12d31 Notify wallets when mempool txs pay to a wallet address. 2013-12-30 09:33:36 -05:00
Dave Collins
2d875b39f9 Bring README.md up-to-date with the current status. 2013-12-28 15:30:33 -06:00
Dave Collins
cc712827da Add tests for pad function.
This brings the overall test coverage up to 99.88%.
2013-12-28 15:30:10 -06:00
Dave Collins
ca14702e5d Correct getpeerinfo JSON marshalling for omitempty.
The fields of the PeerInfo should not have been marked omit as the only
ones that should be omitted to for compatibility are the SyncNode and
BanScore fields.
2013-12-27 19:25:20 -06:00
Dave Collins
3faa256f75 Correct the getpeerinfo RPC services field.
In order to match the Satohsi client, the return is supposed to be an
8-digit string representation of the services instead of the actual
services numeric value.
2013-12-27 17:35:51 -06:00
Dave Collins
674ef590bb No need to cast something is already a uint32. 2013-12-27 13:20:13 -06:00