From 4766f6a3cbcb04f13af7564854646c52ddde29e5 Mon Sep 17 00:00:00 2001 From: Simon Ordish Date: Tue, 6 Dec 2022 23:53:01 +0100 Subject: [PATCH] Make CreateOpReturnOutput public (#131) * 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 --- txoutput.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/txoutput.go b/txoutput.go index e6a241e2..be72f763 100644 --- a/txoutput.go +++ b/txoutput.go @@ -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 } @@ -170,7 +170,7 @@ 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 } @@ -178,7 +178,9 @@ func (tx *Tx) AddOpReturnPartsOutput(data [][]byte) error { 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)