mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
ScriptHasValidPAKProof takes fedpeg as arg
This commit is contained in:
parent
89174e9617
commit
802a055191
3 changed files with 6 additions and 20 deletions
|
|
@ -92,18 +92,11 @@ void CPAKList::ToBytes(std::vector<std::vector<unsigned char> >& offline_keys, s
|
|||
|
||||
// Proof follows the OP_RETURN <genesis_block_hash> <destination_scriptpubkey>
|
||||
// in multiple pushes: <full_pubkey> <proof>
|
||||
bool ScriptHasValidPAKProof(const CScript& script, const uint256& genesis_hash)
|
||||
bool ScriptHasValidPAKProof(const CScript& script, const uint256& genesis_hash, const CPAKList& paklist)
|
||||
{
|
||||
assert(script.IsPegoutScript(genesis_hash));
|
||||
|
||||
CPAKList paklist;
|
||||
if (g_paklist_config) {
|
||||
paklist = *g_paklist_config;
|
||||
} else {
|
||||
paklist = g_paklist_blockchain;
|
||||
}
|
||||
|
||||
if (paklist.IsReject() || paklist.IsEmpty()) {
|
||||
if (paklist.IsReject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public:
|
|||
** given the PAK list. Two pushes after regular pegout script:
|
||||
** <full_pubkey> <proof>
|
||||
**/
|
||||
bool ScriptHasValidPAKProof(const CScript& script, const uint256& genesis_hash);
|
||||
bool ScriptHasValidPAKProof(const CScript& script, const uint256& genesis_hash, const CPAKList& paklist);
|
||||
|
||||
CPAKList GetActivePAKList(const CBlockIndex* pblockindex, const Consensus::Params& params);
|
||||
|
||||
|
|
|
|||
|
|
@ -5198,10 +5198,7 @@ UniValue sendtomainchain_pak(const JSONRPCRequest& request)
|
|||
subtract_fee = request.params[2].get_bool();
|
||||
}
|
||||
|
||||
CPAKList paklist = g_paklist_blockchain;
|
||||
if (g_paklist_config) {
|
||||
paklist = *g_paklist_config;
|
||||
}
|
||||
CPAKList paklist = GetActivePAKList(chainActive.Tip(), Params().GetConsensus());
|
||||
if (paklist.IsReject()) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pegout freeze is under effect to aid a pak transition to a new list. Please consult the network operator.");
|
||||
}
|
||||
|
|
@ -5339,8 +5336,7 @@ UniValue sendtomainchain_pak(const JSONRPCRequest& request)
|
|||
CTxDestination address(nulldata);
|
||||
assert(GetScriptForDestination(nulldata).IsPegoutScript(genesisBlockHash));
|
||||
|
||||
txnouttype txntype;
|
||||
if (!IsStandard(GetScriptForDestination(nulldata), txntype)) {
|
||||
if (!ScriptHasValidPAKProof(GetScriptForDestination(nulldata), Params().ParentGenesisBlockHash(), paklist)) {
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Resulting scriptPubKey is non-standard. Ensure pak=reject is not set");
|
||||
}
|
||||
|
||||
|
|
@ -6482,10 +6478,7 @@ UniValue generatepegoutproof(const JSONRPCRequest& request)
|
|||
if (!secp256k1_ec_pubkey_parse(secp256k1_ctx, &onlinepubkey_secp, &onlinepubkeybytes[0], onlinepubkeybytes.size()))
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Invalid online pubkey");
|
||||
|
||||
CPAKList paklist = g_paklist_blockchain;
|
||||
if (g_paklist_config) {
|
||||
paklist = *g_paklist_config;
|
||||
}
|
||||
CPAKList paklist = GetActivePAKList(chainActive.Tip(), Params().GetConsensus());
|
||||
if (paklist.IsReject()) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pegout freeze is under effect to aid a pak transition to a new list. Please consult the network operator.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue