Skip to content

Commit

Permalink
DERO Homomorphic Encryption Testnet Release8
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainDero committed Dec 30, 2020
1 parent 0d39322 commit c05c895
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func Blockchain_Start(params map[string]interface{}) (*Blockchain, error) {

// logger.Fatalf("Testing complete quitting")

//go clean_up_valid_cache() // clean up valid cache
go clean_up_valid_cache() // clean up valid cache

/* txlist := chain.Mempool.Mempool_List_TX()
for i := range txlist {
Expand Down Expand Up @@ -1501,7 +1501,7 @@ func (chain *Blockchain) Rewind_Chain(rewind_count int) (result bool) {
panic(err)
}

if chain.IsBlockSyncBlockHeight(r.BLOCK_ID) || r.Height == 0 {
if chain.IsBlockSyncBlockHeight(r.BLOCK_ID) || r.Height == 1 {
break
}

Expand Down
20 changes: 18 additions & 2 deletions blockchain/transaction_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ func (chain *Blockchain) Verify_Transaction_Coinbase(cbl *block.Complete_Block,

if _, err := balance_tree.Get(minertx.MinerAddress[:]); err != nil {
//logger.Infof("balance not obtained err %s\n",err)
return false
//return false
} else {
return true
}

}

return true
return false
}

// all non miner tx must be non-coinbase tx
Expand All @@ -137,8 +137,17 @@ func (chain *Blockchain) Verify_Transaction_NonCoinbase(hf_version int64, tx *tr
return false
}

tx_hash = tx.GetHash()

if tx.TransactionType == transaction.REGISTRATION {
if _, ok := transaction_valid_cache.Load(tx_hash); ok {
return true //logger.Infof("Found in cache %s ",tx_hash)
} else {
//logger.Infof("TX not found in cache %s len %d ",tx_hash, len(tmp_buffer))
}

if tx.IsRegistrationValid() {
transaction_valid_cache.Store(tx_hash, time.Now()) // signature got verified, cache it
return true
}
return false
Expand Down Expand Up @@ -230,6 +239,12 @@ func (chain *Blockchain) Verify_Transaction_NonCoinbase(hf_version int64, tx *tr
panic("mentioned balance tree not found, cannot verify TX")
}

if _, ok := transaction_valid_cache.Load(tx_hash); ok {
return true //logger.Infof("Found in cache %s ",tx_hash)
} else {
//logger.Infof("TX not found in cache %s len %d ",tx_hash, len(tmp_buffer))
}

//logger.Infof("dTX state tree has been found")

// now lets calculate CLn and CRn
Expand All @@ -251,6 +266,7 @@ func (chain *Blockchain) Verify_Transaction_NonCoinbase(hf_version int64, tx *tr

if tx.Proof.Verify(&tx.Statement, tx.GetHash()) {
//logger.Infof("dTX verified with proof successfuly")
transaction_valid_cache.Store(tx_hash, time.Now()) // signature got verified, cache it
return true
}
logger.Infof("transaction verification failed\n")
Expand Down
2 changes: 1 addition & 1 deletion config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ import "github.com/blang/semver"

// right now it has to be manually changed
// do we need to include git commitsha??
var Version = semver.MustParse("3.0.0-24.DEROHE.alpha+30122020")
var Version = semver.MustParse("3.0.0-25.DEROHE.alpha+30122020")

0 comments on commit c05c895

Please sign in to comment.