Commit graph

671 commits

Author SHA1 Message Date
Josh Rickmar 74303966c0 Updates for btcutil and btcscript's btcnet conversion.
ok @davecgh
2014-05-27 17:44:55 -05:00
Dave Collins 4328461f36 Update for recent btcchain and btcnet API changes. 2014-05-27 10:12:59 -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 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
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
David Hill 225f6d3d06 Add setgenerate to btcctl 2014-05-16 12:06:09 -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
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 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 47e65634a7 Use btcd pver instead of wire pver in RPC encoding.
Along the same lines as the previous commit, the RPCs that return
serialized data structures should use the max protocol version btcd
supports as opposed to the maximum protocol version etcwire supports.
2014-05-07 11:33:32 -05:00
Dave Collins fd025a7368 Use btcd pver instead of wire pver in getinfo RPC.
The getinfo RPC should return the max protocol version btcd supports as
opposed to the maximum protocol version btcwire supports.  Currently they
are both the same value, so there is no issue.  However, they will not
always be the same.
2014-05-07 10:30:58 -05:00
Josh Rickmar a20fd1ab2c Modify notifyspent handler to take multiple outpoints. 2014-05-06 08:30:36 -05:00
Dave Collins a4a79387cc Add support for getmininginfo RPC.
Closes #126.
2014-05-04 14:34:25 -05:00
Dave Collins 4178c36dc3 Populate connections field in getinfo RPC.
The JSON object returned from the getinfo RPC contains a connection count
field that was not being populated.
2014-05-03 14:07:08 -05:00
Dave Collins 0a7543516c Update block manager chainstate for all sources.
This commit updates the block manager's local chain state when a block
processed by submitting it directly to the block manager as opposed to
only when it comes from the network.

Also, it modifies the submitblock RPC to use the concurrent safe block
manager process block instead of the unsafe btcchain version.

The combination of these two fixes ensure the internal block manager chain
state is properly synced with the actual btcchain state regardless of how
blocks are added.
2014-05-02 23:02:10 -05:00
Dave Collins 92ca0e92c0 Implement getwork RPC.
This commit adds full support for the getwork RPC which can be used to
support external mining through applications such as cgminer.

Closes #125.
2014-05-01 10:52:28 -05:00
Dave Collins a38f93bf06 use fastsha256 in rpcwebsocket.go.
While this is not performance critical code, there is no need to import
another package into the final binary.
2014-05-01 10:36:41 -05:00
David Hill d72da506c5 Some UPNP devices require the protocol to be uppercase.
This matches what miniupnpc sends.
2014-04-26 14:46:17 -04:00
Josh Rickmar bba0a0482d Include P2PK outputs for rescanned P2PKH addrs.
This change fixes rescan to include transactions that pay to the
pubkey for a rescanned pubkey hash address.  This behavior was lost
when the rescan was optimized for specific types of the
btcutil.Address interface.

ok @davecgh
2014-04-25 10:33:58 -05:00
Dave Collins 27082ace79 Correct error handling on createMarshalledReply.
This commit correctly sets the error in the marhsalled reply if it is
already a *btcjson.Error.  Previously it would only set the error if it
was not of that type which led to some RPC results showing no error when
they actually had one.
2014-04-25 02:51:57 -05:00
Dave Collins bdaa5f7f8d Set RPC content type to applicaton/json.
Closes #121.
2014-04-24 23:20:13 -05:00
David Hill 765dbb443d Fix a bug in fetching the XML URL.
In Discover, the reponse was lowercased for comparison.  However,
this caused a 404 - Not found when fetching the url provided by
the location header if the url contained uppercase.

ok @owainga
2014-04-23 19:10:53 -04:00
Owain G. Ainsworth 4d44eeb877 Move to protecting all peer stats by the same mutex.
In practise the races caused by not protecting these quite simply didn't
matter, they couldn't actually cause any damage whatsoever. However, I
am sick of hearing about these essentially false positivies whenever
someone runs the race detector (yes, i know that race detector has no
false positives but this was effectively harmess).

verified to shut the detector up by dhill.
2014-04-23 17:38:14 +01:00
Owain G. Ainsworth 88ea84cf12 Addrman: only shuffle as much as we need.
If we switch the knuth shuffle to the version that swaps the element
with an element between it and the end of the array, then once we have
gotten to the amount of elements we need they won't change later in the
algorithm. Terminating here means that we only do 23% of the length of
the array worth of random swaps at most.
2014-04-23 17:38:13 +01:00
Owain G. Ainsworth ec8d0e582c Attempt to create less garbage for getaddr calls.
We make ka.na immutable in the address manager. Whenever we would update
the structure we replace it with a new copy. This beats making a copy of
all addresses once per getaddr command (max is just over 23000 we would
be copying, compared to at most 2000 copies on a new getaddr that has
all addresses we know with newer dates).
2014-04-23 17:38:13 +01:00
David Hill 08377c21e2 Lower maxKnownInventory from 20000 to 1000.
ok @davecgh
2014-04-23 07:48:52 -04:00
David Hill 8a322e4792 Bypass rate limiter for sendrawtransaction.
ok @davecgh
2014-04-23 07:45:56 -04:00
David Hill 75bb52d715 In handleGetDataMsg, fix two unknown inv type bugs.
On unknown inventory types, handleGetDataMsg would loop forever.
After fixing that, if a getdata request only had unknown inventory
types, it would block forever.

ok @davecgh
2014-04-21 14:52:02 -04:00
Josh Rickmar f88db561f1 Make rescan faster by avoiding hash copies.
Copying the RIPEMD160 after SHA256 hash result into a new stack array
to be used as a map lookup key can be quite expensive, and this should
be avoided if possible on intensive tasks such as rescans.  This
change takes advantage of the new Hash160 methods of the
AddressPubKeyHash and AddressScriptHash types to use the address's
underlying hash array directly, rather than creating a copy from the
ScriptAddress result.

Unfortunately, for AddressPubKey, ScriptAddress may return either a
byte slice of len 33 or 65 depending on whether the pubkey is
compressed or not, so no such straightforward optimization is
possible.

As a result of this change, I have seen rescans perform roughly 3.5x
faster than before.
2014-04-20 21:16:59 -05:00
Dave Collins 1e75ccc9b9 Update for recent btcwire AddUserAgent addition. 2014-04-20 17:46:32 -05:00
David Hill 88093cb838 Use NewMsgInvSizeHint since we know the size.
ok @davecgh
2014-04-19 20:05:35 -04:00
Dave Collins a4673597bd Update for notifyallnewtxs rename.
The websocket extension command to register for notifications when a new
transaction has been accepted to the memory pool and the resulting
notifications have been renamed.  This commit catches up to the change.
2014-04-15 12:22:52 -05:00
Dave Collins 05a7979292 Update for notifynewtxs to notifyreceived rename.
The websocket extension command to register for notifications when an
address receives funds has been renamed.  This commit catches up to the
change.
2014-04-14 19:11:08 -05:00
Dave Collins de51409185 Add debug print for chain verify.
Since a chain verification can take a long time depending on the
parameters, this commit adds a debug print to the RPC server at the info
level for how many blocks are being verified and at what level.

The logic was also slightly modified so the number of blocks being checked
can easily be calculated and shown.
2014-04-14 10:29:51 -05:00
David Hill 3937c1a67c This RPCS debug statement should be a trace. 2014-04-13 15:50:28 -04:00
Josh Rickmar 42061ebf87 Update for btcws API change. 2014-04-10 21:12:40 -05:00
Dave Collins a0bfde8db0 Update btcctl for latest btcjson changes. 2014-04-10 21:12:40 -05:00
Josh Rickmar 1fd5cd2742 Use btcws.GetBestBlockResult. 2014-04-10 20:03:54 -05:00
David Hill 384a535f49 addmultisigaddress support for btcctl 2014-04-07 14:45:42 -04:00
David Hill 1b56cb291f add new dns seed, seed.bitnodes.io 2014-04-01 14:58:40 -04:00
Dave Collins 886281993a Use separate max protocol version.
This commit modifies peers to use a max protocol version that is specified
as a constant in the peer code as opposed to the btcwire.ProtocolVersion
constant.

This allows btcwire to be updated to support new protocol versions without
causing peers to claim they support a protocol version which they actually
don't.
2014-03-28 17:42:59 -05:00
Dave Collins 444d05eafc Run go fmt. 2014-03-28 14:49:48 -05:00
Josh Rickmar d702e37141 Update websocket clients with rescan progress.
This change periodically (about every 10 seconds) notifies the
connected websocket client of the height of the last processed block
as part of the rescan.  This enables clients to listen for the
notification and keep track of how much progress a rescan has made
even without any results being found.  If the websocket connection is
lost during the rescan, on reconnect, clients may safely start over at
the last notified height.
2014-03-28 11:27:29 -05:00
Owain G. Ainsworth 5932cd5385 comments - shorten, simplify and make 80cols. 2014-03-28 00:19:53 +00:00