File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,11 @@ const ATOMIC_BEEF = uint32(0x01010101) // BRC-95
2727
2828func (t * Transaction ) FromBEEF (beef []byte ) error {
2929 tx , err := NewTransactionFromBEEF (beef )
30+ if err != nil {
31+ return fmt .Errorf ("failed to parse BEEF bytes: %w" , err )
32+ }
3033 * t = * tx
31- return err
34+ return nil
3235}
3336
3437func NewBeefV1 () * Beef {
Original file line number Diff line number Diff line change @@ -57,7 +57,12 @@ func TestFromBEEF(t *testing.T) {
5757
5858 _ , err = NewBeefFromTransaction (tx )
5959 require .NoError (t , err , "NewBeefFromTransaction method failed" )
60+ }
6061
62+ func TestFromBeefErrorCase (t * testing.T ) {
63+ tx := & Transaction {}
64+ err := tx .FromBEEF ([]byte ("invalid data" ))
65+ require .Error (t , err , "FromBEEF method should fail with invalid data" )
6166}
6267
6368func TestNewEmptyBEEF (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments