@@ -36,11 +36,13 @@ txindex=1
|
||||
|
||||
#### 3. Run the frontend:
|
||||
You'll need to use the certificate generated from step 1
|
||||
|
||||
```
|
||||
go run cmd/server/main.go -bind-addr 127.0.0.1:9069 -conf-file ~/.komodo/HUSH3/HUSH3.conf -tls-cert cert.pem -tls-key key.pem
|
||||
go run cmd/server/main.go -bind-addr 127.0.0.1:9067 -conf-file ~/.komodo/HUSH3/HUSH3.conf -tls-cert cert.pem -tls-key key.pem
|
||||
|
||||
```
|
||||
|
||||
#### 4. Point the `silentdragon-cli` to this server
|
||||
```
|
||||
./silentdragon-cli --server https://127.0.0.1:9069 --dangerous
|
||||
./silentdragon-cli --server https://127.0.0.1:9067 --dangerous
|
||||
```
|
||||
|
||||
@@ -168,14 +168,14 @@ func main() {
|
||||
}
|
||||
|
||||
// Get the sapling activation height from the RPC
|
||||
saplingHeight, blockHeight, chainName, branchID, err := common.GetSaplingInfo(rpcClient)
|
||||
saplingHeight, blockHeight, chainName, branchID, difficulty, longestchain, notarized, err := common.GetSaplingInfo(rpcClient)
|
||||
if err != nil {
|
||||
log.WithFields(logrus.Fields{
|
||||
"error": err,
|
||||
}).Warn("Unable to get sapling activation height")
|
||||
}
|
||||
|
||||
log.Info("Got sapling height ", saplingHeight, " chain ", chainName, " branchID ", branchID)
|
||||
log.Info("Got sapling height ", saplingHeight, " chain ", chainName, " branchID ", branchID," difficulty ", difficulty,longestchain, " longestchain ",notarized," notarized ")
|
||||
|
||||
// Initialize the cache
|
||||
cache := common.NewBlockCache(opts.cacheSize)
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, error) {
|
||||
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, int,int,int, error) {
|
||||
result, rpcErr := rpcClient.RawRequest("getblockchaininfo", make([]json.RawMessage, 0))
|
||||
|
||||
var err error
|
||||
@@ -27,15 +27,15 @@ func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, erro
|
||||
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
||||
//Check to see if we are requesting a height the hushd doesn't have yet
|
||||
if err == nil && errCode == -8 {
|
||||
return -1, -1, "", "", nil
|
||||
return -1, -1, "", "",-1,-1,-1, nil
|
||||
}
|
||||
return -1, -1, "", "", errors.Wrap(rpcErr, "error requesting block")
|
||||
return -1, -1, "", "",-1,-1,-1, errors.Wrap(rpcErr, "error requesting block")
|
||||
}
|
||||
|
||||
var f interface{}
|
||||
err = json.Unmarshal(result, &f)
|
||||
if err != nil {
|
||||
return -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)
|
||||
@@ -45,11 +45,14 @@ func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, erro
|
||||
saplingHeight := saplingJSON.(map[string]interface{})["activationheight"].(float64)
|
||||
|
||||
blockHeight := f.(map[string]interface{})["headers"].(float64)
|
||||
difficulty := f.(map[string]interface{})["difficulty"].(float64)
|
||||
longestchain := f.(map[string]interface{})["longestchain"].(float64)
|
||||
notarized := f.(map[string]interface{})["notarized"].(float64)
|
||||
|
||||
consensus := f.(map[string]interface{})["consensus"]
|
||||
branchID := consensus.(map[string]interface{})["nextblock"].(string)
|
||||
|
||||
return int(saplingHeight), int(blockHeight), chainName, branchID, nil
|
||||
return int(saplingHeight), int(blockHeight), chainName, branchID, int(difficulty), int(longestchain), int(notarized), nil
|
||||
}
|
||||
|
||||
func getBlockFromRPC(rpcClient *rpcclient.Client, height int) (*walletrpc.CompactBlock, error) {
|
||||
|
||||
@@ -229,7 +229,7 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilte
|
||||
|
||||
// GetLightdInfo gets the LightWalletD (this server) info
|
||||
func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*walletrpc.LightdInfo, error) {
|
||||
saplingHeight, blockHeight, chainName, consensusBranchId, err := common.GetSaplingInfo(s.client)
|
||||
saplingHeight, blockHeight, chainName, consensusBranchId, difficulty, longestchain, notarized, err := common.GetSaplingInfo(s.client)
|
||||
|
||||
if err != nil {
|
||||
s.log.WithFields(logrus.Fields{
|
||||
@@ -242,12 +242,15 @@ func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*
|
||||
// A success will return code 0 and message txhash.
|
||||
return &walletrpc.LightdInfo{
|
||||
Version: "0.1-hushlightd",
|
||||
Vendor: "HushWallet LightWalletD",
|
||||
Vendor: "Silentdragonlite LightWalletD",
|
||||
TaddrSupport: true,
|
||||
ChainName: chainName,
|
||||
SaplingActivationHeight: uint64(saplingHeight),
|
||||
ConsensusBranchId: consensusBranchId,
|
||||
BlockHeight: uint64(blockHeight),
|
||||
Difficulty: uint64(difficulty),
|
||||
Longestchain: uint64(longestchain),
|
||||
Notarized: uint64(notarized),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -347,6 +347,9 @@ type LightdInfo struct {
|
||||
SaplingActivationHeight uint64 `protobuf:"varint,5,opt,name=saplingActivationHeight,proto3" json:"saplingActivationHeight,omitempty"`
|
||||
ConsensusBranchId string `protobuf:"bytes,6,opt,name=consensusBranchId,proto3" json:"consensusBranchId,omitempty"`
|
||||
BlockHeight uint64 `protobuf:"varint,7,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
|
||||
Difficulty uint64 `protobuf:"varint,8,opt,name=difficulty,proto3" json:"difficulty,omitempty"`
|
||||
Longestchain uint64 `protobuf:"varint,9,opt,name=longestchain,proto3" json:"longestchain,omitempty"`
|
||||
Notarized uint64 `protobuf:"varint,10,opt,name=notarized,proto3" json:"notarized,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@@ -418,6 +421,24 @@ func (m *LightdInfo) GetConsensusBranchId() string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
func (m *LightdInfo) Getdifficulty() uint64 {
|
||||
if m != nil {
|
||||
return m.Difficulty
|
||||
}
|
||||
return 0
|
||||
}
|
||||
func (m *LightdInfo) Getlongestchain() uint64 {
|
||||
if m != nil {
|
||||
return m.Longestchain
|
||||
}
|
||||
return 0
|
||||
}
|
||||
func (m *LightdInfo) Getnotarized() uint64 {
|
||||
if m != nil {
|
||||
return m.Notarized
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *LightdInfo) GetBlockHeight() uint64 {
|
||||
if m != nil {
|
||||
|
||||
@@ -52,6 +52,9 @@ message LightdInfo {
|
||||
uint64 saplingActivationHeight = 5;
|
||||
string consensusBranchId = 6; // This should really be u32 or []byte, but string for readability
|
||||
uint64 blockHeight = 7;
|
||||
uint64 difficulty = 8;
|
||||
uint64 longestchain = 9;
|
||||
uint64 notarized = 10;
|
||||
}
|
||||
|
||||
message TransparentAddress {
|
||||
|
||||
Reference in New Issue
Block a user