(tx *bc.CommitmentsTx)
| 76 | ) |
| 77 | |
| 78 | func (bb *BlockBuilder) AddTx(tx *bc.CommitmentsTx) error { |
| 79 | if len(bb.txs) >= bb.MaxBlockTxs { |
| 80 | return ErrBlockFull |
| 81 | } |
| 82 | err := bb.checkTransactionTime(tx.Tx, bb.timestampMS) |
| 83 | if err != nil { |
| 84 | return err |
| 85 | } |
| 86 | runlimit, ok := checked.AddInt64(bb.runlimit, tx.Tx.Runlimit) |
| 87 | if !ok { |
| 88 | return ErrBlockRunlimit |
| 89 | } |
| 90 | err = bb.snapshot.ApplyTx(tx) |
| 91 | if err != nil { |
| 92 | return err |
| 93 | } |
| 94 | |
| 95 | bb.runlimit = runlimit |
| 96 | bb.txs = append(bb.txs, tx) |
| 97 | |
| 98 | return nil |
| 99 | } |
| 100 | |
| 101 | func (bb *BlockBuilder) Build() (*bc.UnsignedBlock, *state.Snapshot, error) { |
| 102 | prev := bb.snapshot.Header |
no test coverage detected