Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevMode: create a block for external txns only #3784

Merged
merged 4 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compactcert/abstractions.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
// TransactionSender is an interface that captures the node's ability
// to broadcast a new transaction.
type TransactionSender interface {
BroadcastSignedTxGroup([]transactions.SignedTxn) error
BroadcastInternalSignedTxGroup([]transactions.SignedTxn) error
}

// Ledger captures the aspects of the ledger that are used by this package.
Expand Down
2 changes: 1 addition & 1 deletion compactcert/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func (ccw *Worker) tryBuilding() {
stxn.Txn.GenesisHash = ccw.ledger.GenesisHash()
stxn.Txn.CertRound = rnd
stxn.Txn.Cert = *cert
err = ccw.txnSender.BroadcastSignedTxGroup([]transactions.SignedTxn{stxn})
err = ccw.txnSender.BroadcastInternalSignedTxGroup([]transactions.SignedTxn{stxn})
if err != nil {
ccw.log.Warnf("ccw.tryBuilding: broadcasting compact cert txn for %d: %v", rnd, err)
}
Expand Down
2 changes: 1 addition & 1 deletion compactcert/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (s *testWorkerStubs) Broadcast(ctx context.Context, tag protocol.Tag, data
return nil
}

func (s *testWorkerStubs) BroadcastSignedTxGroup(tx []transactions.SignedTxn) error {
func (s *testWorkerStubs) BroadcastInternalSignedTxGroup(tx []transactions.SignedTxn) error {
require.Equal(s.t, len(tx), 1)
s.txmsg <- tx[0]
return nil
Expand Down
10 changes: 10 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,17 @@ func (node *AlgorandFullNode) BroadcastSignedTxGroup(txgroup []transactions.Sign
node.mu.Unlock()
}()
}
return node.broadcastSignedTxGroup(txgroup)
}

// BroadcastInternalSignedTxGroup broadcasts a transaction group that has already been signed.
// It is originated internally, and in DevMode, it will not advance the round.
func (node *AlgorandFullNode) BroadcastInternalSignedTxGroup(txgroup []transactions.SignedTxn) (err error) {
return node.broadcastSignedTxGroup(txgroup)
}

// broadcastSignedTxGroup broadcasts a transaction group that has already been signed.
func (node *AlgorandFullNode) broadcastSignedTxGroup(txgroup []transactions.SignedTxn) (err error) {
lastRound := node.ledger.Latest()
var b bookkeeping.BlockHeader
b, err = node.ledger.BlockHdr(lastRound)
Expand Down