Skip to content

Commit

Permalink
fix index out of range error during bitbus sync
Browse files Browse the repository at this point in the history
  • Loading branch information
rohenaz committed Oct 29, 2020
1 parent 08e2368 commit 6f3b36e
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions bmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,20 @@ func NewFromBob(bobTx *bob.Tx) (bmapTx *Tx, err error) {
func (bTx *Tx) FromBob(bobTx *bob.Tx) (err error) {
for _, out := range bobTx.Out {
for _, tape := range out.Tape {
switch tape.Cell[0].S {
case aip.Prefix:
bTx.AIP = aip.NewFromTape(tape)
bTx.AIP.SetDataFromTape(out.Tape)
case bap.Prefix:
bTx.BAP, err = bap.NewFromTape(&tape)
case magic.Prefix:
bTx.MAP, err = magic.NewFromTape(&tape)
case b.Prefix:
bTx.B = b.New()
err = bTx.B.FromTape(tape)
if len(tape.Cell) > 0 {
prefixData := tape.Cell[0].S
switch prefixData {
case aip.Prefix:
bTx.AIP = aip.NewFromTape(tape)
bTx.AIP.SetDataFromTape(out.Tape)
case bap.Prefix:
bTx.BAP, err = bap.NewFromTape(&tape)
case magic.Prefix:
bTx.MAP, err = magic.NewFromTape(&tape)
case b.Prefix:
bTx.B = b.New()
err = bTx.B.FromTape(tape)
}
}
}

Expand Down

0 comments on commit 6f3b36e

Please sign in to comment.