Compare commits
9
Commits
latest_btcd
...
v2.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fa28d3d65 | ||
|
|
f8a231286a | ||
|
|
ea5b70e8fc | ||
|
|
26b0c7356d | ||
|
|
7558397877 | ||
|
|
fb7d045753 | ||
|
|
40633c949e | ||
|
|
a17fa3ad5f | ||
|
|
560858ba0a |
No files matched your search
+21
-31
@@ -470,38 +470,28 @@ func (d *Client) Resolve(urls string) (*ResolveResponse, error) {
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
// use resolve?
|
||||
func (d *Client) NumClaimsInChannel(channelClaimID string) (uint64, error) {
|
||||
response := new(NumClaimsInChannelResponse)
|
||||
err := d.call(response, "claim_search", map[string]interface{}{
|
||||
"channel_id": channelClaimID,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
} else if response == nil {
|
||||
return 0, errors.Err("no response")
|
||||
}
|
||||
|
||||
channel, ok := (*response)[uri]
|
||||
if !ok {
|
||||
return 0, errors.Err("url not in response")
|
||||
}
|
||||
if channel.Error != nil {
|
||||
if strings.Contains(*channel.Error, "cannot be resolved") {
|
||||
return 0, nil
|
||||
}
|
||||
return 0, errors.Err(*channel.Error)
|
||||
}
|
||||
return *channel.ClaimsInChannel, nil
|
||||
}
|
||||
*/
|
||||
func (d *Client) ClaimSearch(claimName, claimID, txid *string, nout *uint) (*ClaimSearchResponse, error) {
|
||||
response := new(ClaimSearchResponse)
|
||||
return response, d.call(response, "claim_search", map[string]interface{}{
|
||||
"claim_id": claimID,
|
||||
"txid": txid,
|
||||
"nout": nout,
|
||||
"name": claimName,
|
||||
args := struct {
|
||||
ClaimID *string `json:"claim_id,omitempty"`
|
||||
TXID *string `json:"txid,omitempty"`
|
||||
Nout *uint `json:"nout,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}{
|
||||
ClaimID: claimID,
|
||||
TXID: txid,
|
||||
Nout: nout,
|
||||
Name: claimName,
|
||||
}
|
||||
structs.DefaultTagName = "json"
|
||||
return response, d.call(response, "claim_search", structs.Map(args))
|
||||
}
|
||||
|
||||
func (d *Client) ChannelExport(channelClaimID string, channelName, accountID *string) (*ChannelExportResponse, error) {
|
||||
response := new(ChannelExportResponse)
|
||||
return response, d.call(response, "channel_export", map[string]interface{}{
|
||||
"channel_id": channelClaimID,
|
||||
"channel_name": channelName,
|
||||
"account_id": accountID,
|
||||
})
|
||||
}
|
||||
@@ -402,3 +402,16 @@ func TestClient_AccountRemove(t *testing.T) {
|
||||
t.Error("account was not removed")
|
||||
prettyPrint(*account)
|
||||
}
|
||||
|
||||
func TestClient_ChannelExport(t *testing.T) {
|
||||
d := NewClient("")
|
||||
channelClaimID := "f1ad0d72eae6b471cfd72b7956768c0c191b22d7"
|
||||
response, err := d.ChannelExport(channelClaimID, nil, nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if response == nil || len(*response) == 0 {
|
||||
t.Error("nothing returned!")
|
||||
}
|
||||
t.Log("Export:", *response)
|
||||
}
|
||||
@@ -266,6 +266,7 @@ type AccountFundResponse TransactionSummary
|
||||
type Address string
|
||||
type AddressUnusedResponse Address
|
||||
type AddressListResponse []Address
|
||||
type ChannelExportResponse string
|
||||
|
||||
type ChannelListResponse struct {
|
||||
Items []Transaction `json:"items"`
|
||||
|
||||
+8
-3
@@ -101,8 +101,6 @@ func (s *Group) DoneNamed(name string) {
|
||||
|
||||
if s.waitingOn != nil {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if current, ok := s.waitingOn[name]; ok {
|
||||
if current <= 1 {
|
||||
delete(s.waitingOn, name)
|
||||
@@ -112,9 +110,16 @@ func (s *Group) DoneNamed(name string) {
|
||||
} else {
|
||||
log.Printf("%s is not recorded in stop group map", name)
|
||||
}
|
||||
s.mu.Unlock()
|
||||
s.listWaitingOn()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Group) listWaitingOn() {
|
||||
if s.waitingOn != nil {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
log.Printf("-->> LIST ROUTINES WAITING ON")
|
||||
|
||||
for k, v := range s.waitingOn {
|
||||
if v > 0 {
|
||||
log.Printf("waiting on %d %s routines...", v, k)
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ func DecodeAddress(addr string, defaultNet *chaincfg.Params) (btcutil.Address, e
|
||||
if err == base58.ErrChecksum {
|
||||
return nil, btcutil.ErrChecksumMismatch
|
||||
}
|
||||
return nil, errors.Err("decoded address is of unknown format")
|
||||
return nil, errors.Err("decoded address[%s] is of unknown format even with default chainparams[%s]", addr, defaultNet.Name)
|
||||
}
|
||||
|
||||
switch len(decoded) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package lbrycrd
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestDecodeAddress(t *testing.T) {
|
||||
addr := "bMUxfQVUeDi7ActVeZJZHzHKBceai7kHha"
|
||||
btcAddr, err := DecodeAddress(addr, &MainNetParams)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
println(btcAddr.EncodeAddress())
|
||||
}
|
||||
+2
-1
@@ -30,6 +30,7 @@ var MainNetParams = chaincfg.Params{
|
||||
PrivateKeyID: 0x1c,
|
||||
Bech32HRPSegwit: "not-used", // we don't have this (yet)
|
||||
GenesisHash: &GenesisHash,
|
||||
Name: "mainnet",
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -74,7 +75,7 @@ func New(lbrycrdURL string) (*Client, error) {
|
||||
}
|
||||
|
||||
// make sure lbrycrd is running and responsive
|
||||
_, err = client.GetInfo()
|
||||
_, err = client.GetBlockChainInfo()
|
||||
if err != nil {
|
||||
return nil, errors.Err(err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user