diff --git a/internal/core/execute/v2/block/msg_block_anchor.go b/internal/core/execute/v2/block/msg_block_anchor.go index 0921bb021..b24f5eea1 100644 --- a/internal/core/execute/v2/block/msg_block_anchor.go +++ b/internal/core/execute/v2/block/msg_block_anchor.go @@ -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") diff --git a/internal/core/execute/v2/block/msg_common.go b/internal/core/execute/v2/block/msg_common.go index 40ba689aa..ca0c08da2 100644 --- a/internal/core/execute/v2/block/msg_common.go +++ b/internal/core/execute/v2/block/msg_common.go @@ -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 @@ -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 {