Merge #915: [0.18 backport] Backport #904: Fix parsing of amount commitments from prevtxs in signrawtransactionw…

4e3161620 Fix parsing of amount commitments from prevtxs in signrawtransactionwithkey (Glenn Willen)

Pull request description:

Tree-SHA512: ead69e32fb14ee85f776f786f8510df1b71432e2f3fa02588913c94566219d7b951987162be205269a67acc8b1f1cca84e78278b4bb28fb129b9ca339cda1672
This commit is contained in:
Steven Roose 2020-10-06 20:03:31 +02:00
commit e77d754b88
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87

View file

@ -956,8 +956,7 @@ UniValue SignTransaction(interfaces::Chain& chain, CMutableTransaction& mtx, con
newcoin.out.nValue = CConfidentialValue(AmountFromValue(find_value(prevOut, "amount")));
} else if (prevOut.exists("amountcommitment")) {
// Segwit sigs require the amount commitment to be sighashed
uint256 asset_commit = uint256S(prevOut["amountcommitment"].get_str());
newcoin.out.nValue.vchCommitment = std::vector<unsigned char>(asset_commit.begin(), asset_commit.end());
newcoin.out.nValue.vchCommitment = ParseHexO(prevOut, "amountcommitment");
}
newcoin.nHeight = 1;
view.AddCoin(out, std::move(newcoin), true);