Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
brennanjl committed Aug 11, 2023
1 parent d1cd3d6 commit 9ade0b3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/transactions/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ import (

type Transaction struct {
Signature *crypto.Signature
Payload *TransactionPayload
Body *TransactionBody
Sender crypto.PublicKey
}

// Verify verifies the signature of the transaction
func (t *Transaction) Verify() error {
data, err := t.Payload.MarshalBinary()
data, err := t.Body.MarshalBinary()
if err != nil {
return err
}

return t.Sender.Verify(t.Signature, data)
}

// TransactionPayload is a generic payload type that can be used to send binary data
type TransactionPayload struct {
// TransactionBody is the body of a transaction that gets included in the signature
type TransactionBody struct {
// Payload are the raw bytes of the payload data
Payload rlp.SerializedData

Expand All @@ -38,10 +38,10 @@ type TransactionPayload struct {
// Nonce is the next nonce of the sender
Nonce uint64

// Salt is a random number used to prevent replay attacks, as well as help guarantee uniqueness
Salt uint64
// Salt is a random value that is used to prevent replay attacks and hash collisions
Salt []byte
}

func (t *TransactionPayload) MarshalBinary() ([]byte, error) {
func (t *TransactionBody) MarshalBinary() ([]byte, error) {
return rlp.Encode(t)
}

0 comments on commit 9ade0b3

Please sign in to comment.