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

achow101 commented on this pull request.

> + // Retrieve hash160 from key
+ uint160 hash160(std::vector(key.begin() + 1, key.end()));
+
+ // Read in the redeemscript
+ std::vector redeemscript_bytes;
+ redeemscript_bytes.resize(value_len);
+ Span redeemscript_data = MakeSpan(redeemscript_bytes);
+ s >> redeemscript_data;
+ CScript redeemscript(redeemscript_bytes.begin(), redeemscript_bytes.end());
+
+ // Check that the redeemscript hash160 matches the one provided
+ hash160_hasher.Write(&redeemscript_bytes[0], redeemscript_bytes.size());
+ unsigned char rs_hash160_data[hash160_hasher.OUTPUT_SIZE];
+ hash160_hasher.Finalize(rs_hash160_data);
+ uint160 rs_hash160(std::vector(rs_hash160_data, rs_hash160_data + hash160_hasher.OUTPUT_SIZE));
+ if (hash160.Compare(rs_hash160) != 0) {

Done

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