Run go fmt.
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.
add new dns seed, seed.bitnodes.io
addmultisigaddress support for btcctl
Use btcws.GetBestBlockResult.
Update btcctl for latest btcjson changes.
Update for btcws API change.
This RPCS debug statement should be a trace.
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.
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.
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.
Use NewMsgInvSizeHint since we know the size.

ok @davecgh
Update for recent btcwire AddUserAgent addition.
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.
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
Bypass rate limiter for sendrawtransaction.

ok @davecgh
Lower maxKnownInventory from 20000 to 1000.

ok @davecgh
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).
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.
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.