diff options
author | Wei-Ning Huang <aitjcize@gmail.com> | 2018-11-13 15:26:21 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:53 +0800 |
commit | 5f2bcc7fba1d247763892c35d694f61e12676969 (patch) | |
tree | 4af712f8303c18a58830756b9b0768eca355fad8 /dex/app.go | |
parent | f14055593cf6a7479f9aea77d08e5e172e8667e4 (diff) | |
download | go-tangerine-5f2bcc7fba1d247763892c35d694f61e12676969.tar go-tangerine-5f2bcc7fba1d247763892c35d694f61e12676969.tar.gz go-tangerine-5f2bcc7fba1d247763892c35d694f61e12676969.tar.bz2 go-tangerine-5f2bcc7fba1d247763892c35d694f61e12676969.tar.lz go-tangerine-5f2bcc7fba1d247763892c35d694f61e12676969.tar.xz go-tangerine-5f2bcc7fba1d247763892c35d694f61e12676969.tar.zst go-tangerine-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/app.go')
-rw-r--r-- | dex/app.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dex/app.go b/dex/app.go index d0d911e86..a90dfae37 100644 --- a/dex/app.go +++ b/dex/app.go @@ -275,13 +275,13 @@ addressMap: // PrepareWitness will return the witness data no lower than consensusHeight. func (d *DexconApp) PrepareWitness(consensusHeight uint64) (witness coreTypes.Witness, err error) { var witnessBlock *types.Block - lastPendingHeight := d.blockchain.GetLastPendingHeight() + lastPendingHeight := d.blockchain.GetPendingHeight() if lastPendingHeight == 0 && consensusHeight == 0 { witnessBlock = d.blockchain.CurrentBlock() } else if lastPendingHeight >= consensusHeight { - witnessBlock = d.blockchain.GetLastPendingBlock() + witnessBlock = d.blockchain.GetPendingBlock() } else if h := <-d.addNotify(consensusHeight); h >= consensusHeight { - witnessBlock = d.blockchain.GetLastPendingBlock() + witnessBlock = d.blockchain.GetPendingBlock() } else { log.Error("need pending block") return witness, fmt.Errorf("need pending block") |