public class TxHandler extends Object
| Constructor and Description |
|---|
TxHandler(UTXOPool utxoPool)
Creates a public ledger whose current UTXOPool (collection of unspent transaction outputs) is
utxoPool. |
| Modifier and Type | Method and Description |
|---|---|
Transaction[] |
handleTxs(Transaction[] possibleTxs)
Handles each epoch by receiving an unordered array of proposed transactions, checking each
transaction for correctness, returning a mutually valid array of accepted transactions, and
updating the current UTXO pool as appropriate.
|
boolean |
isValidTx(Transaction tx) |
public TxHandler(UTXOPool utxoPool)
utxoPool. This should make a copy of utxoPool by using the UTXOPool(UTXOPool uPool)
constructor.public boolean isValidTx(Transaction tx)
tx are in the current UTXO pool,
(2) the signatures on each input of tx are valid,
(3) no UTXO is claimed multiple times by tx,
(4) all of txs output values are non-negative, and
(5) the sum of txs input values is greater than or equal to the sum of its output
values; and false otherwise.public Transaction[] handleTxs(Transaction[] possibleTxs)