diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-22 02:44:22 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-22 02:44:22 +0800 |
commit | 0467a6ceec4973b00c344d2a724f7fb01a6b0aee (patch) | |
tree | 66e010270bdf25fa0058c89fb31f6df8cf7f7829 /rpc | |
parent | dba15d9c3609bcddfc7a4f0fe8f01c48a8bbfbc8 (diff) | |
parent | 5b0ee8ec304663898073b7a4c659e1def23716df (diff) | |
download | go-tangerine-0467a6ceec4973b00c344d2a724f7fb01a6b0aee.tar.gz go-tangerine-0467a6ceec4973b00c344d2a724f7fb01a6b0aee.tar.zst go-tangerine-0467a6ceec4973b00c344d2a724f7fb01a6b0aee.zip |
Merge pull request #1889 from karalabe/fast-sync-rebase
eth/63 fast synchronization algorithm
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/api/debug.go | 8 | ||||
-rw-r--r-- | rpc/api/eth.go | 4 | ||||
-rw-r--r-- | rpc/api/eth_args.go | 2 | ||||
-rw-r--r-- | rpc/api/parsing.go | 4 |
4 files changed, 5 insertions, 13 deletions
diff --git a/rpc/api/debug.go b/rpc/api/debug.go index 003b4d994..d2cbc7f19 100644 --- a/rpc/api/debug.go +++ b/rpc/api/debug.go @@ -146,13 +146,7 @@ func (self *debugApi) SetHead(req *shared.Request) (interface{}, error) { if err := self.codec.Decode(req.Params, &args); err != nil { return nil, shared.NewDecodeParamError(err.Error()) } - - block := self.xeth.EthBlockByNumber(args.BlockNumber) - if block == nil { - return nil, fmt.Errorf("block #%d not found", args.BlockNumber) - } - - self.ethereum.BlockChain().SetHead(block) + self.ethereum.BlockChain().SetHead(uint64(args.BlockNumber)) return nil, nil } diff --git a/rpc/api/eth.go b/rpc/api/eth.go index 6db006a46..4722682ff 100644 --- a/rpc/api/eth.go +++ b/rpc/api/eth.go @@ -168,9 +168,7 @@ func (self *ethApi) IsMining(req *shared.Request) (interface{}, error) { } func (self *ethApi) IsSyncing(req *shared.Request) (interface{}, error) { - current := self.ethereum.BlockChain().CurrentBlock().NumberU64() - origin, height := self.ethereum.Downloader().Boundaries() - + origin, current, height := self.ethereum.Downloader().Progress() if current < height { return map[string]interface{}{ "startingBlock": newHexNum(big.NewInt(int64(origin)).Bytes()), diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index 66c190a51..6aca6a663 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -838,7 +838,7 @@ func NewLogRes(log *vm.Log) LogRes { } l.Address = newHexData(log.Address) l.Data = newHexData(log.Data) - l.BlockNumber = newHexNum(log.Number) + l.BlockNumber = newHexNum(log.BlockNumber) l.LogIndex = newHexNum(log.Index) l.TransactionHash = newHexData(log.TxHash) l.TransactionIndex = newHexNum(log.TxIndex) diff --git a/rpc/api/parsing.go b/rpc/api/parsing.go index cdfaa0ed1..7667616ff 100644 --- a/rpc/api/parsing.go +++ b/rpc/api/parsing.go @@ -453,8 +453,8 @@ func NewReceiptRes(rec *types.Receipt) *ReceiptRes { v.ContractAddress = newHexData(rec.ContractAddress) } - logs := make([]interface{}, len(rec.Logs())) - for i, log := range rec.Logs() { + logs := make([]interface{}, len(rec.Logs)) + for i, log := range rec.Logs { logs[i] = NewLogRes(log) } v.Logs = &logs |