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