Skip to content

Commit

Permalink
type check unknowns array contents in PSBTOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Kerin committed Jan 9, 2019
1 parent 5fcb981 commit 5b5a890
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Transaction/PSBT/PSBTOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,24 @@ class PSBTOutput
* @param ScriptInterface|null $redeemScript
* @param ScriptInterface|null $witnessScript
* @param PSBTBip32Derivation[] $bip32Derivations
* @param BufferInterface[] $unknown
* @param BufferInterface[] $unknowns
*/
public function __construct(
ScriptInterface $redeemScript = null,
ScriptInterface $witnessScript = null,
array $bip32Derivations = [],
array $unknown = []
array $unknowns = []
) {
foreach ($unknowns as $key => $unknown) {
if (!is_string($key) || !($unknown instanceof BufferInterface)) {
throw new \RuntimeException("Unknowns must be a map of string keys to Buffer values");
}
}

$this->redeemScript = $redeemScript;
$this->witnessScript = $witnessScript;
$this->bip32Derivations = $bip32Derivations;
$this->unknown = $unknown;
$this->unknown = $unknowns;
}

/**
Expand Down

0 comments on commit 5b5a890

Please sign in to comment.