aboutsummaryrefslogtreecommitdiffstats
path: root/dex/api_backend.go
diff options
context:
space:
mode:
authorbojie <bojie@dexon.org>2019-01-14 20:42:15 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:56 +0800
commit2155bbd85373a8527e3b565f4316bc4f1517650a (patch)
tree2f64cbc5a6810aa496524c7509a4998847526123 /dex/api_backend.go
parent3fcb8b6825b3c62c9890a5ca59594f1503e66893 (diff)
downloaddexon-2155bbd85373a8527e3b565f4316bc4f1517650a.tar
dexon-2155bbd85373a8527e3b565f4316bc4f1517650a.tar.gz
dexon-2155bbd85373a8527e3b565f4316bc4f1517650a.tar.bz2
dexon-2155bbd85373a8527e3b565f4316bc4f1517650a.tar.lz
dexon-2155bbd85373a8527e3b565f4316bc4f1517650a.tar.xz
dexon-2155bbd85373a8527e3b565f4316bc4f1517650a.tar.zst
dexon-2155bbd85373a8527e3b565f4316bc4f1517650a.zip
app: remove pending block logic (#149)
Diffstat (limited to 'dex/api_backend.go')
-rw-r--r--dex/api_backend.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/dex/api_backend.go b/dex/api_backend.go
index 80fe1e39b..957f4d886 100644
--- a/dex/api_backend.go
+++ b/dex/api_backend.go
@@ -60,7 +60,7 @@ func (b *DexAPIBackend) SetHead(number uint64) {
func (b *DexAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) {
// Otherwise resolve and return the block
- if blockNr == rpc.LatestBlockNumber {
+ if blockNr == rpc.LatestBlockNumber || blockNr == rpc.PendingBlockNumber {
return b.dex.blockchain.CurrentBlock().Header(), nil
}
return b.dex.blockchain.GetHeaderByNumber(uint64(blockNr)), nil
@@ -79,10 +79,6 @@ func (b *DexAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumb
}
func (b *DexAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error) {
- if blockNr == rpc.PendingBlockNumber {
- block, state := b.dex.BlockChain().GetPending()
- return state, block.Header(), nil
- }
header, err := b.HeaderByNumber(ctx, blockNr)
if header == nil || err != nil {
return nil, nil, err