1 | <?php |
||
14 | class MerkleRoot |
||
15 | { |
||
16 | /** |
||
17 | * @var TransactionInterface[] |
||
18 | */ |
||
19 | private $transactions; |
||
20 | |||
21 | /** |
||
22 | * @var Math |
||
23 | */ |
||
24 | private $math; |
||
25 | |||
26 | /** |
||
27 | * @var BufferInterface |
||
28 | */ |
||
29 | private $lastHash; |
||
30 | |||
31 | /** |
||
32 | * Instantiate the class when given a block |
||
33 | * |
||
34 | * @param Math $math |
||
35 | * @param TransactionInterface[] $txCollection |
||
36 | */ |
||
37 | 8 | public function __construct(Math $math, array $txCollection) |
|
42 | |||
43 | /** |
||
44 | * @param callable|null $hashFunction |
||
45 | * @return BufferInterface |
||
46 | * @throws MerkleTreeEmpty |
||
47 | */ |
||
48 | 8 | public function calculateHash(callable $hashFunction = null): BufferInterface |
|
88 | } |
||
89 |