summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Guo <nicholas.guo@algorand.com>2022-10-12 16:47:19 -0400
committerNicholas Guo <nicholas.guo@algorand.com>2022-10-12 16:47:19 -0400
commit3cbfe53a418c4a2e6ea81ac030128aa39b164614 (patch)
tree254d604075b6b1e785514ba7b5f4349ead009509
parent40e171bfebcb2d4853fcafa77037ebd4af7ea494 (diff)
-rw-r--r--agreement/service.go2
-rw-r--r--agreement/types.go1
-rw-r--r--data/pools/transactionPool.go1
-rw-r--r--ledger/ledgercore/validatedBlock.go2
-rw-r--r--ledger/speculative.go1
-rw-r--r--node/node.go1
6 files changed, 7 insertions, 1 deletions
diff --git a/agreement/service.go b/agreement/service.go
index 9972d3994..22d614549 100644
--- a/agreement/service.go
+++ b/agreement/service.go
@@ -224,7 +224,7 @@ func (s *Service) mainLoop(input <-chan externalEvent, output chan<- []action, r
for {
status.ConsensusVersion, err = s.Ledger.ConsensusVersion(status.Round.SubSaturate(2))
if err != nil {
- s.Panicf("cannot read latest concensus version, round %d: %v", status.Round.SubSaturate(2), err)
+ s.Panicf("cannot read latest consensus version, round %d: %v", status.Round.SubSaturate(2), err)
}
// set speculative block assembly based on the current local configuration
diff --git a/agreement/types.go b/agreement/types.go
index 2d11ded30..ace6dfcb4 100644
--- a/agreement/types.go
+++ b/agreement/types.go
@@ -38,6 +38,7 @@ func FilterTimeout(p period, v protocol.ConsensusVersion) time.Duration {
return config.Consensus[v].AgreementFilterTimeout
}
+// SpeculativeBlockAsmTime is the time at which we would like to begin speculative assembly
func SpeculativeBlockAsmTime(p period, v protocol.ConsensusVersion, speculativeAsmTimeDuration time.Duration) time.Duration {
hardwait := FilterTimeout(p, v)
if hardwait > speculativeAsmTimeDuration {
diff --git a/data/pools/transactionPool.go b/data/pools/transactionPool.go
index 66eaf98c1..074859c39 100644
--- a/data/pools/transactionPool.go
+++ b/data/pools/transactionPool.go
@@ -562,6 +562,7 @@ func (pool *TransactionPool) Lookup(txid transactions.Txid) (tx transactions.Sig
return pool.statusCache.check(txid)
}
+// OnNewSpeculativeBlock handles creating a speculative block
func (pool *TransactionPool) OnNewSpeculativeBlock(ctx context.Context, vb *ledgercore.ValidatedBlock) {
pool.mu.Lock()
diff --git a/ledger/ledgercore/validatedBlock.go b/ledger/ledgercore/validatedBlock.go
index 400fa3ea1..84d55fb9a 100644
--- a/ledger/ledgercore/validatedBlock.go
+++ b/ledger/ledgercore/validatedBlock.go
@@ -53,6 +53,7 @@ func (vb ValidatedBlock) WithSeed(s committee.Seed) ValidatedBlock {
}
}
+// CheckDup checks whether a txn is a duplicate
func (vb ValidatedBlock) CheckDup(currentProto config.ConsensusParams, firstValid, lastValid basics.Round, txid transactions.Txid, txl Txlease) error {
_, present := vb.delta.Txids[txid]
if present {
@@ -68,6 +69,7 @@ func (vb ValidatedBlock) CheckDup(currentProto config.ConsensusParams, firstVali
return nil
}
+// Hash returns the hash of the block
func (vb ValidatedBlock) Hash() bookkeeping.BlockHash {
return vb.blk.Hash()
}
diff --git a/ledger/speculative.go b/ledger/speculative.go
index cb42f36ab..809d6c695 100644
--- a/ledger/speculative.go
+++ b/ledger/speculative.go
@@ -30,6 +30,7 @@ import (
"github.com/algorand/go-algorand/logging"
)
+// LedgerForEvaluator defines the ledger interface needed by the evaluator.
type LedgerForEvaluator interface {
// Needed for cow.go
Block(basics.Round) (bookkeeping.Block, error)
diff --git a/node/node.go b/node/node.go
index e57faed3f..eb71ca85e 100644
--- a/node/node.go
+++ b/node/node.go
@@ -1264,6 +1264,7 @@ func (node *AlgorandFullNode) AssembleBlock(round basics.Round) (agreement.Valid
return validatedBlock{vb: lvb}, nil
}
+// OnNewSpeculativeBlock handles creating a speculative block
func (node *AlgorandFullNode) OnNewSpeculativeBlock(ctx context.Context, avb agreement.ValidatedBlock) {
vb, ok := avb.(validatedBlock)
if ok {