Fix issues found by golint.
This commit is contained in:
parent
2541ffae76
commit
9b84f87930
3 changed files with 13 additions and 13 deletions
16
cmd.go
16
cmd.go
|
@ -215,7 +215,7 @@ func getCurHeight() (height int64) {
|
||||||
return height
|
return height
|
||||||
}
|
}
|
||||||
|
|
||||||
n := <-NewJsonID
|
n := <-NewJSONID
|
||||||
m, err := btcjson.CreateMessageWithId("getblockcount",
|
m, err := btcjson.CreateMessageWithId("getblockcount",
|
||||||
fmt.Sprintf("btcwallet(%v)", n))
|
fmt.Sprintf("btcwallet(%v)", n))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -281,7 +281,7 @@ func (w *BtcWallet) CalculateBalance(confirmations int) float64 {
|
||||||
// each address stored in a wallet and sets up a new reply handler for
|
// each address stored in a wallet and sets up a new reply handler for
|
||||||
// these notifications.
|
// these notifications.
|
||||||
func (w *BtcWallet) Track() {
|
func (w *BtcWallet) Track() {
|
||||||
n := <-NewJsonID
|
n := <-NewJSONID
|
||||||
w.mtx.Lock()
|
w.mtx.Lock()
|
||||||
w.NewBlockTxSeqN = n
|
w.NewBlockTxSeqN = n
|
||||||
w.mtx.Unlock()
|
w.mtx.Unlock()
|
||||||
|
@ -302,7 +302,7 @@ func (w *BtcWallet) Track() {
|
||||||
// blocks[0]. If len(blocks) is 2 or greater, the rescan will be
|
// blocks[0]. If len(blocks) is 2 or greater, the rescan will be
|
||||||
// performed for the block range blocks[0]...blocks[1] (inclusive).
|
// performed for the block range blocks[0]...blocks[1] (inclusive).
|
||||||
func (w *BtcWallet) RescanForAddress(addr string, blocks ...int) {
|
func (w *BtcWallet) RescanForAddress(addr string, blocks ...int) {
|
||||||
n := <-NewJsonID
|
n := <-NewJSONID
|
||||||
params := []interface{}{addr}
|
params := []interface{}{addr}
|
||||||
if len(blocks) > 0 {
|
if len(blocks) > 0 {
|
||||||
params = append(params, blocks[0])
|
params = append(params, blocks[0])
|
||||||
|
@ -481,15 +481,15 @@ func (w *BtcWallet) newBlockTxHandler(result interface{}, e *btcjson.Error) bool
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewJsonID is used to receive the next unique JSON ID for btcd
|
// NewJSONID is used to receive the next unique JSON ID for btcd
|
||||||
// requests, starting from zero and incrementing by one after each
|
// requests, starting from zero and incrementing by one after each
|
||||||
// read.
|
// read.
|
||||||
var NewJsonID = make(chan uint64)
|
var NewJSONID = make(chan uint64)
|
||||||
|
|
||||||
// JsonIDGenerator sends incremental integers across a channel. This
|
// JSONIDGenerator sends incremental integers across a channel. This
|
||||||
// is meant to provide a unique value for the JSON ID field for btcd
|
// is meant to provide a unique value for the JSON ID field for btcd
|
||||||
// messages.
|
// messages.
|
||||||
func JsonIDGenerator(c chan uint64) {
|
func JSONIDGenerator(c chan uint64) {
|
||||||
var n uint64
|
var n uint64
|
||||||
for {
|
for {
|
||||||
c <- n
|
c <- n
|
||||||
|
@ -528,7 +528,7 @@ func main() {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Begin generating new IDs for JSON calls.
|
// Begin generating new IDs for JSON calls.
|
||||||
go JsonIDGenerator(NewJsonID)
|
go JSONIDGenerator(NewJSONID)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
replies := make(chan error)
|
replies := make(chan error)
|
||||||
|
|
|
@ -170,7 +170,7 @@ func ProcessFrontendMsg(reply chan []byte, msg []byte) {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// btcwallet does not understand method. Pass to btcd.
|
// btcwallet does not understand method. Pass to btcd.
|
||||||
n := <-NewJsonID
|
n := <-NewJSONID
|
||||||
var id interface{} = fmt.Sprintf("btcwallet(%v)-%v", n,
|
var id interface{} = fmt.Sprintf("btcwallet(%v)-%v", n,
|
||||||
jsonMsg.Id)
|
jsonMsg.Id)
|
||||||
jsonMsg.Id = &id
|
jsonMsg.Id = &id
|
||||||
|
@ -465,7 +465,7 @@ func SendFrom(reply chan []byte, msg *btcjson.Message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send rawtx off to btcd
|
// Send rawtx off to btcd
|
||||||
n := <-NewJsonID
|
n := <-NewJSONID
|
||||||
var id interface{} = fmt.Sprintf("btcwallet(%v)", n)
|
var id interface{} = fmt.Sprintf("btcwallet(%v)", n)
|
||||||
m, err := btcjson.CreateMessageWithId("sendrawtransaction", id,
|
m, err := btcjson.CreateMessageWithId("sendrawtransaction", id,
|
||||||
hex.EncodeToString(rawtx))
|
hex.EncodeToString(rawtx))
|
||||||
|
@ -609,7 +609,7 @@ func SendMany(reply chan []byte, msg *btcjson.Message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send rawtx off to btcd
|
// Send rawtx off to btcd
|
||||||
n := <-NewJsonID
|
n := <-NewJSONID
|
||||||
var id interface{} = fmt.Sprintf("btcwallet(%v)", n)
|
var id interface{} = fmt.Sprintf("btcwallet(%v)", n)
|
||||||
m, err := btcjson.CreateMessageWithId("sendrawtransaction", id,
|
m, err := btcjson.CreateMessageWithId("sendrawtransaction", id,
|
||||||
hex.EncodeToString(rawtx))
|
hex.EncodeToString(rawtx))
|
||||||
|
@ -764,7 +764,7 @@ func CreateEncryptedWallet(reply chan []byte, msg *btcjson.Message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab a new unique sequence number for tx notifications in new blocks.
|
// Grab a new unique sequence number for tx notifications in new blocks.
|
||||||
n := <-NewJsonID
|
n := <-NewJSONID
|
||||||
bw := &BtcWallet{
|
bw := &BtcWallet{
|
||||||
Wallet: w,
|
Wallet: w,
|
||||||
name: wname,
|
name: wname,
|
||||||
|
|
|
@ -493,7 +493,7 @@ func BtcdConnect(reply chan error) {
|
||||||
// Bitcoin networks). If the sanity checks pass, all wallets are set to
|
// Bitcoin networks). If the sanity checks pass, all wallets are set to
|
||||||
// be tracked against chain notifications from this btcd connection.
|
// be tracked against chain notifications from this btcd connection.
|
||||||
func BtcdHandshake(ws *websocket.Conn) {
|
func BtcdHandshake(ws *websocket.Conn) {
|
||||||
n := <-NewJsonID
|
n := <-NewJSONID
|
||||||
msg := btcjson.Message{
|
msg := btcjson.Message{
|
||||||
Method: "getcurrentnet",
|
Method: "getcurrentnet",
|
||||||
Id: fmt.Sprintf("btcwallet(%v)", n),
|
Id: fmt.Sprintf("btcwallet(%v)", n),
|
||||||
|
|
Loading…
Reference in a new issue