aboutsummaryrefslogtreecommitdiffstats
path: root/dex/api_backend.go
diff options
context:
space:
mode:
authorWei-Ning Huang <aitjcize@gmail.com>2018-11-13 15:26:21 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:53 +0800
commit5f2bcc7fba1d247763892c35d694f61e12676969 (patch)
tree4af712f8303c18a58830756b9b0768eca355fad8 /dex/api_backend.go
parentf14055593cf6a7479f9aea77d08e5e172e8667e4 (diff)
downloaddexon-5f2bcc7fba1d247763892c35d694f61e12676969.tar
dexon-5f2bcc7fba1d247763892c35d694f61e12676969.tar.gz
dexon-5f2bcc7fba1d247763892c35d694f61e12676969.tar.bz2
dexon-5f2bcc7fba1d247763892c35d694f61e12676969.tar.lz
dexon-5f2bcc7fba1d247763892c35d694f61e12676969.tar.xz
dexon-5f2bcc7fba1d247763892c35d694f61e12676969.tar.zst
dexon-5f2bcc7fba1d247763892c35d694f61e12676969.zip
dex: return correct pending nonce (#14)
We need to return the correct pending nonce (include those in the tx pool). Also, StateAndHeaderByNumber is also fixed to use pending block.
Diffstat (limited to 'dex/api_backend.go')
-rw-r--r--dex/api_backend.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/dex/api_backend.go b/dex/api_backend.go
index 4d0cdc9e9..d8d52974d 100644
--- a/dex/api_backend.go
+++ b/dex/api_backend.go
@@ -80,7 +80,8 @@ 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 {
- blockNr = rpc.BlockNumber(b.dex.blockchain.CurrentBlock().Header().Number.Uint64())
+ block, state := b.dex.BlockChain().GetPending()
+ return state, block.Header(), nil
}
header, err := b.HeaderByNumber(ctx, blockNr)
if header == nil || err != nil {