-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add sky scanner #235
Conversation
src/scanner/sky_test.go
Outdated
} | ||
|
||
func (dsc *dummySkyrpcclient) GetBlockVerboseTx(seq uint64) (*visor.ReadableBlock, error) { | ||
//TODO (therealssj): refactor this to directly read from the database |
There was a problem hiding this comment.
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
Needs config setup as well. The scanner should have a configured initial height to scan from |
src/exchange/receiver.go
Outdated
switch coinType { | ||
case scanner.CoinTypeBTC: | ||
return cfg.SkyBtcExchangeRate, nil | ||
case scanner.CoinTypeETH: | ||
return cfg.SkyEthExchangeRate, nil | ||
case scanner.CoinTypeSKY: | ||
fallthrough |
There was a problem hiding this comment.
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
src/exchange/receiver.go
Outdated
@@ -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 |
There was a problem hiding this comment.
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
b38e80f
to
961c7ff
Compare
6c4ca34
to
526b968
Compare
skyrpc := scanner.NewSkyClient(cfg.SkyRPC.Address) | ||
err := scanStore.AddSupportedCoin(scanner.CoinTypeSKY) | ||
if err != nil { | ||
log.WithError(err).Error("scanStore.AddSupportedCoin(scanner.CoinTypeSKY) failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, err
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/exchange/receiver.go
Outdated
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 |
There was a problem hiding this comment.
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
src/scanner/sky.go
Outdated
@@ -0,0 +1,215 @@ | |||
// Package scanner scans bitcoin blockchain and check all transactions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this docstring
src/scanner/sky.go
Outdated
Base CommonScanner | ||
} | ||
|
||
// SkyClient implements the SKYRpcClient interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SkyRPCClient
src/scanner/sky.go
Outdated
|
||
// block seq of last block is the block count | ||
blockCnt := lastBlock.Blocks[0].Head.BkSeq | ||
return int64(blockCnt), nil |
There was a problem hiding this comment.
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
src/scanner/sky.go
Outdated
// NewSkyClient create a new skyclient instance | ||
func NewSkyClient(addr string) *SkyClient { | ||
skyClient := SkyClient{ | ||
c: &webrpc.Client{Addr: addr}, |
There was a problem hiding this comment.
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
Merge conflict |
No description provided.