Skip to content

Commit 542403d

Browse files
author
Thomas Kerin
committed
type check unknowns array contents in PSBTOutput
1 parent 5fcb981 commit 542403d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Transaction/PSBT/PSBTOutput.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,18 @@ public function __construct(
5555
ScriptInterface $redeemScript = null,
5656
ScriptInterface $witnessScript = null,
5757
array $bip32Derivations = [],
58-
array $unknown = []
58+
array $unknowns = []
5959
) {
60+
foreach ($unknowns as $key => $unknown) {
61+
if (!is_string($key) || !($unknown instanceof BufferInterface)) {
62+
throw new \RuntimeException("Unknowns must be a map of string keys to Buffer values");
63+
}
64+
}
65+
6066
$this->redeemScript = $redeemScript;
6167
$this->witnessScript = $witnessScript;
6268
$this->bip32Derivations = $bip32Derivations;
63-
$this->unknown = $unknown;
69+
$this->unknown = $unknowns;
6470
}
6571

6672
/**

0 commit comments

Comments
 (0)