aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-09-19 18:48:41 +0800
committermissionliao <38416648+missionliao@users.noreply.github.com>2018-09-19 18:48:41 +0800
commit22e70f6da486ed6796a493f25e04679b9afa1439 (patch)
tree41998daa892812957daa58d7fe84d6fd06f4327c /core/test
parenta2a733e6f98018cb2ecc4b3982386be8892d7433 (diff)
downloadtangerine-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')
-rw-r--r--core/test/app.go32
-rw-r--r--core/test/app_test.go10
2 files changed, 21 insertions, 21 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
diff --git a/core/test/app_test.go b/core/test/app_test.go
index 6966de5..0003852 100644
--- a/core/test/app_test.go
+++ b/core/test/app_test.go
@@ -153,14 +153,14 @@ func (s *AppTestSuite) TestVerify() {
app4.StronglyAcked(hash)
app4.TotalOrderingDeliver(common.Hashes{hash}, false)
s.deliverBlockWithTimeFromSequenceLength(app4, hash)
- // Notary ack on unknown block.
+ // Witness ack on unknown block.
app5 := NewApp()
s.setupAppByTotalOrderDeliver(app5, s.to1)
- app5.NotaryAckDeliver(&types.NotaryAck{
- Hash: common.NewRandomHash(),
- NotaryBlockHash: common.NewRandomHash(),
+ app5.WitnessAckDeliver(&types.WitnessAck{
+ Hash: common.NewRandomHash(),
+ WitnessBlockHash: common.NewRandomHash(),
})
- req.Equal(ErrNotaryAckUnknownBlock, app5.Verify())
+ req.Equal(ErrWitnessAckUnknownBlock, app5.Verify())
}
func TestApp(t *testing.T) {