io: redo Serializable to return errors in BinReader/BinWriter
Further simplifies error handling.
This commit is contained in:
parent
0bb8950f89
commit
d1a4e43c48
59 changed files with 418 additions and 605 deletions
|
@ -211,11 +211,10 @@ func storeAsTransaction(batch storage.Batch, tx *transaction.Transaction, index
|
|||
key := storage.AppendPrefix(storage.DataTransaction, tx.Hash().BytesReverse())
|
||||
buf := io.NewBufBinWriter()
|
||||
buf.WriteLE(index)
|
||||
if err := tx.EncodeBinary(buf.BinWriter); err != nil {
|
||||
return err
|
||||
tx.EncodeBinary(buf.BinWriter)
|
||||
if buf.Err != nil {
|
||||
return buf.Err
|
||||
}
|
||||
|
||||
batch.Put(key, buf.Bytes())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue