mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Merge #636: have peg-in witness creation strip witness for space savings
7737d29b7 have peg-in witness creation strip witness for space savings (Gregory Sanders)
Pull request description:
Cheaper peg-in witness for those with segwit transactions in Bitcoin.
resolves https://github.com/ElementsProject/elements/issues/628
Tree-SHA512: defc4f38b2456c6f45cf2ebd48a3d5f9e39544bd048606257ef6cf90623595c159f61e3df56845fb7a37a44b5019614e692663978a9664dd9b4d01b77bedeb86
This commit is contained in:
commit
1b78b9f222
1 changed files with 6 additions and 1 deletions
|
|
@ -5417,6 +5417,11 @@ 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;
|
||||
|
|
@ -5424,7 +5429,7 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue