(txs sequence.Transactions)
| 383 | } |
| 384 | |
| 385 | func (buf *Buffer) WriteSequenceTransactions(txs sequence.Transactions) (EncodeType, error) { |
| 386 | if len(txs) == 0 { |
| 387 | return Stateless, fmt.Errorf("transactions is empty") |
| 388 | } |
| 389 | |
| 390 | if len(txs) > 255 { |
| 391 | return Stateless, fmt.Errorf("transactions exceeds 255") |
| 392 | } |
| 393 | |
| 394 | // The first byte is the number of transactions |
| 395 | buf.commitUint(uint(len(txs))) |
| 396 | buf.end([]byte{}, Stateless) |
| 397 | |
| 398 | encodeType := Stateless |
| 399 | |
| 400 | for _, tx := range txs { |
| 401 | t, err := buf.WriteSequenceTransaction(tx) |
| 402 | if err != nil { |
| 403 | return Stateless, err |
| 404 | } |
| 405 | |
| 406 | encodeType = maxPriority(encodeType, t) |
| 407 | } |
| 408 | |
| 409 | return encodeType, nil |
| 410 | } |
| 411 | |
| 412 | func (buf *Buffer) WriteSequenceTransaction(tx *sequence.Transaction) (EncodeType, error) { |
| 413 | // The first byte is the flag of the transaction, the specification follows: |
no test coverage detected