Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
firelizzard18 committed May 29, 2024
1 parent 28b0602 commit ea33040
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions internal/core/execute/v2/block/msg_block_anchor.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,23 @@ func (x BlockAnchor) check(ctx *MessageContext, batch *database.Batch) (*blockAn
return nil, errors.BadRequest.WithFormat("cannot sign a %v transaction with a %v message", txn.Body.Type(), anchor.Type())
}

if seq.Source == nil {
return nil, errors.InternalError.WithFormat("sequence is missing source")
// Verify the destination and principal match
if ctx.GetActiveGlobals().ExecutorVersion.V2VandenbergEnabled() {
if seq.Destination == nil {
return nil, errors.InternalError.WithFormat("sequence is missing destination")
}
if txn.Header.Principal == nil {
return nil, errors.InternalError.WithFormat("transaction is missing principal")
}
if !seq.Destination.RootIdentity().Equal(txn.Header.Principal.RootIdentity()) {
return nil, errors.BadRequest.WithFormat("sequence destination does not match transaction principal")
}
}

// Verify the signer is a validator of this partition
if seq.Source == nil {
return nil, errors.InternalError.WithFormat("sequence is missing source")
}
partition, ok := protocol.ParsePartitionUrl(seq.Source)
if !ok {
return nil, errors.BadRequest.WithFormat("signature source is not a partition")
Expand Down
4 changes: 2 additions & 2 deletions internal/core/execute/v2/block/msg_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (m *TransactionContext) sigWith(sig protocol.Signature) *SignatureContext {
s := new(SignatureContext)
s.TransactionContext = m
s.signature = sig
return s
return s
}

// txnWith constructs a transaction context from this message context for the
Expand Down Expand Up @@ -260,7 +260,7 @@ func (b *bundle) GetSignatureAs(batch *database.Batch, hash [32]byte) (protocol.

func (ctx *MessageContext) recordPending(batch *database.Batch) (*protocol.TransactionStatus, error) {
// Store the message
msg := ctx.message
msg := ctx.message
h := msg.Hash()
err := batch.Message(h).Main().Put(msg)
if err != nil {
Expand Down

0 comments on commit ea33040

Please sign in to comment.