diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-09-19 18:48:41 +0800 |
---|---|---|
committer | missionliao <38416648+missionliao@users.noreply.github.com> | 2018-09-19 18:48:41 +0800 |
commit | 22e70f6da486ed6796a493f25e04679b9afa1439 (patch) | |
tree | 41998daa892812957daa58d7fe84d6fd06f4327c /core/test/app.go | |
parent | a2a733e6f98018cb2ecc4b3982386be8892d7433 (diff) | |
download | tangerine-consensus-22e70f6da486ed6796a493f25e04679b9afa1439.tar tangerine-consensus-22e70f6da486ed6796a493f25e04679b9afa1439.tar.gz tangerine-consensus-22e70f6da486ed6796a493f25e04679b9afa1439.tar.bz2 tangerine-consensus-22e70f6da486ed6796a493f25e04679b9afa1439.tar.lz tangerine-consensus-22e70f6da486ed6796a493f25e04679b9afa1439.tar.xz tangerine-consensus-22e70f6da486ed6796a493f25e04679b9afa1439.tar.zst tangerine-consensus-22e70f6da486ed6796a493f25e04679b9afa1439.zip |
core: rename Notary (Acks) to Witness (#118)
Diffstat (limited to 'core/test/app.go')
-rw-r--r-- | core/test/app.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/core/test/app.go b/core/test/app.go index 57fc467..e9ef871 100644 --- a/core/test/app.go +++ b/core/test/app.go @@ -50,10 +50,10 @@ var ( // and delivered are different. ErrMismatchTotalOrderingAndDelivered = fmt.Errorf( "mismatch total ordering and delivered sequence") - // ErrNotaryAckUnknownBlock means the notary ack is acking on the unknown + // ErrWitnessAckUnknownBlock means the witness ack is acking on the unknown // block. - ErrNotaryAckUnknownBlock = fmt.Errorf( - "notary ack on unknown block") + ErrWitnessAckUnknownBlock = fmt.Errorf( + "witness ack on unknown block") ) // AppAckedRecord caches information when this application received @@ -87,8 +87,8 @@ type App struct { Delivered map[common.Hash]*AppDeliveredRecord DeliverSequence common.Hashes deliveredLock sync.RWMutex - NotaryAckSequence []*types.NotaryAck - notaryAckLock sync.RWMutex + WitnessAckSequence []*types.WitnessAck + witnessAckLock sync.RWMutex } // NewApp constructs a TestApp instance. @@ -155,12 +155,12 @@ func (app *App) DeliverBlock(blockHash common.Hash, timestamp time.Time) { app.DeliverSequence = append(app.DeliverSequence, blockHash) } -// NotaryAckDeliver implements Application interface. -func (app *App) NotaryAckDeliver(notaryAck *types.NotaryAck) { - app.notaryAckLock.Lock() - defer app.notaryAckLock.Unlock() +// WitnessAckDeliver implements Application interface. +func (app *App) WitnessAckDeliver(witnessAck *types.WitnessAck) { + app.witnessAckLock.Lock() + defer app.witnessAckLock.Unlock() - app.NotaryAckSequence = append(app.NotaryAckSequence, notaryAck) + app.WitnessAckSequence = append(app.WitnessAckSequence, witnessAck) } // Compare performs these checks against another App instance @@ -249,12 +249,12 @@ Loop: return ErrMismatchTotalOrderingAndDelivered } - // Make sure that notaryAck is acking the correct block. - app.notaryAckLock.RLock() - defer app.notaryAckLock.RUnlock() - for _, notaryAck := range app.NotaryAckSequence { - if _, exists := app.Delivered[notaryAck.NotaryBlockHash]; !exists { - return ErrNotaryAckUnknownBlock + // Make sure that witnessAck is acking the correct block. + app.witnessAckLock.RLock() + defer app.witnessAckLock.RUnlock() + for _, witnessAck := range app.WitnessAckSequence { + if _, exists := app.Delivered[witnessAck.WitnessBlockHash]; !exists { + return ErrWitnessAckUnknownBlock } } return nil |