Update for recent btcjson changes.
This commit updates the types to match the recent changes to the btcjson result types.
This commit is contained in:
parent
0c9c005c33
commit
1db0eb4fec
2 changed files with 12 additions and 12 deletions
16
rpcserver.go
16
rpcserver.go
|
@ -828,7 +828,7 @@ func createVoutList(mtx *btcwire.MsgTx, net *btcnet.Params) ([]btcjson.Vout, err
|
|||
// it anyways.
|
||||
scriptClass, addrs, reqSigs, _ := btcscript.ExtractPkScriptAddrs(v.PkScript, net)
|
||||
voutList[i].ScriptPubKey.Type = scriptClass.String()
|
||||
voutList[i].ScriptPubKey.ReqSigs = reqSigs
|
||||
voutList[i].ScriptPubKey.ReqSigs = int32(reqSigs)
|
||||
|
||||
if addrs == nil {
|
||||
voutList[i].ScriptPubKey.Addresses = nil
|
||||
|
@ -973,7 +973,7 @@ func handleDecodeScript(s *rpcServer, cmd btcjson.Cmd, closeChan <-chan struct{}
|
|||
// Generate and return the reply.
|
||||
reply := btcjson.DecodeScriptResult{
|
||||
Asm: disbuf,
|
||||
ReqSigs: reqSigs,
|
||||
ReqSigs: int32(reqSigs),
|
||||
Type: scriptClass.String(),
|
||||
Addresses: addresses,
|
||||
P2sh: p2sh.EncodeAddress(),
|
||||
|
@ -1142,7 +1142,7 @@ func handleGetBlock(s *rpcServer, cmd btcjson.Cmd, closeChan <-chan struct{}) (i
|
|||
Time: blockHeader.Timestamp.Unix(),
|
||||
Confirmations: uint64(1 + maxidx - idx),
|
||||
Height: idx,
|
||||
Size: len(buf),
|
||||
Size: int32(len(buf)),
|
||||
Bits: strconv.FormatInt(int64(blockHeader.Bits), 16),
|
||||
Difficulty: getDifficultyRatio(blockHeader.Bits),
|
||||
}
|
||||
|
@ -1262,9 +1262,9 @@ func handleGetInfo(s *rpcServer, cmd btcjson.Cmd, closeChan <-chan struct{}) (in
|
|||
}
|
||||
|
||||
ret := &btcjson.InfoResult{
|
||||
Version: int(1000000*appMajor + 10000*appMinor + 100*appPatch),
|
||||
ProtocolVersion: int(maxProtocolVersion),
|
||||
Blocks: int(height),
|
||||
Version: int32(1000000*appMajor + 10000*appMinor + 100*appPatch),
|
||||
ProtocolVersion: int32(maxProtocolVersion),
|
||||
Blocks: int32(height),
|
||||
TimeOffset: 0,
|
||||
Connections: s.server.ConnectedCount(),
|
||||
Proxy: cfg.Proxy,
|
||||
|
@ -1327,7 +1327,7 @@ func handleGetMiningInfo(s *rpcServer, cmd btcjson.Cmd, closeChan <-chan struct{
|
|||
CurrentBlockTx: uint64(len(block.MsgBlock().Transactions)),
|
||||
Difficulty: getDifficultyRatio(block.MsgBlock().Header.Bits),
|
||||
Generate: s.server.cpuMiner.IsMining(),
|
||||
GenProcLimit: int(s.server.cpuMiner.NumWorkers()),
|
||||
GenProcLimit: s.server.cpuMiner.NumWorkers(),
|
||||
HashesPerSec: int64(s.server.cpuMiner.HashesPerSecond()),
|
||||
NetworkHashPS: networkHashesPerSec,
|
||||
PooledTx: uint64(s.server.txMemPool.Count()),
|
||||
|
@ -1449,7 +1449,7 @@ func handleGetRawMempool(s *rpcServer, cmd btcjson.Cmd, closeChan <-chan struct{
|
|||
result := make(map[string]*btcjson.GetRawMempoolResult, len(descs))
|
||||
for _, desc := range descs {
|
||||
mpd := &btcjson.GetRawMempoolResult{
|
||||
Size: desc.Tx.MsgTx().SerializeSize(),
|
||||
Size: int32(desc.Tx.MsgTx().SerializeSize()),
|
||||
Fee: float64(desc.Fee) /
|
||||
float64(btcutil.SatoshiPerBitcoin),
|
||||
Time: desc.Added.Unix(),
|
||||
|
|
|
@ -317,7 +317,7 @@ func (s *server) handleBroadcastMsg(state *peerState, bmsg *broadcastMsg) {
|
|||
}
|
||||
|
||||
type getConnCountMsg struct {
|
||||
reply chan int
|
||||
reply chan int32
|
||||
}
|
||||
|
||||
type getPeerInfoMsg struct {
|
||||
|
@ -344,7 +344,7 @@ type getAddedNodesMsg struct {
|
|||
func (s *server) handleQuery(querymsg interface{}, state *peerState) {
|
||||
switch msg := querymsg.(type) {
|
||||
case getConnCountMsg:
|
||||
nconnected := 0
|
||||
nconnected := int32(0)
|
||||
state.forAllPeers(func(p *peer) {
|
||||
if p.Connected() {
|
||||
nconnected++
|
||||
|
@ -694,8 +694,8 @@ func (s *server) BroadcastMessage(msg btcwire.Message, exclPeers ...*peer) {
|
|||
}
|
||||
|
||||
// ConnectedCount returns the number of currently connected peers.
|
||||
func (s *server) ConnectedCount() int {
|
||||
replyChan := make(chan int)
|
||||
func (s *server) ConnectedCount() int32 {
|
||||
replyChan := make(chan int32)
|
||||
|
||||
s.query <- getConnCountMsg{reply: replyChan}
|
||||
|
||||
|
|
Loading…
Reference in a new issue