Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CreateOpReturnOutput public #131

Merged
merged 17 commits into from
Dec 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions txoutput.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (tx *Tx) AddHashPuzzleOutput(secret, publicKeyHash string, satoshis uint64)
// AddOpReturnOutput creates a new Output with OP_FALSE OP_RETURN and then the data
// passed in encoded as hex.
func (tx *Tx) AddOpReturnOutput(data []byte) error {
o, err := createOpReturnOutput([][]byte{data})
o, err := CreateOpReturnOutput([][]byte{data})
if err != nil {
return err
}
Expand All @@ -170,15 +170,17 @@ func (tx *Tx) AddOpReturnOutput(data []byte) error {
// AddOpReturnPartsOutput creates a new Output with OP_FALSE OP_RETURN and then
// uses OP_PUSHDATA format to encode the multiple byte arrays passed in.
func (tx *Tx) AddOpReturnPartsOutput(data [][]byte) error {
o, err := createOpReturnOutput(data)
o, err := CreateOpReturnOutput(data)
if err != nil {
return err
}
tx.AddOutput(o)
return nil
}

func createOpReturnOutput(data [][]byte) (*Output, error) {
// CreateOpReturnOutput creates a new Output with OP_FALSE OP_RETURN and then
// uses OP_PUSHDATA format to encode the multiple byte arrays passed in.
func CreateOpReturnOutput(data [][]byte) (*Output, error) {
s := &bscript.Script{}

_ = s.AppendOpcodes(bscript.OpFALSE, bscript.OpRETURN)
Expand Down