Skip to content

Commit

Permalink
merge: branch '3364-fix-sequencer' into 'main'
Browse files Browse the repository at this point in the history
Fix sequencer panic [#3364]

Closes #3364

See merge request accumulatenetwork/accumulate!879
  • Loading branch information
firelizzard18 committed Jul 12, 2023
2 parents 1191123 + ea688c4 commit f2cd6b7
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions internal/api/v3/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,30 +254,30 @@ func (s *Sequencer) getSynth(batch *database.Batch, globals *core.GlobalValues,
return nil, errors.InternalError.Wrap(err)
}

if globals.ExecutorVersion.V2() {
// Get the synthetic main chain receipt
synthReceipt, entry, err := s.getReceiptForChainEntry(ledger.MainChain(), entry.Source)
if err != nil {
return nil, errors.UnknownError.Wrap(err)
}
// Get the synthetic main chain receipt
synthReceipt, entry, err := s.getReceiptForChainEntry(ledger.MainChain(), entry.Source)
if err != nil {
return nil, errors.UnknownError.Wrap(err)
}

// Get the latest directory anchor receipt
dirReceipt, err := s.getLatestDirectoryReceipt(batch)
if err != nil {
return nil, errors.UnknownError.Wrap(err)
}
// Get the latest directory anchor receipt
dirReceipt, err := s.getLatestDirectoryReceipt(batch)
if err != nil {
return nil, errors.UnknownError.Wrap(err)
}

// Get the receipt in between the other two
rootReceipt, err := s.getRootReceipt(batch, entry.Anchor, dirReceipt.Anchor.RootChainIndex)
if err != nil {
return nil, errors.UnknownError.Wrap(err)
}
// Get the receipt in between the other two
rootReceipt, err := s.getRootReceipt(batch, entry.Anchor, dirReceipt.Anchor.RootChainIndex)
if err != nil {
return nil, errors.UnknownError.Wrap(err)
}

receipt, err := merkle.CombineReceipts(synthReceipt, rootReceipt, dirReceipt.RootChainReceipt)
if err != nil {
return nil, errors.UnknownError.WithFormat("combine receipts: %w", err)
}
receipt, err := merkle.CombineReceipts(synthReceipt, rootReceipt, dirReceipt.RootChainReceipt)
if err != nil {
return nil, errors.UnknownError.WithFormat("combine receipts: %w", err)
}

if globals.ExecutorVersion.V2() {
r.SourceReceipt = receipt

sigMsg := &messaging.SignatureMessage{
Expand Down Expand Up @@ -311,8 +311,8 @@ func (s *Sequencer) getSynth(batch *database.Batch, globals *core.GlobalValues,

// Add the receipt signature
receiptSig := new(protocol.ReceiptSignature)
receiptSig.SourceNetwork = status.SourceNetwork
receiptSig.Proof = *status.Proof
receiptSig.SourceNetwork = protocol.DnUrl()
receiptSig.Proof = *receipt
receiptSig.TransactionHash = *(*[32]byte)(hash)
signatures = append(signatures, receiptSig)

Expand Down

0 comments on commit f2cd6b7

Please sign in to comment.