Skip to content

Commit

Permalink
The BPU struct name changed, lots of cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Jun 24, 2023
1 parent 71db1ed commit 21a0b34
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bob.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
//
// DO NOT CHANGE ORDER - aligned for memory optimization (malign)
type Tx struct {
bpu.BpuTx
bpu.Tx
}

// NewFromBytes creates a new BOB Tx from a NDJSON line representing a BOB transaction,
Expand Down Expand Up @@ -70,7 +70,7 @@ func NewFromTx(tx *bt.Tx) (bobTx *Tx, err error) {

// FromBytes takes a BOB formatted tx string as bytes
func (t *Tx) FromBytes(line []byte) error {
tu := new(bpu.BpuTx)
tu := new(bpu.Tx)
if err := json.Unmarshal(line, &tu); err != nil {
return fmt.Errorf("error parsing line: %v, %w", line, err)
}
Expand Down Expand Up @@ -100,7 +100,8 @@ func (t *Tx) FromBytes(line []byte) error {
t.In = tu.In
t.Lock = tu.Lock
t.Out = fixedOuts
t.Tx = tu.Tx

t.Tx.Tx = tu.Tx

// Check for missing hex values and supply them
for outIdx, out := range t.Out {
Expand Down Expand Up @@ -169,7 +170,7 @@ func (t *Tx) FromRawTxString(rawTxString string) (err error) {

bpuTx, err := bpu.Parse(bpu.ParseConfig{RawTxHex: &rawTxString, SplitConfig: splitConfig})
if bpuTx != nil {
t.BpuTx = *bpuTx
t.Tx = *bpuTx
}

return
Expand Down Expand Up @@ -210,7 +211,7 @@ func (t *Tx) FromTx(tx *bt.Tx) error {
return err
}
if bpuTx != nil {
t.BpuTx = *bpuTx
t.Tx = *bpuTx
}
return nil
}
Expand Down

0 comments on commit 21a0b34

Please sign in to comment.