Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sky scanner #235

Merged
merged 16 commits into from
Mar 29, 2018
Merged

Add sky scanner #235

merged 16 commits into from
Mar 29, 2018

Conversation

therealssj
Copy link
Contributor

No description provided.

}

func (dsc *dummySkyrpcclient) GetBlockVerboseTx(seq uint64) (*visor.ReadableBlock, error) {
//TODO (therealssj): refactor this to directly read from the database
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont have a good understanding of the skycoin blockchain structure so I just used the existing functions instead of reading the database values directly

@gz-c
Copy link
Member

gz-c commented Mar 14, 2018

Needs config setup as well.

The scanner should have a configured initial height to scan from

switch coinType {
case scanner.CoinTypeBTC:
return cfg.SkyBtcExchangeRate, nil
case scanner.CoinTypeETH:
return cfg.SkyEthExchangeRate, nil
case scanner.CoinTypeSKY:
fallthrough
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't know what sky will be exchanged for

@@ -197,7 +197,8 @@ func getRate(cfg config.SkyExchanger, coinType string) (string, error) {
case scanner.CoinTypeETH:
return cfg.SkyEthExchangeRate, nil
case scanner.CoinTypeSKY:
fallthrough
//NOTE: add exchange rate accordingly when needed
return "0", nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to set this to something to pass the tests

@therealssj therealssj force-pushed the skyscanner branch 3 times, most recently from b38e80f to 961c7ff Compare March 21, 2018 05:52
@therealssj therealssj force-pushed the skyscanner branch 9 times, most recently from 6c4ca34 to 526b968 Compare March 22, 2018 08:32
skyrpc := scanner.NewSkyClient(cfg.SkyRPC.Address)
err := scanStore.AddSupportedCoin(scanner.CoinTypeSKY)
if err != nil {
log.WithError(err).Error("scanStore.AddSupportedCoin(scanner.CoinTypeSKY) failed")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return nil, err

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

switch coinType {
case scanner.CoinTypeBTC:
return cfg.SkyBtcExchangeRate, nil
case scanner.CoinTypeETH:
return cfg.SkyEthExchangeRate, nil
case scanner.CoinTypeSKY:
//NOTE: add exchange rate accordingly when needed
return "0", nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a cfg.SkySkyExchangeRate, we can fix the name later

@@ -0,0 +1,215 @@
// Package scanner scans bitcoin blockchain and check all transactions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this docstring

Base CommonScanner
}

// SkyClient implements the SKYRpcClient interface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SkyRPCClient


// block seq of last block is the block count
blockCnt := lastBlock.Blocks[0].Head.BkSeq
return int64(blockCnt), nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First block has BkSeq=0 so need to add 1

// NewSkyClient create a new skyclient instance
func NewSkyClient(addr string) *SkyClient {
skyClient := SkyClient{
c: &webrpc.Client{Addr: addr},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the gui.Client instead, you'll need to update Gopkg.toml to use the v0.22.0 tag in the dependencies

@gz-c
Copy link
Member

gz-c commented Mar 26, 2018

Merge conflict

@gz-c gz-c merged commit c770d1d into skycoin:develop Mar 29, 2018
@therealssj therealssj deleted the skyscanner branch April 13, 2018 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants