TESTS PASS WOO

This commit is contained in:
Bel LaPointe
2023-10-24 07:21:12 -06:00
parent c2376afafd
commit 3ea29abf8b
2 changed files with 8 additions and 3 deletions

View File

@@ -196,7 +196,7 @@ func readTransactionRecipient(r io.Reader) (io.Reader, transactionRecipient, err
if b, err := readOne(r); err != nil {
return r, transactionRecipient{}, err
} else if !isSpaceByte(b) {
return r, transactionRecipient{}, fmt.Errorf("didnt find leading whitespace for transaction recipient")
return io.MultiReader(bytes.NewReader([]byte{b}), r), transactionRecipient{}, nil
}
r, err := readTransactionLeadingWhitespace(r)
@@ -216,12 +216,15 @@ func readTransactionRecipient(r io.Reader) (io.Reader, transactionRecipient, err
result.name += string([]byte{b})
continue
}
r = io.MultiReader(bytes.NewReader([]byte{b}), r)
break
}
if result.name == "" {
return nil, result, fmt.Errorf("did not parse any name for transaction recipient")
}
// read "NAME:NAME", now "(\s+|\n).*"
for {
b, err := readOne(r)
if err != nil {
@@ -234,6 +237,8 @@ func readTransactionRecipient(r io.Reader) (io.Reader, transactionRecipient, err
break
}
// read "\s+", now "(\n|\$1.00)"
if b, err := readOne(r); err != nil {
return r, result, err
} else if isSpaceByte(b) {