From 953dd82eae60c09b8eaed47e632e8af0b04a2bb0 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Mon, 19 Aug 2019 12:07:10 -0400 Subject: [PATCH] p2sh-wrap peg-in addresses if fedpeg_program is p2sh-wrapped --- src/wallet/rpcwallet.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 34c66c0c69..a8bef5d7ef 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4859,8 +4859,10 @@ UniValue getpeginaddress(const JSONRPCRequest& request) // Get P2CH deposit address on mainchain from most recent fedpegscript. const auto& fedpegscripts = GetValidFedpegScripts(chainActive.Tip(), Params().GetConsensus(), true /* nextblock_validation */); CTxDestination mainchain_dest(WitnessV0ScriptHash(calculate_contract(fedpegscripts.front().second, dest_script))); - // P2SH-wrapped is the only valid choice for non-dynafed chains - if (!IsDynaFedEnabled(chainActive.Tip(), Params().GetConsensus())) { + // P2SH-wrapped is the only valid choice for non-dynafed chains but still an + // option for dynafed-enabled ones as well + if (!IsDynaFedEnabled(chainActive.Tip(), Params().GetConsensus()) || + fedpegscripts.front().first.IsPayToScriptHash()) { mainchain_dest = ScriptHash(GetScriptForDestination(mainchain_dest)); }