aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorBojie Wu <bojie@dexon.org>2018-10-11 17:54:53 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:23:38 +0800
commitb0a60baf22729665cc4b52cd1f0b2aa4e479f684 (patch)
tree47a54d751404480e8900251adcde81f8cef66568 /dex
parent1e3c995c15756c87589ba2fe531f1af9d23f1c75 (diff)
downloadgo-tangerine-b0a60baf22729665cc4b52cd1f0b2aa4e479f684.tar
go-tangerine-b0a60baf22729665cc4b52cd1f0b2aa4e479f684.tar.gz
go-tangerine-b0a60baf22729665cc4b52cd1f0b2aa4e479f684.tar.bz2
go-tangerine-b0a60baf22729665cc4b52cd1f0b2aa4e479f684.tar.lz
go-tangerine-b0a60baf22729665cc4b52cd1f0b2aa4e479f684.tar.xz
go-tangerine-b0a60baf22729665cc4b52cd1f0b2aa4e479f684.tar.zst
go-tangerine-b0a60baf22729665cc4b52cd1f0b2aa4e479f684.zip
app: correct validation logic
Diffstat (limited to 'dex')
-rw-r--r--dex/app.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/dex/app.go b/dex/app.go
index 80384ddc9..cdbcdbda6 100644
--- a/dex/app.go
+++ b/dex/app.go
@@ -19,6 +19,7 @@ package dex
import (
"bytes"
+ "github.com/dexon-foundation/dexon/core/rawdb"
"math/big"
"sync"
"time"
@@ -27,7 +28,6 @@ import (
"github.com/dexon-foundation/dexon/common"
"github.com/dexon-foundation/dexon/core"
- "github.com/dexon-foundation/dexon/core/rawdb"
"github.com/dexon-foundation/dexon/core/state"
"github.com/dexon-foundation/dexon/core/types"
"github.com/dexon-foundation/dexon/core/vm"
@@ -179,8 +179,7 @@ func (d *DexconApp) VerifyBlock(block *coreTypes.Block) bool {
// verify transactions
for _, transaction := range transactions {
- tx, _, _, _ := rawdb.ReadTransaction(d.chainDB, transaction.Hash())
- if tx == nil || d.txPool.ValidateTx(transaction, false) != nil {
+ if d.txPool.ValidateTx(transaction, false) != nil {
return false
}
}
@@ -218,11 +217,18 @@ func (d *DexconApp) VerifyBlock(block *coreTypes.Block) bool {
} else if witnessBlock.ReceiptHash() != witnessData.ReceiptHash {
// invalid receipt root of witness data
return false
- } else if witnessBlock.TxHash() != witnessData.ReceiptHash {
+ } else if witnessBlock.TxHash() != witnessData.TxHash {
// invalid tx root of witness data
return false
}
+ for _, transaction := range witnessBlock.Transactions() {
+ tx, _, _, _ := rawdb.ReadTransaction(d.chainDB, transaction.Hash())
+ if tx == nil {
+ return false
+ }
+ }
+
return true
}