Skip to content

Use custom JSON marshal instead of object duplication #54

Description

@cubistplay

Currently, some of the Transaction-related objects have two forms, which implement normal type and for marshaling.

type SignedTransactionJSON struct {
BlockNumber int `json:"blockNumber,omitempty"`
BlockHash string `json:"blockHash,omitempty"`
TransactionIndex int `json:"transactionIndex,omitempty"`
Sig string `json:"sig"`
Hash string `json:"hash"`
}

type SignedTransaction struct {
Unsigned TransactionInterface
BlockNumber *int
BlockHash *primitives.H256
TransactionIndex *int
signature []byte
}

This implementation is from codechain-sdk-js.
But since golang can implement custom marshaling function (link1) (link2), I think duplication of the objects is unnecessary.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions