multi: Update with result of gofmt -s.

This commit updates the code to make use of the most recent simplified
output from gofmt.
This commit is contained in:
Dave Collins 2016-02-25 10:47:46 -06:00
parent d4852101d4
commit f389742b39
8 changed files with 135 additions and 135 deletions

View file

@ -59,7 +59,7 @@ func TestReorganization(t *testing.T) {
blockchain.TstSetCoinbaseMaturity(1)
timeSource := blockchain.NewMedianTime()
expectedOrphans := map[int]struct{}{5: struct{}{}, 6: struct{}{}}
expectedOrphans := map[int]struct{}{5: {}, 6: {}}
for i := 1; i < len(blocks); i++ {
isOrphan, err := chain.ProcessBlock(blocks[i], timeSource, blockchain.BFNone)
if err != nil {

View file

@ -338,22 +338,22 @@ var (
var (
registeredNets = map[wire.BitcoinNet]struct{}{
MainNetParams.Net: struct{}{},
TestNet3Params.Net: struct{}{},
RegressionNetParams.Net: struct{}{},
SimNetParams.Net: struct{}{},
MainNetParams.Net: {},
TestNet3Params.Net: {},
RegressionNetParams.Net: {},
SimNetParams.Net: {},
}
pubKeyHashAddrIDs = map[byte]struct{}{
MainNetParams.PubKeyHashAddrID: struct{}{},
TestNet3Params.PubKeyHashAddrID: struct{}{}, // shared with regtest
SimNetParams.PubKeyHashAddrID: struct{}{},
MainNetParams.PubKeyHashAddrID: {},
TestNet3Params.PubKeyHashAddrID: {}, // shared with regtest
SimNetParams.PubKeyHashAddrID: {},
}
scriptHashAddrIDs = map[byte]struct{}{
MainNetParams.ScriptHashAddrID: struct{}{},
TestNet3Params.ScriptHashAddrID: struct{}{}, // shared with regtest
SimNetParams.ScriptHashAddrID: struct{}{},
MainNetParams.ScriptHashAddrID: {},
TestNet3Params.ScriptHashAddrID: {}, // shared with regtest
SimNetParams.ScriptHashAddrID: {},
}
// Testnet is shared with regtest.

View file

@ -715,9 +715,9 @@ func loadConfig() (*config, []string, error) {
// addresses.
if !cfg.DisableRPC && cfg.DisableTLS {
allowedTLSListeners := map[string]struct{}{
"localhost": struct{}{},
"127.0.0.1": struct{}{},
"::1": struct{}{},
"localhost": {},
"127.0.0.1": {},
"::1": {},
}
for _, addr := range cfg.RPCListeners {
host, _, err := net.SplitHostPort(addr)

View file

@ -553,7 +553,7 @@ func TestOutboundPeer(t *testing.T) {
}
// Test Queue Inv
fakeBlockHash := &wire.ShaHash{0x00, 0x01}
fakeBlockHash := &wire.ShaHash{0: 0x00, 1: 0x01}
fakeInv := wire.NewInvVect(wire.InvTypeBlock, fakeBlockHash)
p.QueueInventory(fakeInv)
p.AddKnownInventory(fakeInv)

View file

@ -177,94 +177,94 @@ var rpcHandlersBeforeInit = map[string]commandHandler{
// it lacks support for wallet functionality. For these commands the user
// should ask a connected instance of btcwallet.
var rpcAskWallet = map[string]struct{}{
"addmultisigaddress": struct{}{},
"backupwallet": struct{}{},
"createencryptedwallet": struct{}{},
"createmultisig": struct{}{},
"dumpprivkey": struct{}{},
"dumpwallet": struct{}{},
"encryptwallet": struct{}{},
"getaccount": struct{}{},
"getaccountaddress": struct{}{},
"getaddressesbyaccount": struct{}{},
"getbalance": struct{}{},
"getnewaddress": struct{}{},
"getrawchangeaddress": struct{}{},
"getreceivedbyaccount": struct{}{},
"getreceivedbyaddress": struct{}{},
"gettransaction": struct{}{},
"gettxoutsetinfo": struct{}{},
"getunconfirmedbalance": struct{}{},
"getwalletinfo": struct{}{},
"importprivkey": struct{}{},
"importwallet": struct{}{},
"keypoolrefill": struct{}{},
"listaccounts": struct{}{},
"listaddressgroupings": struct{}{},
"listlockunspent": struct{}{},
"listreceivedbyaccount": struct{}{},
"listreceivedbyaddress": struct{}{},
"listsinceblock": struct{}{},
"listtransactions": struct{}{},
"listunspent": struct{}{},
"lockunspent": struct{}{},
"move": struct{}{},
"sendfrom": struct{}{},
"sendmany": struct{}{},
"sendtoaddress": struct{}{},
"setaccount": struct{}{},
"settxfee": struct{}{},
"signmessage": struct{}{},
"signrawtransaction": struct{}{},
"walletlock": struct{}{},
"walletpassphrase": struct{}{},
"walletpassphrasechange": struct{}{},
"addmultisigaddress": {},
"backupwallet": {},
"createencryptedwallet": {},
"createmultisig": {},
"dumpprivkey": {},
"dumpwallet": {},
"encryptwallet": {},
"getaccount": {},
"getaccountaddress": {},
"getaddressesbyaccount": {},
"getbalance": {},
"getnewaddress": {},
"getrawchangeaddress": {},
"getreceivedbyaccount": {},
"getreceivedbyaddress": {},
"gettransaction": {},
"gettxoutsetinfo": {},
"getunconfirmedbalance": {},
"getwalletinfo": {},
"importprivkey": {},
"importwallet": {},
"keypoolrefill": {},
"listaccounts": {},
"listaddressgroupings": {},
"listlockunspent": {},
"listreceivedbyaccount": {},
"listreceivedbyaddress": {},
"listsinceblock": {},
"listtransactions": {},
"listunspent": {},
"lockunspent": {},
"move": {},
"sendfrom": {},
"sendmany": {},
"sendtoaddress": {},
"setaccount": {},
"settxfee": {},
"signmessage": {},
"signrawtransaction": {},
"walletlock": {},
"walletpassphrase": {},
"walletpassphrasechange": {},
}
// Commands that are currently unimplemented, but should ultimately be.
var rpcUnimplemented = map[string]struct{}{
"estimatefee": struct{}{},
"estimatepriority": struct{}{},
"getblockchaininfo": struct{}{},
"getchaintips": struct{}{},
"getnetworkinfo": struct{}{},
"estimatefee": {},
"estimatepriority": {},
"getblockchaininfo": {},
"getchaintips": {},
"getnetworkinfo": {},
}
// Commands that are available to a limited user
var rpcLimited = map[string]struct{}{
// Websockets commands
"notifyblocks": struct{}{},
"notifynewtransactions": struct{}{},
"notifyreceived": struct{}{},
"notifyspent": struct{}{},
"rescan": struct{}{},
"session": struct{}{},
"notifyblocks": {},
"notifynewtransactions": {},
"notifyreceived": {},
"notifyspent": {},
"rescan": {},
"session": {},
// Websockets AND HTTP/S commands
"help": struct{}{},
"help": {},
// HTTP/S-only commands
"createrawtransaction": struct{}{},
"decoderawtransaction": struct{}{},
"decodescript": struct{}{},
"getbestblock": struct{}{},
"getbestblockhash": struct{}{},
"getblock": struct{}{},
"getblockcount": struct{}{},
"getblockhash": struct{}{},
"getcurrentnet": struct{}{},
"getdifficulty": struct{}{},
"getinfo": struct{}{},
"getnettotals": struct{}{},
"getnetworkhashps": struct{}{},
"getrawmempool": struct{}{},
"getrawtransaction": struct{}{},
"gettxout": struct{}{},
"searchrawtransactions": struct{}{},
"sendrawtransaction": struct{}{},
"submitblock": struct{}{},
"validateaddress": struct{}{},
"verifymessage": struct{}{},
"createrawtransaction": {},
"decoderawtransaction": {},
"decodescript": {},
"getbestblock": {},
"getbestblockhash": {},
"getblock": {},
"getblockcount": {},
"getblockhash": {},
"getcurrentnet": {},
"getdifficulty": {},
"getinfo": {},
"getnettotals": {},
"getnetworkhashps": {},
"getrawmempool": {},
"getrawtransaction": {},
"gettxout": {},
"searchrawtransactions": {},
"sendrawtransaction": {},
"submitblock": {},
"validateaddress": {},
"verifymessage": {},
}
// builderScript is a convenience function which is used for hard-coded scripts

View file

@ -582,48 +582,48 @@ var helpDescsEnUS = map[string]string{
// pointer to the type (or nil to indicate no return value).
var rpcResultTypes = map[string][]interface{}{
"addnode": nil,
"createrawtransaction": []interface{}{(*string)(nil)},
"debuglevel": []interface{}{(*string)(nil), (*string)(nil)},
"decoderawtransaction": []interface{}{(*btcjson.TxRawDecodeResult)(nil)},
"decodescript": []interface{}{(*btcjson.DecodeScriptResult)(nil)},
"generate": []interface{}{(*[]string)(nil)},
"getaddednodeinfo": []interface{}{(*[]string)(nil), (*[]btcjson.GetAddedNodeInfoResult)(nil)},
"getbestblock": []interface{}{(*btcjson.GetBestBlockResult)(nil)},
"getbestblockhash": []interface{}{(*string)(nil)},
"getblock": []interface{}{(*string)(nil), (*btcjson.GetBlockVerboseResult)(nil)},
"getblockcount": []interface{}{(*int64)(nil)},
"getblockhash": []interface{}{(*string)(nil)},
"getblockheader": []interface{}{(*string)(nil), (*btcjson.GetBlockHeaderVerboseResult)(nil)},
"getblocktemplate": []interface{}{(*btcjson.GetBlockTemplateResult)(nil), (*string)(nil), nil},
"getconnectioncount": []interface{}{(*int32)(nil)},
"getcurrentnet": []interface{}{(*uint32)(nil)},
"getdifficulty": []interface{}{(*float64)(nil)},
"getgenerate": []interface{}{(*bool)(nil)},
"gethashespersec": []interface{}{(*float64)(nil)},
"getinfo": []interface{}{(*btcjson.InfoChainResult)(nil)},
"getmempoolinfo": []interface{}{(*btcjson.GetMempoolInfoResult)(nil)},
"getmininginfo": []interface{}{(*btcjson.GetMiningInfoResult)(nil)},
"getnettotals": []interface{}{(*btcjson.GetNetTotalsResult)(nil)},
"getnetworkhashps": []interface{}{(*int64)(nil)},
"getpeerinfo": []interface{}{(*[]btcjson.GetPeerInfoResult)(nil)},
"getrawmempool": []interface{}{(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)},
"getrawtransaction": []interface{}{(*string)(nil), (*btcjson.TxRawResult)(nil)},
"gettxout": []interface{}{(*btcjson.GetTxOutResult)(nil)},
"getwork": []interface{}{(*btcjson.GetWorkResult)(nil), (*bool)(nil)},
"createrawtransaction": {(*string)(nil)},
"debuglevel": {(*string)(nil), (*string)(nil)},
"decoderawtransaction": {(*btcjson.TxRawDecodeResult)(nil)},
"decodescript": {(*btcjson.DecodeScriptResult)(nil)},
"generate": {(*[]string)(nil)},
"getaddednodeinfo": {(*[]string)(nil), (*[]btcjson.GetAddedNodeInfoResult)(nil)},
"getbestblock": {(*btcjson.GetBestBlockResult)(nil)},
"getbestblockhash": {(*string)(nil)},
"getblock": {(*string)(nil), (*btcjson.GetBlockVerboseResult)(nil)},
"getblockcount": {(*int64)(nil)},
"getblockhash": {(*string)(nil)},
"getblockheader": {(*string)(nil), (*btcjson.GetBlockHeaderVerboseResult)(nil)},
"getblocktemplate": {(*btcjson.GetBlockTemplateResult)(nil), (*string)(nil), nil},
"getconnectioncount": {(*int32)(nil)},
"getcurrentnet": {(*uint32)(nil)},
"getdifficulty": {(*float64)(nil)},
"getgenerate": {(*bool)(nil)},
"gethashespersec": {(*float64)(nil)},
"getinfo": {(*btcjson.InfoChainResult)(nil)},
"getmempoolinfo": {(*btcjson.GetMempoolInfoResult)(nil)},
"getmininginfo": {(*btcjson.GetMiningInfoResult)(nil)},
"getnettotals": {(*btcjson.GetNetTotalsResult)(nil)},
"getnetworkhashps": {(*int64)(nil)},
"getpeerinfo": {(*[]btcjson.GetPeerInfoResult)(nil)},
"getrawmempool": {(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)},
"getrawtransaction": {(*string)(nil), (*btcjson.TxRawResult)(nil)},
"gettxout": {(*btcjson.GetTxOutResult)(nil)},
"getwork": {(*btcjson.GetWorkResult)(nil), (*bool)(nil)},
"node": nil,
"help": []interface{}{(*string)(nil), (*string)(nil)},
"help": {(*string)(nil), (*string)(nil)},
"ping": nil,
"searchrawtransactions": []interface{}{(*string)(nil), (*[]btcjson.SearchRawTransactionsResult)(nil)},
"sendrawtransaction": []interface{}{(*string)(nil)},
"searchrawtransactions": {(*string)(nil), (*[]btcjson.SearchRawTransactionsResult)(nil)},
"sendrawtransaction": {(*string)(nil)},
"setgenerate": nil,
"stop": []interface{}{(*string)(nil)},
"submitblock": []interface{}{nil, (*string)(nil)},
"validateaddress": []interface{}{(*btcjson.ValidateAddressChainResult)(nil)},
"verifychain": []interface{}{(*bool)(nil)},
"verifymessage": []interface{}{(*bool)(nil)},
"stop": {(*string)(nil)},
"submitblock": {nil, (*string)(nil)},
"validateaddress": {(*btcjson.ValidateAddressChainResult)(nil)},
"verifychain": {(*bool)(nil)},
"verifymessage": {(*bool)(nil)},
// Websocket commands.
"session": []interface{}{(*btcjson.SessionResult)(nil)},
"session": {(*btcjson.SessionResult)(nil)},
"notifyblocks": nil,
"stopnotifyblocks": nil,
"notifynewtransactions": nil,

View file

@ -67,7 +67,7 @@ var wsHandlersBeforeInit = map[string]wsCommandHandler{
// operations to run concurrently (and one at a time) while still responding
// to the majority of normal requests which can be answered quickly.
var wsAsyncHandlers = map[string]struct{}{
"rescan": struct{}{},
"rescan": {},
}
// WebsocketHandler handles a new websocket client by creating a new wsClient,

View file

@ -104,21 +104,21 @@ func TestSignTxOutput(t *testing.T) {
tx := &wire.MsgTx{
Version: 1,
TxIn: []*wire.TxIn{
&wire.TxIn{
{
PreviousOutPoint: wire.OutPoint{
Hash: wire.ShaHash{},
Index: 0,
},
Sequence: 4294967295,
},
&wire.TxIn{
{
PreviousOutPoint: wire.OutPoint{
Hash: wire.ShaHash{},
Index: 1,
},
Sequence: 4294967295,
},
&wire.TxIn{
{
PreviousOutPoint: wire.OutPoint{
Hash: wire.ShaHash{},
Index: 2,
@ -127,13 +127,13 @@ func TestSignTxOutput(t *testing.T) {
},
},
TxOut: []*wire.TxOut{
&wire.TxOut{
{
Value: 1,
},
&wire.TxOut{
{
Value: 2,
},
&wire.TxOut{
{
Value: 3,
},
},
@ -1642,7 +1642,7 @@ nexttest:
output := wire.NewTxOut(500, []byte{txscript.OP_RETURN})
tx.AddTxOut(output)
for _ = range sigScriptTests[i].inputs {
for range sigScriptTests[i].inputs {
txin := wire.NewTxIn(coinbaseOutPoint, nil)
tx.AddTxIn(txin)
}