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 542403d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Transaction/PSBT/PSBTOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,18 @@ 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 542403d

Please sign in to comment.