(nonce *big.Int, randomNonce bool)
| 360 | } |
| 361 | |
| 362 | func (buf *Buffer) WriteSequenceNonce(nonce *big.Int, randomNonce bool) (EncodeType, error) { |
| 363 | paddedNonce := make([]byte, 32) |
| 364 | copy(paddedNonce[32-len(nonce.Bytes()):], nonce.Bytes()) |
| 365 | |
| 366 | // The nonce is encoded in two parts, the first 160 bits are the space |
| 367 | // the last 96 bits are the nonce itself, the nonce space can be saved to storage |
| 368 | // unless it is a random nonce |
| 369 | spaceBytes := paddedNonce[:20] |
| 370 | nonceBytes := paddedNonce[20:] |
| 371 | |
| 372 | t1, err := buf.WriteWord(spaceBytes, !randomNonce) |
| 373 | if err != nil { |
| 374 | return Stateless, err |
| 375 | } |
| 376 | |
| 377 | t2, err := buf.WriteWord(nonceBytes, false) |
| 378 | if err != nil { |
| 379 | return Stateless, err |
| 380 | } |
| 381 | |
| 382 | return maxPriority(t1, t2), nil |
| 383 | } |
| 384 | |
| 385 | func (buf *Buffer) WriteSequenceTransactions(txs sequence.Transactions) (EncodeType, error) { |
| 386 | if len(txs) == 0 { |
no test coverage detected