Пример #1
0
 /**
  * @param Binary $currency
  * @param string $description
  * @param Output $output
  * @param Binary $issuerAddress
  * @param string $signature
  */
 public function __construct(Binary $currency, $description, Output $output, Binary $issuerAddress, $signature)
 {
     parent::__construct([], [$output], $signature);
     $this->description = $description;
     $this->currency = $currency;
     $this->issuerAddress = $issuerAddress;
 }
Пример #2
0
 private function outputsExist(Transaction $transaction)
 {
     $exists = true;
     foreach ($transaction->getInputs() as $input) {
         if (!array_key_exists($input->getOutputIndex(), $input->getTransaction()->getOutputs())) {
             $this->errors[] = 'Invalid output index';
             $exists = false;
         }
     }
     return $exists;
 }
Пример #3
0
 private function getBasesOf(Transaction $transaction)
 {
     if ($transaction instanceof Base) {
         return [$transaction];
     }
     $bases = [];
     foreach ($transaction->getInputs() as $input) {
         $bases = array_merge($bases, $this->getBasesOf($input->getTransaction()));
     }
     return $bases;
 }
Пример #4
0
 /**
  * @param Base[] $bases
  * @param Output $output
  * @param Binary $hash
  * @param string $signature
  */
 public function __construct(array $bases, Output $output, Binary $hash, $signature)
 {
     parent::__construct(array_map([$this, 'makeInput'], $bases), $this->keepChange($bases, $output), $signature);
     $this->hash = $hash;
 }