From 2fe789a97debe76ffd8ce988df522cc4e020e5fa Mon Sep 17 00:00:00 2001 From: Brannon King Date: Tue, 9 Jul 2019 14:32:08 -0600 Subject: [PATCH 1/3] updated to support using bech32 addresses with claim ops --- src/bloom.cpp | 4 +- src/consensus/tx_verify.cpp | 3 +- src/policy/policy.cpp | 2 +- src/rpc/client.cpp | 3 + src/script/interpreter.cpp | 8 +- src/script/ismine.cpp | 46 ++--- src/script/ismine.h | 4 +- src/wallet/rpcdump.cpp | 10 +- src/wallet/rpcwallet.cpp | 258 ++++++++++++++++------------ src/wallet/test/claim_rpc_tests.cpp | 30 +++- src/wallet/wallet.cpp | 28 +-- 11 files changed, 229 insertions(+), 167 deletions(-) diff --git a/src/bloom.cpp b/src/bloom.cpp index 24eebe2e3..d3504f98e 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include +#include #include #include @@ -166,7 +167,8 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx) { txnouttype type; std::vector > vSolutions; - if (Solver(txout.scriptPubKey, type, vSolutions) && + const CScript& scriptPubKey = StripClaimScriptPrefix(txout.scriptPubKey); + if (Solver(scriptPubKey, type, vSolutions) && (type == TX_PUBKEY || type == TX_MULTISIG)) insert(COutPoint(hash, i)); } diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp index d80da5d1b..47c9d0248 100644 --- a/src/consensus/tx_verify.cpp +++ b/src/consensus/tx_verify.cpp @@ -154,7 +154,8 @@ int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& i const Coin& coin = inputs.AccessCoin(tx.vin[i].prevout); assert(!coin.IsSpent()); const CTxOut &prevout = coin.out; - nSigOps += CountWitnessSigOps(tx.vin[i].scriptSig, prevout.scriptPubKey, &tx.vin[i].scriptWitness, flags); + const CScript& scriptPubKey = StripClaimScriptPrefix(prevout.scriptPubKey); + nSigOps += CountWitnessSigOps(tx.vin[i].scriptSig, scriptPubKey, &tx.vin[i].scriptWitness, flags); } return nSigOps; } diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index b00f5a03c..3e6e74955 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -208,7 +208,7 @@ bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs) const CTxOut &prev = mapInputs.AccessCoin(tx.vin[i].prevout).out; // get the scriptPubKey corresponding to this input: - CScript prevScript = prev.scriptPubKey; + CScript prevScript = StripClaimScriptPrefix(prev.scriptPubKey); if (prevScript.IsPayToScriptHash()) { std::vector > stack; diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 9fa042016..489299f99 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -171,6 +171,9 @@ static const CRPCConvertParam vRPCConvertParams[] = { "rescanblockchain", 0, "start_height"}, { "rescanblockchain", 1, "stop_height"}, { "createwallet", 1, "disable_private_keys"}, + { "listnameclaims", 0, "includesupports"}, + { "listnameclaims", 1, "activeonly"}, + { "listnameclaims", 2, "minconf"}, }; class CRPCConvertTable diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 2ea134818..9152d02de 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -4,6 +4,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include