remove unused code; continue on failed slash record; Fix delete slash func on SetDifference (#2923)

* remove unused code and continue on failed slash record

* Fix delete slash func
pull/2931/head
Rongjian Lan 5 years ago committed by GitHub
parent 22822e1c1e
commit 6ec6b6378a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      core/blockchain.go
  2. 11
      core/rawdb/accessors_offchain.go
  3. 1
      core/state_processor.go
  4. 1
      node/worker/worker.go

@ -1975,7 +1975,7 @@ func (bc *BlockChain) DeleteFromPendingSlashingCandidates(
bc.pendingSlashingCandidatesMU.Lock()
defer bc.pendingSlashingCandidatesMU.Unlock()
current := bc.ReadPendingSlashingCandidates()
bc.pendingSlashes = current.SetDifference(processed)
bc.pendingSlashes = processed.SetDifference(current)
return bc.writeSlashes(bc.pendingSlashes)
}

@ -79,17 +79,6 @@ func WritePendingCrossLinks(db DatabaseWriter, bytes []byte) error {
return db.Put(pendingCrosslinkKey, bytes)
}
// DeletePendingCrossLinks stores last pending crosslinks into database.
func DeletePendingCrossLinks(db DatabaseDeleter) error {
return db.Delete(pendingCrosslinkKey)
}
// ReadPendingSlashingCandidates retrieves last pending slashing candidates
// TODO(audit): the pending slashes written in DB is never used.
func ReadPendingSlashingCandidates(db DatabaseReader) ([]byte, error) {
return db.Get(pendingSlashingKey)
}
// WritePendingSlashingCandidates stores last pending slashing candidates into database.
func WritePendingSlashingCandidates(db DatabaseWriter, bytes []byte) error {
return db.Put(pendingSlashingKey, bytes)

@ -274,7 +274,6 @@ func ApplyStakingTransaction(
receipt.TxHash = tx.Hash()
receipt.GasUsed = gas
// TODO(audit): add more log to staking txns; expose them in block explorer.
if config.IsReceiptLog(header.Epoch()) {
receipt.Logs = statedb.GetLogs(tx.Hash())
utils.Logger().Info().Interface("CollectReward", receipt.Logs)

@ -405,6 +405,7 @@ func (w *Worker) verifySlashes(
Interface("slashRecord", d[i]).
Msg("Slash failed verification")
failures = append(failures, d[i])
continue
}
successes = append(successes, d[i])
}

Loading…
Cancel
Save