@@ -1858,7 +1858,7 @@ uint256 ComputeTaprootMerkleRoot(Span<const unsigned char> control, const uint25
18581858 uint256 k = tapleaf_hash;
18591859 for (int i = 0 ; i < path_len; ++i) {
18601860 CHashWriter ss_branch{HASHER_TAPBRANCH};
1861- Span< const unsigned char > node ( control. data () + TAPROOT_CONTROL_BASE_SIZE + TAPROOT_CONTROL_NODE_SIZE * i, TAPROOT_CONTROL_NODE_SIZE);
1861+ Span node{Span{ control}. subspan ( TAPROOT_CONTROL_BASE_SIZE + TAPROOT_CONTROL_NODE_SIZE * i, TAPROOT_CONTROL_NODE_SIZE)} ;
18621862 if (std::lexicographical_compare (k.begin (), k.end (), node.begin (), node.end ())) {
18631863 ss_branch << k << node;
18641864 } else {
@@ -1874,7 +1874,7 @@ static bool VerifyTaprootCommitment(const std::vector<unsigned char>& control, c
18741874 assert (control.size () >= TAPROOT_CONTROL_BASE_SIZE);
18751875 assert (program.size () >= uint256::size ());
18761876 // ! The internal pubkey (x-only, so no Y coordinate parity).
1877- const XOnlyPubKey p{Span< const unsigned char > {control. data () + 1 , control. data () + TAPROOT_CONTROL_BASE_SIZE} };
1877+ const XOnlyPubKey p{Span{control}. subspan ( 1 , TAPROOT_CONTROL_BASE_SIZE - 1 ) };
18781878 // ! The output pubkey (taken from the scriptPubKey).
18791879 const XOnlyPubKey q{program};
18801880 // Compute the Merkle root from the leaf and the provided path.
@@ -1886,7 +1886,7 @@ static bool VerifyTaprootCommitment(const std::vector<unsigned char>& control, c
18861886static bool VerifyWitnessProgram (const CScriptWitness& witness, int witversion, const std::vector<unsigned char >& program, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* serror, bool is_p2sh)
18871887{
18881888 CScript exec_script; // !< Actually executed script (last stack item in P2WSH; implied P2PKH script in P2WPKH; leaf script in P2TR)
1889- Span< const valtype> stack{witness.stack };
1889+ Span stack{witness.stack };
18901890 ScriptExecutionData execdata;
18911891
18921892 if (witversion == 0 ) {
0 commit comments