Skip to content

Commit

Permalink
Merge 1b78b9f into merged_master (Elements PR ElementsProject#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Oct 30, 2020
2 parents 116d515 + 1b78b9f commit 35d19d9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5439,14 +5439,19 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef
mtx.vout.push_back(CTxOut(Params().GetConsensus().pegged_asset, value, GetScriptForDestination(wpkhash)));
mtx.vout.push_back(CTxOut(Params().GetConsensus().pegged_asset, 0, CScript()));

// Strip witness data for proof inclusion since only TXID-covered fields matters
CDataStream ssTxBack(SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
ssTxBack << txBTC;
std::vector<unsigned char> tx_data_stripped(ssTxBack.begin(), ssTxBack.end());

// Construct pegin proof
CScriptWitness pegin_witness;
std::vector<std::vector<unsigned char> >& stack = pegin_witness.stack;
stack.push_back(value_bytes);
stack.push_back(std::vector<unsigned char>(Params().GetConsensus().pegged_asset.begin(), Params().GetConsensus().pegged_asset.end()));
stack.push_back(std::vector<unsigned char>(genesisBlockHash.begin(), genesisBlockHash.end()));
stack.push_back(std::vector<unsigned char>(witness_script.begin(), witness_script.end()));
stack.push_back(txData);
stack.push_back(tx_data_stripped);
stack.push_back(txOutProofData);

// Peg-in witness isn't valid, even though the block header is(without depth check)
Expand Down

0 comments on commit 35d19d9

Please sign in to comment.