Merge pull request 'changed DenioD's github lightwalletd links to git.hush.is lightwalletd links' (#2) from jahway603/lightwalletd:master into master
Reviewed-on: https://git.hush.is/hush/lightwalletd/pulls/2
This commit is contained in:
@@ -15,9 +15,9 @@ import (
|
|||||||
"google.golang.org/grpc/peer"
|
"google.golang.org/grpc/peer"
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
|
|
||||||
"github.com/DenioD/lightwalletd/common"
|
"git.hush.is/hush/lightwalletd/common"
|
||||||
"github.com/DenioD/lightwalletd/frontend"
|
"git.hush.is/hush/lightwalletd/frontend"
|
||||||
"github.com/DenioD/lightwalletd/walletrpc"
|
"git.hush.is/hush/lightwalletd/walletrpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log *logrus.Entry
|
var log *logrus.Entry
|
||||||
@@ -177,7 +177,7 @@ func main() {
|
|||||||
}).Warn("Unable to get sapling activation height")
|
}).Warn("Unable to get sapling activation height")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Got sapling height ", saplingHeight, " chain ", chainName, " branchID ", branchID," difficulty ", difficulty,longestchain, " longestchain ",notarized," notarized ")
|
log.Info("Got sapling height ", saplingHeight, " chain ", chainName, " branchID ", branchID, " difficulty ", difficulty, longestchain, " longestchain ", notarized, " notarized ")
|
||||||
|
|
||||||
// Get the Coinsupply from the RPC
|
// Get the Coinsupply from the RPC
|
||||||
result, coin, height, supply, zfunds, total, err := common.GetCoinsupply(rpcClient)
|
result, coin, height, supply, zfunds, total, err := common.GetCoinsupply(rpcClient)
|
||||||
@@ -187,7 +187,7 @@ func main() {
|
|||||||
}).Warn("Unable to get coinsupply")
|
}).Warn("Unable to get coinsupply")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info( " result ", result, " coin ", coin," height", height, "supply", supply ,"zfunds", zfunds, "total", total)
|
log.Info(" result ", result, " coin ", coin, " height", height, "supply", supply, "zfunds", zfunds, "total", total)
|
||||||
|
|
||||||
// Initialize the cache
|
// Initialize the cache
|
||||||
cache := common.NewBlockCache(opts.cacheSize)
|
cache := common.NewBlockCache(opts.cacheSize)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/DenioD/lightwalletd/walletrpc"
|
"git.hush.is/hush/lightwalletd/walletrpc"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/DenioD/lightwalletd/parser"
|
"git.hush.is/hush/lightwalletd/parser"
|
||||||
"github.com/DenioD/lightwalletd/walletrpc"
|
"git.hush.is/hush/lightwalletd/walletrpc"
|
||||||
"github.com/btcsuite/btcd/rpcclient"
|
"github.com/btcsuite/btcd/rpcclient"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, int,int,int, error) {
|
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, int, int, int, error) {
|
||||||
result, rpcErr := rpcClient.RawRequest("getblockchaininfo", make([]json.RawMessage, 0))
|
result, rpcErr := rpcClient.RawRequest("getblockchaininfo", make([]json.RawMessage, 0))
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
@@ -27,15 +27,15 @@ func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, int,
|
|||||||
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
||||||
//Check to see if we are requesting a height the hushd doesn't have yet
|
//Check to see if we are requesting a height the hushd doesn't have yet
|
||||||
if err == nil && errCode == -8 {
|
if err == nil && errCode == -8 {
|
||||||
return -1, -1, "", "",-1,-1,-1, nil
|
return -1, -1, "", "", -1, -1, -1, nil
|
||||||
}
|
}
|
||||||
return -1, -1, "", "",-1,-1,-1, errors.Wrap(rpcErr, "error requesting block")
|
return -1, -1, "", "", -1, -1, -1, errors.Wrap(rpcErr, "error requesting block")
|
||||||
}
|
}
|
||||||
|
|
||||||
var f interface{}
|
var f interface{}
|
||||||
err = json.Unmarshal(result, &f)
|
err = json.Unmarshal(result, &f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, -1, "", "",-1,-1,-1, errors.Wrap(err, "error reading JSON response")
|
return -1, -1, "", "", -1, -1, -1, errors.Wrap(err, "error reading JSON response")
|
||||||
}
|
}
|
||||||
|
|
||||||
chainName := f.(map[string]interface{})["chain"].(string)
|
chainName := f.(map[string]interface{})["chain"].(string)
|
||||||
@@ -55,28 +55,27 @@ func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, int,
|
|||||||
return int(saplingHeight), int(blockHeight), chainName, branchID, int(difficulty), int(longestchain), int(notarized), nil
|
return int(saplingHeight), int(blockHeight), chainName, branchID, int(difficulty), int(longestchain), int(notarized), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetCoinsupply(rpcClient *rpcclient.Client) (string, string, int, int, int,int, error) {
|
func GetCoinsupply(rpcClient *rpcclient.Client) (string, string, int, int, int, int, error) {
|
||||||
result1, rpcErr := rpcClient.RawRequest("coinsupply", make([]json.RawMessage, 0))
|
result1, rpcErr := rpcClient.RawRequest("coinsupply", make([]json.RawMessage, 0))
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var errCode int64
|
var errCode int64
|
||||||
|
|
||||||
|
|
||||||
// For some reason, the error responses are not JSON
|
// For some reason, the error responses are not JSON
|
||||||
if rpcErr != nil {
|
if rpcErr != nil {
|
||||||
errParts := strings.SplitN(rpcErr.Error(), ":", 2)
|
errParts := strings.SplitN(rpcErr.Error(), ":", 2)
|
||||||
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
||||||
//Check to see if we are requesting a height the hushd doesn't have yet
|
//Check to see if we are requesting a height the hushd doesn't have yet
|
||||||
if err == nil && errCode == -8 {
|
if err == nil && errCode == -8 {
|
||||||
return "","", -1, -1,-1,-1, nil
|
return "", "", -1, -1, -1, -1, nil
|
||||||
}
|
}
|
||||||
return "","", -1, -1,-1,-1, errors.Wrap(rpcErr, "error requesting coinsupply")
|
return "", "", -1, -1, -1, -1, errors.Wrap(rpcErr, "error requesting coinsupply")
|
||||||
}
|
}
|
||||||
|
|
||||||
var f interface{}
|
var f interface{}
|
||||||
err = json.Unmarshal(result1, &f)
|
err = json.Unmarshal(result1, &f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "","", -1, -1,-1,-1, errors.Wrap(err, "error reading JSON response")
|
return "", "", -1, -1, -1, -1, errors.Wrap(err, "error reading JSON response")
|
||||||
}
|
}
|
||||||
|
|
||||||
result := f.(map[string]interface{})["result"].(string)
|
result := f.(map[string]interface{})["result"].(string)
|
||||||
@@ -86,7 +85,7 @@ func GetCoinsupply(rpcClient *rpcclient.Client) (string, string, int, int, int,i
|
|||||||
zfunds := f.(map[string]interface{})["zfunds"].(float64)
|
zfunds := f.(map[string]interface{})["zfunds"].(float64)
|
||||||
total := f.(map[string]interface{})["total"].(float64)
|
total := f.(map[string]interface{})["total"].(float64)
|
||||||
|
|
||||||
return result,coin, int(height), int(supply),int(zfunds), int(total), nil
|
return result, coin, int(height), int(supply), int(zfunds), int(total), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBlockFromRPC(rpcClient *rpcclient.Client, height int) (*walletrpc.CompactBlock, error) {
|
func getBlockFromRPC(rpcClient *rpcclient.Client, height int) (*walletrpc.CompactBlock, error) {
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"regexp"
|
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/rpcclient"
|
"github.com/btcsuite/btcd/rpcclient"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/DenioD/lightwalletd/common"
|
"git.hush.is/hush/lightwalletd/common"
|
||||||
"github.com/DenioD/lightwalletd/walletrpc"
|
"git.hush.is/hush/lightwalletd/walletrpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -71,7 +71,6 @@ func (s *SqlStreamer) GetAddressTxids(addressBlockFilter *walletrpc.TransparentA
|
|||||||
|
|
||||||
result, rpcErr := s.client.RawRequest("getaddresstxids", params)
|
result, rpcErr := s.client.RawRequest("getaddresstxids", params)
|
||||||
|
|
||||||
|
|
||||||
// For some reason, the error responses are not JSON
|
// For some reason, the error responses are not JSON
|
||||||
if rpcErr != nil {
|
if rpcErr != nil {
|
||||||
s.log.Errorf("Got error: %s", rpcErr.Error())
|
s.log.Errorf("Got error: %s", rpcErr.Error())
|
||||||
@@ -265,7 +264,7 @@ func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*
|
|||||||
|
|
||||||
// GetCoinsupply gets the Coinsupply info
|
// GetCoinsupply gets the Coinsupply info
|
||||||
func (s *SqlStreamer) GetCoinsupply(ctx context.Context, in *walletrpc.Empty) (*walletrpc.Coinsupply, error) {
|
func (s *SqlStreamer) GetCoinsupply(ctx context.Context, in *walletrpc.Empty) (*walletrpc.Coinsupply, error) {
|
||||||
result, coin, height, supply, zfunds,total, err := common.GetCoinsupply(s.client)
|
result, coin, height, supply, zfunds, total, err := common.GetCoinsupply(s.client)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.WithFields(logrus.Fields{
|
s.log.WithFields(logrus.Fields{
|
||||||
@@ -286,7 +285,6 @@ func (s *SqlStreamer) GetCoinsupply(ctx context.Context, in *walletrpc.Empty) (*
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SendTransaction forwards raw transaction bytes to a hushd instance over JSON-RPC
|
// SendTransaction forwards raw transaction bytes to a hushd instance over JSON-RPC
|
||||||
func (s *SqlStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawTransaction) (*walletrpc.SendResponse, error) {
|
func (s *SqlStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawTransaction) (*walletrpc.SendResponse, error) {
|
||||||
// sendrawtransaction "hexstring" ( allowhighfees )
|
// sendrawtransaction "hexstring" ( allowhighfees )
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/DenioD/lightwalletd
|
module git.hush.is/hush/lightwalletd
|
||||||
|
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package parser
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"git.hush.is/hush/lightwalletd/parser/internal/bytestring"
|
||||||
|
"git.hush.is/hush/lightwalletd/walletrpc"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/DenioD/lightwalletd/parser/internal/bytestring"
|
|
||||||
"github.com/DenioD/lightwalletd/walletrpc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Block struct {
|
type Block struct {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
|
"git.hush.is/hush/lightwalletd/parser/internal/bytestring"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/DenioD/lightwalletd/parser/internal/bytestring"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package parser
|
|||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
|
||||||
|
"git.hush.is/hush/lightwalletd/parser/internal/bytestring"
|
||||||
|
"git.hush.is/hush/lightwalletd/walletrpc"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/DenioD/lightwalletd/parser/internal/bytestring"
|
|
||||||
"github.com/DenioD/lightwalletd/walletrpc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type rawTransaction struct {
|
type rawTransaction struct {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/DenioD/lightwalletd/parser/internal/bytestring"
|
"git.hush.is/hush/lightwalletd/parser/internal/bytestring"
|
||||||
)
|
)
|
||||||
|
|
||||||
// "Human-readable" version of joinSplit struct defined in transaction.go.
|
// "Human-readable" version of joinSplit struct defined in transaction.go.
|
||||||
|
|||||||
Reference in New Issue
Block a user