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:
parent
d4852101d4
commit
f389742b39
8 changed files with 135 additions and 135 deletions
|
@ -59,7 +59,7 @@ func TestReorganization(t *testing.T) {
|
||||||
blockchain.TstSetCoinbaseMaturity(1)
|
blockchain.TstSetCoinbaseMaturity(1)
|
||||||
|
|
||||||
timeSource := blockchain.NewMedianTime()
|
timeSource := blockchain.NewMedianTime()
|
||||||
expectedOrphans := map[int]struct{}{5: struct{}{}, 6: struct{}{}}
|
expectedOrphans := map[int]struct{}{5: {}, 6: {}}
|
||||||
for i := 1; i < len(blocks); i++ {
|
for i := 1; i < len(blocks); i++ {
|
||||||
isOrphan, err := chain.ProcessBlock(blocks[i], timeSource, blockchain.BFNone)
|
isOrphan, err := chain.ProcessBlock(blocks[i], timeSource, blockchain.BFNone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -338,22 +338,22 @@ var (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
registeredNets = map[wire.BitcoinNet]struct{}{
|
registeredNets = map[wire.BitcoinNet]struct{}{
|
||||||
MainNetParams.Net: struct{}{},
|
MainNetParams.Net: {},
|
||||||
TestNet3Params.Net: struct{}{},
|
TestNet3Params.Net: {},
|
||||||
RegressionNetParams.Net: struct{}{},
|
RegressionNetParams.Net: {},
|
||||||
SimNetParams.Net: struct{}{},
|
SimNetParams.Net: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
pubKeyHashAddrIDs = map[byte]struct{}{
|
pubKeyHashAddrIDs = map[byte]struct{}{
|
||||||
MainNetParams.PubKeyHashAddrID: struct{}{},
|
MainNetParams.PubKeyHashAddrID: {},
|
||||||
TestNet3Params.PubKeyHashAddrID: struct{}{}, // shared with regtest
|
TestNet3Params.PubKeyHashAddrID: {}, // shared with regtest
|
||||||
SimNetParams.PubKeyHashAddrID: struct{}{},
|
SimNetParams.PubKeyHashAddrID: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptHashAddrIDs = map[byte]struct{}{
|
scriptHashAddrIDs = map[byte]struct{}{
|
||||||
MainNetParams.ScriptHashAddrID: struct{}{},
|
MainNetParams.ScriptHashAddrID: {},
|
||||||
TestNet3Params.ScriptHashAddrID: struct{}{}, // shared with regtest
|
TestNet3Params.ScriptHashAddrID: {}, // shared with regtest
|
||||||
SimNetParams.ScriptHashAddrID: struct{}{},
|
SimNetParams.ScriptHashAddrID: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Testnet is shared with regtest.
|
// Testnet is shared with regtest.
|
||||||
|
|
|
@ -715,9 +715,9 @@ func loadConfig() (*config, []string, error) {
|
||||||
// addresses.
|
// addresses.
|
||||||
if !cfg.DisableRPC && cfg.DisableTLS {
|
if !cfg.DisableRPC && cfg.DisableTLS {
|
||||||
allowedTLSListeners := map[string]struct{}{
|
allowedTLSListeners := map[string]struct{}{
|
||||||
"localhost": struct{}{},
|
"localhost": {},
|
||||||
"127.0.0.1": struct{}{},
|
"127.0.0.1": {},
|
||||||
"::1": struct{}{},
|
"::1": {},
|
||||||
}
|
}
|
||||||
for _, addr := range cfg.RPCListeners {
|
for _, addr := range cfg.RPCListeners {
|
||||||
host, _, err := net.SplitHostPort(addr)
|
host, _, err := net.SplitHostPort(addr)
|
||||||
|
|
|
@ -553,7 +553,7 @@ func TestOutboundPeer(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Queue Inv
|
// Test Queue Inv
|
||||||
fakeBlockHash := &wire.ShaHash{0x00, 0x01}
|
fakeBlockHash := &wire.ShaHash{0: 0x00, 1: 0x01}
|
||||||
fakeInv := wire.NewInvVect(wire.InvTypeBlock, fakeBlockHash)
|
fakeInv := wire.NewInvVect(wire.InvTypeBlock, fakeBlockHash)
|
||||||
p.QueueInventory(fakeInv)
|
p.QueueInventory(fakeInv)
|
||||||
p.AddKnownInventory(fakeInv)
|
p.AddKnownInventory(fakeInv)
|
||||||
|
|
150
rpcserver.go
150
rpcserver.go
|
@ -177,94 +177,94 @@ var rpcHandlersBeforeInit = map[string]commandHandler{
|
||||||
// it lacks support for wallet functionality. For these commands the user
|
// it lacks support for wallet functionality. For these commands the user
|
||||||
// should ask a connected instance of btcwallet.
|
// should ask a connected instance of btcwallet.
|
||||||
var rpcAskWallet = map[string]struct{}{
|
var rpcAskWallet = map[string]struct{}{
|
||||||
"addmultisigaddress": struct{}{},
|
"addmultisigaddress": {},
|
||||||
"backupwallet": struct{}{},
|
"backupwallet": {},
|
||||||
"createencryptedwallet": struct{}{},
|
"createencryptedwallet": {},
|
||||||
"createmultisig": struct{}{},
|
"createmultisig": {},
|
||||||
"dumpprivkey": struct{}{},
|
"dumpprivkey": {},
|
||||||
"dumpwallet": struct{}{},
|
"dumpwallet": {},
|
||||||
"encryptwallet": struct{}{},
|
"encryptwallet": {},
|
||||||
"getaccount": struct{}{},
|
"getaccount": {},
|
||||||
"getaccountaddress": struct{}{},
|
"getaccountaddress": {},
|
||||||
"getaddressesbyaccount": struct{}{},
|
"getaddressesbyaccount": {},
|
||||||
"getbalance": struct{}{},
|
"getbalance": {},
|
||||||
"getnewaddress": struct{}{},
|
"getnewaddress": {},
|
||||||
"getrawchangeaddress": struct{}{},
|
"getrawchangeaddress": {},
|
||||||
"getreceivedbyaccount": struct{}{},
|
"getreceivedbyaccount": {},
|
||||||
"getreceivedbyaddress": struct{}{},
|
"getreceivedbyaddress": {},
|
||||||
"gettransaction": struct{}{},
|
"gettransaction": {},
|
||||||
"gettxoutsetinfo": struct{}{},
|
"gettxoutsetinfo": {},
|
||||||
"getunconfirmedbalance": struct{}{},
|
"getunconfirmedbalance": {},
|
||||||
"getwalletinfo": struct{}{},
|
"getwalletinfo": {},
|
||||||
"importprivkey": struct{}{},
|
"importprivkey": {},
|
||||||
"importwallet": struct{}{},
|
"importwallet": {},
|
||||||
"keypoolrefill": struct{}{},
|
"keypoolrefill": {},
|
||||||
"listaccounts": struct{}{},
|
"listaccounts": {},
|
||||||
"listaddressgroupings": struct{}{},
|
"listaddressgroupings": {},
|
||||||
"listlockunspent": struct{}{},
|
"listlockunspent": {},
|
||||||
"listreceivedbyaccount": struct{}{},
|
"listreceivedbyaccount": {},
|
||||||
"listreceivedbyaddress": struct{}{},
|
"listreceivedbyaddress": {},
|
||||||
"listsinceblock": struct{}{},
|
"listsinceblock": {},
|
||||||
"listtransactions": struct{}{},
|
"listtransactions": {},
|
||||||
"listunspent": struct{}{},
|
"listunspent": {},
|
||||||
"lockunspent": struct{}{},
|
"lockunspent": {},
|
||||||
"move": struct{}{},
|
"move": {},
|
||||||
"sendfrom": struct{}{},
|
"sendfrom": {},
|
||||||
"sendmany": struct{}{},
|
"sendmany": {},
|
||||||
"sendtoaddress": struct{}{},
|
"sendtoaddress": {},
|
||||||
"setaccount": struct{}{},
|
"setaccount": {},
|
||||||
"settxfee": struct{}{},
|
"settxfee": {},
|
||||||
"signmessage": struct{}{},
|
"signmessage": {},
|
||||||
"signrawtransaction": struct{}{},
|
"signrawtransaction": {},
|
||||||
"walletlock": struct{}{},
|
"walletlock": {},
|
||||||
"walletpassphrase": struct{}{},
|
"walletpassphrase": {},
|
||||||
"walletpassphrasechange": struct{}{},
|
"walletpassphrasechange": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commands that are currently unimplemented, but should ultimately be.
|
// Commands that are currently unimplemented, but should ultimately be.
|
||||||
var rpcUnimplemented = map[string]struct{}{
|
var rpcUnimplemented = map[string]struct{}{
|
||||||
"estimatefee": struct{}{},
|
"estimatefee": {},
|
||||||
"estimatepriority": struct{}{},
|
"estimatepriority": {},
|
||||||
"getblockchaininfo": struct{}{},
|
"getblockchaininfo": {},
|
||||||
"getchaintips": struct{}{},
|
"getchaintips": {},
|
||||||
"getnetworkinfo": struct{}{},
|
"getnetworkinfo": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commands that are available to a limited user
|
// Commands that are available to a limited user
|
||||||
var rpcLimited = map[string]struct{}{
|
var rpcLimited = map[string]struct{}{
|
||||||
// Websockets commands
|
// Websockets commands
|
||||||
"notifyblocks": struct{}{},
|
"notifyblocks": {},
|
||||||
"notifynewtransactions": struct{}{},
|
"notifynewtransactions": {},
|
||||||
"notifyreceived": struct{}{},
|
"notifyreceived": {},
|
||||||
"notifyspent": struct{}{},
|
"notifyspent": {},
|
||||||
"rescan": struct{}{},
|
"rescan": {},
|
||||||
"session": struct{}{},
|
"session": {},
|
||||||
|
|
||||||
// Websockets AND HTTP/S commands
|
// Websockets AND HTTP/S commands
|
||||||
"help": struct{}{},
|
"help": {},
|
||||||
|
|
||||||
// HTTP/S-only commands
|
// HTTP/S-only commands
|
||||||
"createrawtransaction": struct{}{},
|
"createrawtransaction": {},
|
||||||
"decoderawtransaction": struct{}{},
|
"decoderawtransaction": {},
|
||||||
"decodescript": struct{}{},
|
"decodescript": {},
|
||||||
"getbestblock": struct{}{},
|
"getbestblock": {},
|
||||||
"getbestblockhash": struct{}{},
|
"getbestblockhash": {},
|
||||||
"getblock": struct{}{},
|
"getblock": {},
|
||||||
"getblockcount": struct{}{},
|
"getblockcount": {},
|
||||||
"getblockhash": struct{}{},
|
"getblockhash": {},
|
||||||
"getcurrentnet": struct{}{},
|
"getcurrentnet": {},
|
||||||
"getdifficulty": struct{}{},
|
"getdifficulty": {},
|
||||||
"getinfo": struct{}{},
|
"getinfo": {},
|
||||||
"getnettotals": struct{}{},
|
"getnettotals": {},
|
||||||
"getnetworkhashps": struct{}{},
|
"getnetworkhashps": {},
|
||||||
"getrawmempool": struct{}{},
|
"getrawmempool": {},
|
||||||
"getrawtransaction": struct{}{},
|
"getrawtransaction": {},
|
||||||
"gettxout": struct{}{},
|
"gettxout": {},
|
||||||
"searchrawtransactions": struct{}{},
|
"searchrawtransactions": {},
|
||||||
"sendrawtransaction": struct{}{},
|
"sendrawtransaction": {},
|
||||||
"submitblock": struct{}{},
|
"submitblock": {},
|
||||||
"validateaddress": struct{}{},
|
"validateaddress": {},
|
||||||
"verifymessage": struct{}{},
|
"verifymessage": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// builderScript is a convenience function which is used for hard-coded scripts
|
// builderScript is a convenience function which is used for hard-coded scripts
|
||||||
|
|
|
@ -582,48 +582,48 @@ var helpDescsEnUS = map[string]string{
|
||||||
// pointer to the type (or nil to indicate no return value).
|
// pointer to the type (or nil to indicate no return value).
|
||||||
var rpcResultTypes = map[string][]interface{}{
|
var rpcResultTypes = map[string][]interface{}{
|
||||||
"addnode": nil,
|
"addnode": nil,
|
||||||
"createrawtransaction": []interface{}{(*string)(nil)},
|
"createrawtransaction": {(*string)(nil)},
|
||||||
"debuglevel": []interface{}{(*string)(nil), (*string)(nil)},
|
"debuglevel": {(*string)(nil), (*string)(nil)},
|
||||||
"decoderawtransaction": []interface{}{(*btcjson.TxRawDecodeResult)(nil)},
|
"decoderawtransaction": {(*btcjson.TxRawDecodeResult)(nil)},
|
||||||
"decodescript": []interface{}{(*btcjson.DecodeScriptResult)(nil)},
|
"decodescript": {(*btcjson.DecodeScriptResult)(nil)},
|
||||||
"generate": []interface{}{(*[]string)(nil)},
|
"generate": {(*[]string)(nil)},
|
||||||
"getaddednodeinfo": []interface{}{(*[]string)(nil), (*[]btcjson.GetAddedNodeInfoResult)(nil)},
|
"getaddednodeinfo": {(*[]string)(nil), (*[]btcjson.GetAddedNodeInfoResult)(nil)},
|
||||||
"getbestblock": []interface{}{(*btcjson.GetBestBlockResult)(nil)},
|
"getbestblock": {(*btcjson.GetBestBlockResult)(nil)},
|
||||||
"getbestblockhash": []interface{}{(*string)(nil)},
|
"getbestblockhash": {(*string)(nil)},
|
||||||
"getblock": []interface{}{(*string)(nil), (*btcjson.GetBlockVerboseResult)(nil)},
|
"getblock": {(*string)(nil), (*btcjson.GetBlockVerboseResult)(nil)},
|
||||||
"getblockcount": []interface{}{(*int64)(nil)},
|
"getblockcount": {(*int64)(nil)},
|
||||||
"getblockhash": []interface{}{(*string)(nil)},
|
"getblockhash": {(*string)(nil)},
|
||||||
"getblockheader": []interface{}{(*string)(nil), (*btcjson.GetBlockHeaderVerboseResult)(nil)},
|
"getblockheader": {(*string)(nil), (*btcjson.GetBlockHeaderVerboseResult)(nil)},
|
||||||
"getblocktemplate": []interface{}{(*btcjson.GetBlockTemplateResult)(nil), (*string)(nil), nil},
|
"getblocktemplate": {(*btcjson.GetBlockTemplateResult)(nil), (*string)(nil), nil},
|
||||||
"getconnectioncount": []interface{}{(*int32)(nil)},
|
"getconnectioncount": {(*int32)(nil)},
|
||||||
"getcurrentnet": []interface{}{(*uint32)(nil)},
|
"getcurrentnet": {(*uint32)(nil)},
|
||||||
"getdifficulty": []interface{}{(*float64)(nil)},
|
"getdifficulty": {(*float64)(nil)},
|
||||||
"getgenerate": []interface{}{(*bool)(nil)},
|
"getgenerate": {(*bool)(nil)},
|
||||||
"gethashespersec": []interface{}{(*float64)(nil)},
|
"gethashespersec": {(*float64)(nil)},
|
||||||
"getinfo": []interface{}{(*btcjson.InfoChainResult)(nil)},
|
"getinfo": {(*btcjson.InfoChainResult)(nil)},
|
||||||
"getmempoolinfo": []interface{}{(*btcjson.GetMempoolInfoResult)(nil)},
|
"getmempoolinfo": {(*btcjson.GetMempoolInfoResult)(nil)},
|
||||||
"getmininginfo": []interface{}{(*btcjson.GetMiningInfoResult)(nil)},
|
"getmininginfo": {(*btcjson.GetMiningInfoResult)(nil)},
|
||||||
"getnettotals": []interface{}{(*btcjson.GetNetTotalsResult)(nil)},
|
"getnettotals": {(*btcjson.GetNetTotalsResult)(nil)},
|
||||||
"getnetworkhashps": []interface{}{(*int64)(nil)},
|
"getnetworkhashps": {(*int64)(nil)},
|
||||||
"getpeerinfo": []interface{}{(*[]btcjson.GetPeerInfoResult)(nil)},
|
"getpeerinfo": {(*[]btcjson.GetPeerInfoResult)(nil)},
|
||||||
"getrawmempool": []interface{}{(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)},
|
"getrawmempool": {(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)},
|
||||||
"getrawtransaction": []interface{}{(*string)(nil), (*btcjson.TxRawResult)(nil)},
|
"getrawtransaction": {(*string)(nil), (*btcjson.TxRawResult)(nil)},
|
||||||
"gettxout": []interface{}{(*btcjson.GetTxOutResult)(nil)},
|
"gettxout": {(*btcjson.GetTxOutResult)(nil)},
|
||||||
"getwork": []interface{}{(*btcjson.GetWorkResult)(nil), (*bool)(nil)},
|
"getwork": {(*btcjson.GetWorkResult)(nil), (*bool)(nil)},
|
||||||
"node": nil,
|
"node": nil,
|
||||||
"help": []interface{}{(*string)(nil), (*string)(nil)},
|
"help": {(*string)(nil), (*string)(nil)},
|
||||||
"ping": nil,
|
"ping": nil,
|
||||||
"searchrawtransactions": []interface{}{(*string)(nil), (*[]btcjson.SearchRawTransactionsResult)(nil)},
|
"searchrawtransactions": {(*string)(nil), (*[]btcjson.SearchRawTransactionsResult)(nil)},
|
||||||
"sendrawtransaction": []interface{}{(*string)(nil)},
|
"sendrawtransaction": {(*string)(nil)},
|
||||||
"setgenerate": nil,
|
"setgenerate": nil,
|
||||||
"stop": []interface{}{(*string)(nil)},
|
"stop": {(*string)(nil)},
|
||||||
"submitblock": []interface{}{nil, (*string)(nil)},
|
"submitblock": {nil, (*string)(nil)},
|
||||||
"validateaddress": []interface{}{(*btcjson.ValidateAddressChainResult)(nil)},
|
"validateaddress": {(*btcjson.ValidateAddressChainResult)(nil)},
|
||||||
"verifychain": []interface{}{(*bool)(nil)},
|
"verifychain": {(*bool)(nil)},
|
||||||
"verifymessage": []interface{}{(*bool)(nil)},
|
"verifymessage": {(*bool)(nil)},
|
||||||
|
|
||||||
// Websocket commands.
|
// Websocket commands.
|
||||||
"session": []interface{}{(*btcjson.SessionResult)(nil)},
|
"session": {(*btcjson.SessionResult)(nil)},
|
||||||
"notifyblocks": nil,
|
"notifyblocks": nil,
|
||||||
"stopnotifyblocks": nil,
|
"stopnotifyblocks": nil,
|
||||||
"notifynewtransactions": nil,
|
"notifynewtransactions": nil,
|
||||||
|
|
|
@ -67,7 +67,7 @@ var wsHandlersBeforeInit = map[string]wsCommandHandler{
|
||||||
// operations to run concurrently (and one at a time) while still responding
|
// operations to run concurrently (and one at a time) while still responding
|
||||||
// to the majority of normal requests which can be answered quickly.
|
// to the majority of normal requests which can be answered quickly.
|
||||||
var wsAsyncHandlers = map[string]struct{}{
|
var wsAsyncHandlers = map[string]struct{}{
|
||||||
"rescan": struct{}{},
|
"rescan": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebsocketHandler handles a new websocket client by creating a new wsClient,
|
// WebsocketHandler handles a new websocket client by creating a new wsClient,
|
||||||
|
|
|
@ -104,21 +104,21 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
tx := &wire.MsgTx{
|
tx := &wire.MsgTx{
|
||||||
Version: 1,
|
Version: 1,
|
||||||
TxIn: []*wire.TxIn{
|
TxIn: []*wire.TxIn{
|
||||||
&wire.TxIn{
|
{
|
||||||
PreviousOutPoint: wire.OutPoint{
|
PreviousOutPoint: wire.OutPoint{
|
||||||
Hash: wire.ShaHash{},
|
Hash: wire.ShaHash{},
|
||||||
Index: 0,
|
Index: 0,
|
||||||
},
|
},
|
||||||
Sequence: 4294967295,
|
Sequence: 4294967295,
|
||||||
},
|
},
|
||||||
&wire.TxIn{
|
{
|
||||||
PreviousOutPoint: wire.OutPoint{
|
PreviousOutPoint: wire.OutPoint{
|
||||||
Hash: wire.ShaHash{},
|
Hash: wire.ShaHash{},
|
||||||
Index: 1,
|
Index: 1,
|
||||||
},
|
},
|
||||||
Sequence: 4294967295,
|
Sequence: 4294967295,
|
||||||
},
|
},
|
||||||
&wire.TxIn{
|
{
|
||||||
PreviousOutPoint: wire.OutPoint{
|
PreviousOutPoint: wire.OutPoint{
|
||||||
Hash: wire.ShaHash{},
|
Hash: wire.ShaHash{},
|
||||||
Index: 2,
|
Index: 2,
|
||||||
|
@ -127,13 +127,13 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
TxOut: []*wire.TxOut{
|
TxOut: []*wire.TxOut{
|
||||||
&wire.TxOut{
|
{
|
||||||
Value: 1,
|
Value: 1,
|
||||||
},
|
},
|
||||||
&wire.TxOut{
|
{
|
||||||
Value: 2,
|
Value: 2,
|
||||||
},
|
},
|
||||||
&wire.TxOut{
|
{
|
||||||
Value: 3,
|
Value: 3,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1642,7 +1642,7 @@ nexttest:
|
||||||
output := wire.NewTxOut(500, []byte{txscript.OP_RETURN})
|
output := wire.NewTxOut(500, []byte{txscript.OP_RETURN})
|
||||||
tx.AddTxOut(output)
|
tx.AddTxOut(output)
|
||||||
|
|
||||||
for _ = range sigScriptTests[i].inputs {
|
for range sigScriptTests[i].inputs {
|
||||||
txin := wire.NewTxIn(coinbaseOutPoint, nil)
|
txin := wire.NewTxIn(coinbaseOutPoint, nil)
|
||||||
tx.AddTxIn(txin)
|
tx.AddTxIn(txin)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue