Remove dead code. Tighten definition of TransactionBroadcastReq.
This commit is contained in:
parent
8f6a8db681
commit
5e977e59a2
2 changed files with 1 additions and 35 deletions
|
@ -705,7 +705,7 @@ func (s *BlockchainScripthashService) Unsubscribe(req *ScripthashSubscribeReq, r
|
|||
return nil
|
||||
}
|
||||
|
||||
type TransactionBroadcastReq []string
|
||||
type TransactionBroadcastReq [1]string
|
||||
type TransactionBroadcastResp string
|
||||
|
||||
// 'blockchain.transaction.broadcast'
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"hash"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
golog "log"
|
||||
"net"
|
||||
|
@ -242,38 +240,6 @@ func LoadDatabase(args *Args, grp *stop.Group) (*db.ReadOnlyDBColumnFamily, erro
|
|||
return myDB, nil
|
||||
}
|
||||
|
||||
type BasicAuthClientCodec struct {
|
||||
client http.Client
|
||||
url string
|
||||
user string
|
||||
password string
|
||||
buff *bytes.Buffer
|
||||
}
|
||||
|
||||
func (c BasicAuthClientCodec) Read(p []byte) (n int, err error) {
|
||||
return c.buff.Read(p)
|
||||
}
|
||||
|
||||
func (c BasicAuthClientCodec) Write(p []byte) (n int, err error) {
|
||||
req, err := http.NewRequest("POST", c.url, bytes.NewReader(p))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
req.SetBasicAuth(c.user, c.password)
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
resp, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return len(p), err
|
||||
}
|
||||
io.Copy(c.buff, resp.Body)
|
||||
return len(p), err
|
||||
}
|
||||
|
||||
func (c BasicAuthClientCodec) Close() error {
|
||||
c.client.CloseIdleConnections()
|
||||
return nil
|
||||
}
|
||||
|
||||
// MakeHubServer takes the arguments given to a hub when it's started and
|
||||
// initializes everything. It loads information about previously known peers,
|
||||
// creates needed internal data structures, and initializes goroutines.
|
||||
|
|
Loading…
Reference in a new issue