[bitcoin/bitcoin] Implement BIP 174 Partially Signed Bitcoin Transactions (#12136)

achow101 commented on this pull request.

> + // Retrieve sha256 from key
+ uint256 hash(std::vector(key.begin() + 1, key.end()));
+
+ // Read in the redeemscript
+ std::vector witnessscript_bytes;
+ witnessscript_bytes.resize(value_len);
+ Span witnessscript_data = MakeSpan(witnessscript_bytes);
+ s >> witnessscript_data;
+ CScript witnessscript(witnessscript_bytes.begin(), witnessscript_bytes.end());
+
+ // Check that the witnessscript sha256 matches the one provided
+ sha256_hasher.Write(&witnessscript_bytes[0], witnessscript_bytes.size());
+ unsigned char ws_sha256_data[sha256_hasher.OUTPUT_SIZE];
+ sha256_hasher.Finalize(ws_sha256_data);
+ uint256 ws_sha256(std::vector(ws_sha256_data, ws_sha256_data + sha256_hasher.OUTPUT_SIZE));
+ if (hash.Compare(ws_sha256) != 0) {

Done

Добавить комментарий