aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-09-25 17:19:00 +0800
committerWei-Ning Huang <aitjcize@gmail.com>2018-09-25 17:19:00 +0800
commitd844c339a128322dff180a6ccc6e6b241e917546 (patch)
tree53d9b1add43a5e242a51a097be8b55048eefa1c2 /core/test
parent6c8d26d2e797e8420fc3de4b15e4c556f968aba0 (diff)
downloadtangerine-consensus-d844c339a128322dff180a6ccc6e6b241e917546.tar.gz
tangerine-consensus-d844c339a128322dff180a6ccc6e6b241e917546.tar.zst
tangerine-consensus-d844c339a128322dff180a6ccc6e6b241e917546.zip
Fix naming of methods (#134)
- BlockDeliver -> BlockDelivered - TotalOrderingDeliver -> TotalOrderingDelivered - WitnessAckDeliver -> WitnessAckDelivered - VerifyPayload -> VerifyPayloads
Diffstat (limited to 'core/test')
-rw-r--r--core/test/app.go16
-rw-r--r--core/test/app_test.go16
-rw-r--r--core/test/stopper_test.go4
3 files changed, 18 insertions, 18 deletions
diff --git a/core/test/app.go b/core/test/app.go
index 7a0ad97..cc2bbe6 100644
--- a/core/test/app.go
+++ b/core/test/app.go
@@ -109,8 +109,8 @@ func (app *App) PreparePayload(position types.Position) []byte {
return []byte{}
}
-// VerifyPayloads implements Application.
-func (app *App) VerifyPayloads(payloads []byte) bool {
+// VerifyPayload implements Application.
+func (app *App) VerifyPayload(payloads []byte) bool {
return true
}
@@ -126,8 +126,8 @@ func (app *App) StronglyAcked(blockHash common.Hash) {
app.Acked[blockHash] = &AppAckedRecord{When: time.Now().UTC()}
}
-// TotalOrderingDeliver implements Application interface.
-func (app *App) TotalOrderingDeliver(blockHashes common.Hashes, early bool) {
+// TotalOrderingDelivered implements Application interface.
+func (app *App) TotalOrderingDelivered(blockHashes common.Hashes, early bool) {
app.totalOrderedLock.Lock()
defer app.totalOrderedLock.Unlock()
@@ -145,8 +145,8 @@ func (app *App) TotalOrderingDeliver(blockHashes common.Hashes, early bool) {
}
}
-// BlockDeliver implements Application interface.
-func (app *App) BlockDeliver(block types.Block) {
+// BlockDelivered implements Application interface.
+func (app *App) BlockDelivered(block types.Block) {
app.deliveredLock.Lock()
defer app.deliveredLock.Unlock()
@@ -163,8 +163,8 @@ func (app *App) BlockProcessedChan() <-chan types.WitnessResult {
return app.witnessResultChan
}
-// WitnessAckDeliver implements Application interface.
-func (app *App) WitnessAckDeliver(witnessAck *types.WitnessAck) {
+// WitnessAckDelivered implements Application interface.
+func (app *App) WitnessAckDelivered(witnessAck *types.WitnessAck) {
app.witnessAckLock.Lock()
defer app.witnessAckLock.Unlock()
diff --git a/core/test/app_test.go b/core/test/app_test.go
index 649ccbe..9d35c67 100644
--- a/core/test/app_test.go
+++ b/core/test/app_test.go
@@ -62,7 +62,7 @@ func (s *AppTestSuite) setupAppByTotalOrderDeliver(
for _, h := range to.BlockHashes {
app.StronglyAcked(h)
}
- app.TotalOrderingDeliver(to.BlockHashes, to.Early)
+ app.TotalOrderingDelivered(to.BlockHashes, to.Early)
for _, h := range to.BlockHashes {
// To make it simpler, use the index of hash sequence
// as the time.
@@ -80,7 +80,7 @@ func (s *AppTestSuite) deliverBlockWithTimeFromSequenceLength(
func (s *AppTestSuite) deliverBlock(
app *App, hash common.Hash, timestamp time.Time) {
- app.BlockDeliver(types.Block{
+ app.BlockDelivered(types.Block{
Hash: hash,
Witness: types.Witness{
Timestamp: timestamp,
@@ -100,7 +100,7 @@ func (s *AppTestSuite) TestCompare() {
s.setupAppByTotalOrderDeliver(app2, s.to2)
hash := common.NewRandomHash()
app2.StronglyAcked(hash)
- app2.TotalOrderingDeliver(common.Hashes{hash}, false)
+ app2.TotalOrderingDelivered(common.Hashes{hash}, false)
s.deliverBlockWithTimeFromSequenceLength(app2, hash)
req.Equal(ErrMismatchBlockHashSequence, app1.Compare(app2))
// An App with different consensus time for the same block.
@@ -110,7 +110,7 @@ func (s *AppTestSuite) TestCompare() {
for _, h := range s.to3.BlockHashes {
app3.StronglyAcked(h)
}
- app3.TotalOrderingDeliver(s.to3.BlockHashes, s.to3.Early)
+ app3.TotalOrderingDelivered(s.to3.BlockHashes, s.to3.Early)
wrongTime := time.Time{}.Add(
time.Duration(len(app3.DeliverSequence)) * time.Second)
wrongTime = wrongTime.Add(1 * time.Second)
@@ -141,7 +141,7 @@ func (s *AppTestSuite) TestVerify() {
for _, h := range s.to2.BlockHashes {
app2.StronglyAcked(h)
}
- app2.TotalOrderingDeliver(s.to2.BlockHashes, s.to2.Early)
+ app2.TotalOrderingDelivered(s.to2.BlockHashes, s.to2.Early)
s.deliverBlock(app2, s.to2.BlockHashes[0], time.Time{})
req.Equal(ErrConsensusTimestampOutOfOrder, app2.Verify())
// A delivered block is not found in total ordering delivers.
@@ -157,15 +157,15 @@ func (s *AppTestSuite) TestVerify() {
for _, h := range s.to2.BlockHashes {
app4.StronglyAcked(h)
}
- app4.TotalOrderingDeliver(s.to2.BlockHashes, s.to2.Early)
+ app4.TotalOrderingDelivered(s.to2.BlockHashes, s.to2.Early)
hash = common.NewRandomHash()
app4.StronglyAcked(hash)
- app4.TotalOrderingDeliver(common.Hashes{hash}, false)
+ app4.TotalOrderingDelivered(common.Hashes{hash}, false)
s.deliverBlockWithTimeFromSequenceLength(app4, hash)
// Witness ack on unknown block.
app5 := NewApp()
s.setupAppByTotalOrderDeliver(app5, s.to1)
- app5.WitnessAckDeliver(&types.WitnessAck{
+ app5.WitnessAckDelivered(&types.WitnessAck{
Hash: common.NewRandomHash(),
WitnessBlockHash: common.NewRandomHash(),
})
diff --git a/core/test/stopper_test.go b/core/test/stopper_test.go
index cb52032..de1c1a5 100644
--- a/core/test/stopper_test.go
+++ b/core/test/stopper_test.go
@@ -59,9 +59,9 @@ func (s *StopperTestSuite) TestStopByConfirmedBlocks() {
for _, h := range hashes {
app.StronglyAcked(h)
}
- app.TotalOrderingDeliver(hashes, false)
+ app.TotalOrderingDelivered(hashes, false)
for _, h := range hashes {
- app.BlockDeliver(types.Block{
+ app.BlockDelivered(types.Block{
Hash: h,
Witness: types.Witness{Timestamp: time.Time{}}})
}