Skip to content

Commit

Permalink
Make CreateOpReturnOutput public (#131)
Browse files Browse the repository at this point in the history
* Merge branch 'master' of https://github.com/libsv/go-bt

* Fix panic in ToAsm() caused by last commit. (#109)

* Fix rename of variable

* Fixed an old test that was failing due to changes in ToAsm() method

* Explicity check error

* Spelling

* All transaction parsing functions now use one function.  Added BIP-239 support (extended transaction format)

* Add comments and extra test

* Overcome linter

* Linter workarounds

* Linter fix

* More linting workarounds

* Minor changes to address comments in PR

* Make CreateOpReturnOutput public

* Added comment to CreateOpReturnOutput
  • Loading branch information
ordishs committed Dec 6, 2022
1 parent 4208458 commit 4766f6a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions txoutput.go
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

0 comments on commit 4766f6a

Please sign in to comment.